我从MacPorts上安装并configuration了Mac上的nginx服务器
sudo port install nginx
nginx.conf
重命名为nginx.conf
,并将mime.types.example
重命名为mime.types
。 它工作正常,但我无法阻止它。
我尝试了sudo nginx -s stop
,但是这并不能阻止服务器,我仍然可以看到“Welcome to nginx!” 页面在我的浏览器上http://localhost/
; 另外我还看到ps -e | grep nginx
的nginx的master和worker进程 ps -e | grep nginx
。
在Mac上启动/停止nginx的最佳方式是什么?
顺便说一下,我已经添加了“守护进程”。 到nginx.conf中 – 按照各种资源的build议。
# nginx -h ... -s signal : send signal to a master process: stop, quit, reopen, reload ...
对于通过MacPorts安装的Nginx来说,正确的方法是:
sudo port load nginx
sudo port unload nginx
OS X使用launchd,所以启动/停止守护进程的过程略有不同。
这个命令停止也会停止nginx。
sudo nginx -s stop
看看主进程的PID,然后做
kill -QUIT <master_pid>
您可以尝试以下方法:
ps -lef|grep -i nginx:|awk '{ print $2}'|xargs kill -9