官网地址: http://nginx.org/en/download.html
选择最新稳定版本,例如:nginx-1.24.0
解压命令
tar -zxvf nginx-1.24.0.tar
cd nginx-1.24.0
./configure --prefix=/usr/local/Cellar/nginx --sbin-path=/usr/local/Cellar/nginx/sbin/nginx --modules-path=/usr/local/Cellar/nginx/modules --conf-path=/usr/local/Cellar/nginx/conf/nginx.conf --error-log-path=/usr/local/Cellar/nginx/logs/error.log --pid-path=/usr/local/Cellar/nginx/logs/nginx.pid --http-log-path=/usr/local/Cellar/nginx/logs/access.log
make
make install
安装完成
进入安装的sbin目录
cd /usr/local/Cellar/nginx/sbin
启动nginx
./nginx
浏览器访问http://localhost 就可以看到效果了
1、启动nginx:./nginx
2、关闭nginx:./nginx -s stop
3、重启nginx:./nginx -s reload