1、报错信息:nginx: [error] open() "/var/run/nginx.pid" failed (2: No such file or directory)
pid文件丢失,报错。一般存在于每次电脑开机后重新启动nginx后
[root@localhost /etc/nginx/conf.d]# nginx -s reload
nginx: [error] open() "/var/run/nginx.pid" failed (2: No such file or directory)
[root@mysql-master /etc/nginx/conf.d]#
解决方案
- 将Nginx
kill
掉,重新拉起即可
[root@localhost /etc/nginx/conf.d]# ps -ef |grep nginx
root 2288 1 0 12:06 ? 00:00:00 nginx: master process nginx
nginx 2289 2288 0 12:06 ? 00:00:00 nginx: worker process
root 2291 1283 0 12:06 pts/0 00:00:00 grep --color=auto nginx
[root@localhost /etc/nginx/conf.d]# kill -9 2288- 重置.pid文件
[root@localhost /etc/nginx/conf.d]# sudo nginx -c /etc/nginx/nginx.conf (配置文件路径)#重新启动Nginx
[root@localhost /etc/nginx/conf.d]# nginx