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

Posted November 7, 2014 135.1k views


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

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.

Submit an Answer
3 answers

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
  • hi,just like you say,I try:netstat -plunt | grep nginx
    print like that:
    tcp 0 0* LISTEN 2370/nginx: master

    tcp 0 0* LISTEN 2370/nginx: master

    tcp6 0 0 :::80 :::* LISTEN 2370/nginx: master

    tcp6 0 0 :::443 :::* LISTEN 2370/nginx: master

    [root@iZ943xbvop0Z ssl]# firewall-cmd –permanent –zone=public –add-service=http
    FirewallD is not running

    [root@iZ943xbvop0Z ssl]# systemctl restart firewalld.service
    Failed to issue method call: Unit firewalld.service is masked.

    how to solve the problem?

  • Thank you so much. This did the job

I’m curious, did you resolve this issue?