I have a ubuntu 14.04 machin with nginx, which was working fine until I last used my computer that was last night. Today when I started my computer and navigated to it said server not found so I tried restarting nginx nginx start was successful but I had the same issue on so I checked netstat -ntlp where I did not see port 80 anywhere. I am not sure what went wrong and clueless about it. Here is the nginx log :

2015/03/22 17:50:10 [alert] 5030#0: unlink() "/run/nginx.pid" failed (2: No such file or directory)

1 Answer 1



It is because by default Apache and nginx are listening to the same port number (:80)

  1. Reconfigure nginx to listen on a different port by following these steps:

    sudo vim /etc/nginx/sites-available/default
  2. Change all ports :80 to :8000 or another unused port number.

  3. Check if the configuration is correct:

    sudo service nginx configtest
  4. Restart nginx:

    sudo service nginx restart
  5. Check the status of nginx:

    sudo service nginx status

Note: You can also check on your browser whether nginx is working:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.