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 127.0.0.1 it said server not found so I tried restarting nginx nginx start was successful but I had the same issue on 127.0.0.1 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
Problem:
It is because by default Apache and nginx are listening to the same port number (:80)
Reconfigure nginx to listen on a different port by following these steps:
sudo vim /etc/nginx/sites-available/defaultChange all ports
:80to:8000or another unused port number.Check if the configuration is correct:
sudo service nginx configtestRestart nginx:
sudo service nginx restartCheck the status of nginx:
sudo service nginx status
Note: You can also check on your browser whether nginx is working:
0