How to Fix Nginx Error [error] open() “/usr/local/Nginx/logs/Nginx.pid”

         Today while working on a project, I restarted the server and found the web service was inaccessible. The following error appeared:

nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)

After navigating to the logs directory, I confirmed that the nginx.pid file was indeed missing.
Solution:

[root@localhost ]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

That is, specify the configuration file path when starting the server.

Leave a Comment

Your email address will not be published.