我想停止Nginx,但它失败了.
$sudo service nginx stop Stopping nginx: [FAILED]
定义nginx.pid位置的nginx.conf有一行.
# /etc/nginx/nginx.conf pid /var/run/nginx.pid;
但目录/ var / run /中没有nginx.pid.
locate 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脚本停止.
ps -ef |grep nginx
这将显示nginx主进程的PID.就像你上面提到的:
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
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。