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

时间:2021-11-27 03:41:06
重新启动服务器,访问web服务发现无法浏览,登陆服务器之 后进到nginx使用./nginx -s reload重新读取配置文件,发现报nginx: [error] open() "/usr/local/nginx1.9.1/logs/nginx.pid" failed (2: No such file or directory)错误,进到logs文件发现的确没有nginx.pid文件
 
root@timeless-HP-Pavilion-g4-Notebook-PC:/home/timeless# /usr/local/nginx1.9.1/sbin/nginx -s reload
nginx: [error] open() "/usr/local/nginx1.9.1/logs/nginx.pid" failed (: No such file or directory)
 
解决方法:
root@timeless-HP-Pavilion-g4-Notebook-PC:/usr/local/nginx1.9.1/logs#  /usr/local/nginx1.9.1/sbin/nginx -c /usr/local/nginx1.9.1/conf/nginx.conf
 
使用nginx -c的参数指定nginx.conf文件的位置
root@timeless-HP-Pavilion-g4-Notebook-PC:/usr/local/nginx1.9.1/logs# ls
access.log error.log host.access.log hostsalesmen.access.log nginx.pid salesmenerror.log
 
看nginx.pid文件已经有了。