1,​​http://nginx.org/en/download.html​​​下载​​http://nginx.org/download/nginx-1.2.0.tar.gz​

2,tar -xf nginx-1.2.0.tar.gz

3,进入解压目录  chmod a+rwx *

mac下安装nginx_nginx


 

4,./configure --without-http_rewrite_module

mac下安装nginx_配置文件_02


 

5,make && make install

mac下安装nginx_html_03


 6,替换安装目录下的config.conf文件,见附件

7,sudo /usr/local/nginx/sbin/nginx

mac下安装nginx_nginx_04


 

浏览器访问 localhost

mac下安装nginx_配置文件_05


 启动nginx ,sudo nginx ;访问localhost:8080 发现已出现nginx的欢迎页面了。

 

备注: ln -s  /usr/local/sbin/nginx /usr/bin/nginx 做了个软连接。

常用的指令有: 

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

nginx -v 查看版本

nginx -c filename 指定配置文件

nginx -h 帮助

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