Problem Scenario
After the server is restarted, error restart nginx nginx: [error] open () "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory), into the logs directory does not find nginx. pid file
Solution
Nginx.conf file using the specified manner restart nginx
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
还有一种可能就是nginx.conf的nginx.pid被注释了,将下图中pid前的#去掉,保存退出再次启动nginx
This time to view the logs directory under the file has been generated discovered nginx.pid