Mac安装nginx

1. 安装PCRE

Download latest PCRE. After download go to download directory from terminal.

 

$ cd ~/Download $ tar xvzf pcre-8.12.tar.gz 

$ cd pcre-8.12 

$ sudo ./configure --prefix=/usr/local 

$ sudo make $ sudo install

 

2. 安装Nginx

Download latest nginx from Nginx.org. After download, let install

 

$ cd ~/Download $ tar xvzf nginx-1.0.0.tar.gz 

$ cd nginx-1.0.0

$ sudo ./configure --prefix=/usr/local --with-http_ssl_module --with-ld-opt="-L /usr/local/lib"

$ sudo make $ sudo make install

 

3. 运行Nginx

$ cd /usr/local/sbin

$ sudo ./nginx

访问http://localhost

 

4. 关闭Nginx

$ cd /usr/local/sbin

$ sudo ./nginx -s stop

原文地址:https://www.cnblogs.com/liuruichao/p/4005890.html