我想停止Nginx,但它失败了.
$sudo service Nginx stop Stopping Nginx: [Failed]
# /etc/Nginx/Nginx.conf pid /var/run/Nginx.pid;
但目录/ var / run /中没有Nginx.pid.
/var/run/Nginx.pid /var/run/Nginx.pid.oldbin
但在更新后,搜索没有匹配.
我在CentOS 6.5版(最终版)中使用Nginx / 1.4.4.
我应该怎么做才能阻止Nginx守护进程?
编辑2014/01/07
这是ps -ef |的输出grep Nginx,似乎Nginx守护进程仍在运行.
ironsand 17065 16933 0 15:55 pts/0 00:00:00 grep --color Nginx root 19506 1 0 2013 ? 00:00:00 Nginx: master process /usr/sbin/Nginx -c /etc/Nginx/Nginx.conf ironsand 19507 19506 0 2013 ? 00:00:25 Nginx: worker process
并且sudo服务Nginx restart会出现此错误.我认为Nginx无法启动,因为旧的还活着.并且/var/log/Nginx/error.log-2014017也包含此错误.
Stopping Nginx: [Failed] Starting Nginx: Nginx: [emerg] bind() to 0.0.0.0:80 Failed (98: Address already in use) Nginx: [emerg] bind() to 0.0.0.0:80 Failed (98: Address already in use) Nginx: [emerg] bind() to 0.0.0.0:80 Failed (98: Address already in use) Nginx: [emerg] bind() to 0.0.0.0:80 Failed (98: Address already in use) Nginx: [emerg] bind() to 0.0.0.0:80 Failed (98: Address already in use) Nginx: [emerg] still could not bind() [Failed]
我建议首先通过杀死它的主进程来停止Nginx. Nginx没有正确关闭可能是因为它无法使用init脚本停止.
原文链接:https://www.f2er.com/centos/374046.htmlps -ef |grep Nginx
root 19506 1 0 2013 ? 00:00:00 Nginx: master process
/usr/sbin/Nginx -c /etc/Nginx/Nginx.conf
用它来杀死它
kill -9 19506
再次验证是否有任何Nginx进程正在运行或端口80是否被占用.如果您看到任何进程绑定到端口80,请识别PID并检查它是否可以被终止.
ps -ef |grep Nginx
netstat -tulpn |grep 80
确保文件系统正常,您可以读/写/ var文件系统.然后启动Nginx
service Nginx start