I want to stop Nginx but it fails like this.
$ sudo service nginx stop
Stopping nginx: [FAILED]
And nginx.conf
that defines place of nginx.pid have a line.
# /etc/nginx/nginx.conf
pid /var/run/nginx.pid;
But there is no nginx.pid
in the directory /var/run/
.
locate nginx.pid
shows this output.
/var/run/nginx.pid
/var/run/nginx.pid.oldbin
But after updatedb
there is no match for the search.
I'm using nginx/1.4.4 in CentOS release 6.5 (Final)
.
What should I do to stop the nginx daemon?
Edit 2014/01/07
This is output of ps -ef | grep nginx
, it seems nginx daemon is still running.
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
And sudo service nginx restart
gives this error. I think nginx
fails to start because old one still alive. And /var/log/nginx/error.log-2014017
contains also this error.
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]