nginx 命令笔记(mac)
2017-09-20 本文已影响0人
北纬40度的思念
命令参数
-c </path/to/config> 为Nginx 指定一个配置文件,来代替缺省的。
-t 不运行,测试配置文件。
-v 显示nginx 的版本
-V 显示nginx 的版本,编译器版本和配置参数。
启动
# 进入nginx安装目录
cd /usr/local/Cellar/nginx/1.12.1/bin
# 验证 nginx.conf
sudo nginx -t -c /usr/local/etc/nginx/nginx.conf
# 启动
sudo nginx -c /usr/local/etc/nginx/nginx.conf
# 重启
sudo nginx -s reload
停止
从容停止
# 查看进程号
ps -ef|grep nginx
0 25462 1 0 5:26下午 ?? 0:00.00 nginx: master process nginx
-2 25463 25462 0 5:26下午 ?? 0:00.00 nginx: worker process
501 25467 25428 0 5:26下午 ttys005 0:00.00 grep nginx
# 找到 master 进程号
sudo kill -quit 25462
快速停止
# 查看进程号
ps -ef|grep nginx
0 25462 1 0 5:26下午 ?? 0:00.00 nginx: master process nginx
-2 25463 25462 0 5:26下午 ?? 0:00.00 nginx: worker process
501 25467 25428 0 5:26下午 ttys005 0:00.00 grep nginx
# 找到 master 进程号
sudo kill -term 25462
# 或者
sudo kill -int 25462
强制停止
sudo pkill -9 nginx