nginx-error-open-usrlocalvarrunnginxpid-failed

4次阅读

共计 360 个字符,预计需要花费 1 分钟才能阅读完成。

错误信息

服务器重启后启动 nginx 报错

nginx: [error] open()“/usr/local/var/run/nginx.pid”failed (2: No such file or directory)

报错起因:

报错的起因是没有 nginx 文件夹或没有 nginx.pid 文件,因为每次重新启动,零碎都会主动删除文件

解决办法:

在 nginx 的配置文件 nginx.conf 中批改 nginx.pid 的地位,能够将图中红色局部的正文勾销的。

当初 pid 的地位就变成了 nginx 目录下的 logs 目录中

而后在 nginx 目录下创立 logs 目录

mkdir /usr/local/nginx/logs

在 sbin 目录下启动 nginx

./nginx -c /usr/local/nginx/conf/nginx.conf

就会在 logs 目录下主动生成 pid 文件

正文完
 0