nginx错误处理

Posted by epimetheusQ on 2021-09-24

nginx 错误处理

nginx 不存在nginx.pid

在执行nginx -s reload 时,报错:nginx: [error] open() “/usr/local/var/run/nginx.pid” failed (2: No such file or directory)

原因:在该目录下,未找到nginx.pid文件

使用nginx -t 获取到nginx.conf文件位置

1
2
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful

然后执行:

1
2
3
nginx -c /usr/local/etc/nginx/nginx.conf
nginx -s reload

即可解决。