Home 前端/建站服务器/数据库 重启nginx报错:nginx: [error] open() “/run/nginx.pid” failed (2: No such file or directory)

重启nginx报错:nginx: [error] open() “/run/nginx.pid” failed (2: No such file or directory)

by Kevin
0 comment 14 views

重启Nginx遇到报错:nginx: [error] open() “/run/nginx.pid” failed (2: No such file or directory)
为什么会报错?nginx被停止时,nginx.pid被删除了。reload命令需要通过nginx.pid获取进程号,会去找nginx.pid ,如果不存在,就报错了。

解决办法:杀死80端口进程,再启动。

sudo fuser -k 80/tcp #关闭占用80端口的程序(nginx默认端口80)
sudo nginx -c /etc/nginx/nginx.conf //  启动nginx

Related Articles

Leave a Comment