欧阳简之 > Nginx提示Failed to read PID from file /data/app/nginx/run/nginx.pid: Invalid argument

热爱代码,对每一行代码保持一颗敬畏之心。

问题症状

偶然发现Nginx启动之后,查看状态时发现提示:Failed to read PID from file /data/app/nginx/run/nginx.pid: Invalid argument,如下图(忽略证书那个提示):

1112.jpg

解决办法

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

然后重启Nginx服务

systemctl daemon-reload 
systemctl restart nginx.service

验证

再次查看Nginx状态,已经没有那个提示了

systemctl restart nginx.service

1113.jpg

tagged by linux