mac下安装使用brewhome安装nginx

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  作个例子)


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值