How to Fix NGINX error “Failed to read PID from file”

It seems to be a race between systemd and nginx. As if systemd was expecting the PID file to be populated before nginx had the time to create it.

mkdir /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

 
Link: http://alfredoroca.github.io/nginx/2016/09/04/How-to-solve-failure-read-of-nginx-pid-file

Leave a comment

You must be logged in to post a comment.