Nginx Restart Error [error] invalid PID number /usr/…/nginx.pid Fix

The issue looks something like this — errors occur whether you try to restart or stop the service:

[root@123 ~]# service nginx restart
Stoping nginx… nginx: [error] invalid PID number "" in "/usr/local/nginx/logs/nginx.pid"
failed. Use force-quit
Starting nginx… nginx (pid 11124 599) already running.

The cause is likely that nginx has hung or frozen:

ps -ef|grep nginx

 

kill -9 599 11124    #Kill the master processes

Restart again, and it should work normally:

service nginx start
or
service nginx restart

Leave a Comment

Your email address will not be published.