Nginx: how to fix error: open() “/var/run/nginx.pid” failed


You can’t stop nginx when use these command:

service nginx stop
nginx -s stop

and see error:

open() "/var/run/nginx.pid" failed

Step 1: run this command:

ps -ef | grep nginx

Result:

[root@tutorialspots ~]# ps -ef | grep nginx
root     14234     1  0 05:01 ?        00:00:00 nginx: master process nginx
nobody   14235 14234  0 05:01 ?        00:00:00 nginx: worker process
root     14250 12892  0 05:23 pts/0    00:00:00 grep --color=auto nginx

Step 2: kill process

kill -9 14234
kill -9 14235

Now you can start nginx.

Related Post

No comments yet.

Leave a Reply