Report this

What is the reason for this report?

Unable to start nginx - failed to read pid from file /run/nginx.pid

Posted on November 7, 2014

Hi,

I just created a brand new fedora box.

I then install nginx by running yum install nginx.

I tried to start nginx with the following commands:

$ systemctl enable nginx
$ systemctl restart nginx

However, I got the following error

Failed to read PID from file /run/nginx.pid: Invalid argument

And nginx is not running properly (going to the public IP address of the box does not return anything.

Does anyone know what I did wrong?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

I’m curious, did you resolve this issue?

That pid error is often simply caused by restarting Nginx when it isn’t started in the first place. Though the init script should be smart enough to fall back from restart to start. So I don’t think that’s the real problem here. Check to see that Nginx is running and the port that it is listening on by running: netstat -plunt | grep nginx

On Fedora 20, firewalld is running by default. Have you opened port 80?

If the netstat output shows that it is running, then the firewall is most likely your problem. To open the port, run:

firewall-cmd --permanent --zone=public --add-service=http
systemctl restart firewalld.service

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.