您的位置:首页 > 运维架构 > Nginx

mac下安装使用brewhome安装nginx

2016-03-04 10:03 776 查看
1. 安装brewhome(如果没有的话)

brewhome的安装 

请参考: https://github.com/Homebrew/homebrew/wiki/installation

接下来不废话直接安装,使用ruby安装(如果安装的链接有问题,请到官网查找链接,brewhome的官网是 http://brew.sh/)

打开命令行,输入(密码就是电脑密码):

DongtekiMacBook-Air:~
Dong$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
 

==> This script will
install:

/usr/local/bin/brew

/usr/local/Library/...

/usr/local/share/man/man1/brew.1

==> The following directories will be made group writable:

/usr/local/.

==> The following directories will have their group set to
admin:

/usr/local/.

Press ENTER to continue or any other key to abort

==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/.

Password:

Sorry, try again.

Password:

==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/.

==> Downloading and Installing Homebrew...

remote: Counting objects: 122077, done.

remote: Compressing objects: 100% (59644/59644), done.

remote: Total 122077 (delta 85582), reused 95298 (delta
61463)

Receiving objects: 100% (122077/122077), 19.32 MiB | 134 KiB/s,
done.

Resolving deltas: 100% (85582/85582), done.

From https://github.com/mxcl/homebrew
 * [new branch]  
   master  
  -> origin/master

HEAD is now at 4b51e11 Improve signal-to-noise ratio of `brew list
--unbrewed`

==> Installation successful!

You should run `brew doctor' *before* you install anything.

Now type: brew help

检测(可以跳过这一步吧):

DongtekiMacBook-Air:~
Dong$ $ brew doctor

-bash: $: command not found

DongtekiMacBook-Air:~ Dong$ brew doctor

Warning: Your Xcode (4.6.2) is outdated

Please install Xcode 4.6.3.

2. 安装nginx

命令行继续:

DongtekiMacBook-Air:~
Dong$ brew search nginx

nginx

DongtekiMacBook-Air:~ Dong$ brew install nginx

Warning: Your Xcode (4.6.2) is outdated

Please install Xcode 4.6.3.

==> Installing nginx
dependency: pcre

==> Downloading ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.33.ta
########################################################################
100.0%

########################################################################
100.0%==> ./configure --prefix=/usr/local/Cellar/pcre/8.33
--enable-utf8 --enable-unicod

==> make

==> make test

==> make install

��  /usr/local/Cellar/pcre/8.33: 140 files, 4.0M,
built in 17.8 minutes

==> Installing nginx

==> Downloading http://nginx.org/download/nginx-1.4.2.tar.gz
########################################################################
100.0%

==> Patching

patching file conf/nginx.conf

==> ./configure --prefix=/usr/local/Cellar/nginx/1.4.2
--with-http_ssl_module --wi

==> make

==> make install

==> Caveats

Docroot is: /usr/local/var/www

The default port has been set to 8080 so that nginx can run without
sudo.

If you want to host pages on your local machine to the wider
network you

can change the port to 80 in: /usr/local/etc/nginx/nginx.conf

You will then need to run nginx as root: `sudo nginx`.

To have launchd start nginx at login:

    mkdir -p
~/Library/LaunchAgents

    ln -sfv
/usr/local/opt/nginx/*.plist ~/Library/LaunchAgents

Then to load nginx now:

    launchctl load
~/Library/LaunchAgents/homebrew.mxcl.nginx.plist

==> Summary

��  /usr/local/Cellar/nginx/1.4.2: 7 files, 920K,
built in 2.1 minutes

安装好了,启动nginx:

DongtekiMacBook-Air:~
Dong$ nginx

打开网页,输入:

localhost:8080

可以看到nginx欢迎页面

 


Welcome to nginx!

 

If you see this page, the nginx web server is successfully
installed and working. Further configuration is required.

For online documentation and support please refer
to nginx.org.

Commercial support is available at nginx.com.

Thank you for using nginx.

 

常用的指令有:

nginx -V
查看版本,以及配置文件地址

nginx -v 查看版本

nginx -c filename
指定配置文件

nginx -h 帮助

nginx -s
[reload\reopen\stop\quit]

 

homebrew 常用的指令:

brew search mysql :
搜索具体的程序包

brew install mysql :
安装具体的程序包

brew info mysql :
查看具体程序的信息

brew uninstall mysql :
卸载具体的应用(这里只是用mysql  作个例子)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: