昨天遇到个问题,重启 nginx 时报错 nginx: [error] open()"/usr/local/nginx/logs/nginx.pid"failed (2: No such file or directory)
,进入到 logs 目录发现确实没有 nginx.pid 文件,网搜找了一下解决方案,这里做个备注。
cd /usr/local/nginx/sbin/
./nginx -s reload
ngx_http_fastdfs_set pid=1412
ngx_http_fastdfs_set pid=1412
ngx_http_fastdfs_set pid=1412
ngx_http_fastdfs_set pid=1412
nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)
使用指定 nginx.conf 文件的方式重启 nginx
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
此时去 logs 目录下查看发现 nginx.pid 文件已经生成了
原文地址:简书
改文章 解决 nginx: [error] open()"/usr/local/nginx/logs/nginx.pid"failed (2: No such file or directory) 错误问题 首发自 周良博客.