centos7 nginx Failed to read PID from file /run/nginx.pid: Invalid argument 解决方法

笔者在centos7上,配置nginx代理服务后,

systemctl status nginx.service

提示错误
Failed to read PID from file /run/nginx.pid: Invalid argument

看到好多说删掉改nginx.pid 文件的,试之,无效。

后来找到了一个方法:

mkdir -p /etc/systemd/system/nginx.service.d 
printf "[Service]\nExecStartPost=/bin/sleep 0.1\n" > /etc/systemd/system/nginx.service.d/override.conf

然后

systemctl daemon-reload 
systemctl restart nginx.service

添加新评论