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

Posted houss

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directo相关的知识,希望对你有一定的参考价值。

问题场景

服务器重启后,重启nginx时报错nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory),进入到logs目录发现确实没有nginx.pid文件

技术图片

解决办法

使用指定nginx.conf文件的方式重启nginx

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
还有一种可能就是nginx.conf的nginx.pid被注释了,将下图中pid前的#去掉,保存退出再次启动nginx
技术图片

此时去logs目录下查看发现nginx.pid文件已经生成了

以上是关于nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directo的主要内容,如果未能解决你的问题,请参考以下文章

解决Nginx: [error] open() "/usr/local/Nginx/logs/Nginx.pid

解决Nginx: [error] open() Nginx.pid

Nginx启动报错: could not open error log file: open() &q

解决Nginx: [error] open() "/usr/local/Nginx/logs/Nginx.pid

解决 nginx: [error] open() /usr/local/nginx/logs/nginx.pid failed 错误

解决Nginx: [error] open() "/usr/local/Nginx/logs/Nginx.pid