我想停止Nginx,但是这样失败了。
$ sudo service nginx stop
Stopping nginx: [FAILED]
并且nginx.conf
定义了nginx.pid的位置有一行。
# /etc/nginx/nginx.conf
pid /var/run/nginx.pid;
但是nginx.pid
目录中没有/var/run/
。
locate nginx.pid
显示此输出。
/var/run/nginx.pid
/var/run/nginx.pid.oldbin
但是之后updatedb
没有匹配的搜索。我在中使用nginx / 1.4.4 CentOS release 6.5 (Final)
。
我应该怎么做才能停止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 service 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]
ps
命令结果。
ps -ef | grep nginx
或进行检查sudo netstat -tlnp | grep nginx
。