nginx.service: Failed to parse PID from file /var/run/nginx.pid: Invalid argument bugs
I’ve installed nginx and start the service with systemctl, but I got an error.
nginx.service: Failed to parse PID from file /var/run/nginx.pid
and I found the solution in the link. check this link if you have the same error.
https://bugs.launchpad.net/ubuntu/+source/nginx/+bug/1581864:
Because sudo can be different in some systems, this worked best for me:
# Fix for Nginx PID problem in Ubuntu 16.04 in an EC2 instance
sudo systemctl stop nginx
sudo mkdir /etc/systemd/system/nginx.service.d
# build the file in root where no sudo is needed
printf “[Service]\nExecStartPost=/bin/sleep 0.1\n” > override.conf
sudo cp override.conf /etc/systemd/system/nginx.service.d/override.conf
sudo systemctl daemon-reload
sudo systemctl start nginx