nginx 启动,重启,添加开机启动等相关命令

nginx -t 测试 配置文件是否正确,同时可以查看配置文件路径

nginx -c /usr/local/nginx/conf/nginx.conf 启动nginx

ps -ef|grep nginx 查看nginx 进程号

左边前三个数字 分别 为UID(被该UID所拥有)、PID (程序ID,即进程号)、PPID (上级父程序ID)
杀死进程 kill -QUIT 2072
重启 nginx:
nginx -s reload

关闭nginx

nginx -s stop

或nginx -s quit

启动nginx

nginx

nginx 添加开机启动,

参考网址:

http://blog.csdn.net/y87329396/article/details/47805903

如果是通过brew安装的nginx(安装目录为

/usr/local/Cellar

),

则用如下两条命令实现开机启动

sudo cp /usr/local/opt/nginx/*.plist /Library/LaunchDaemons

sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.nginx.plist