KB ID 0001694
Problem
After an update, (WordPress – unrelated) yesterday, this website fell over! I rebooted the host, site was still down. I reluctantly restored to the previous evenings backup, and powered on the server. Alarmingly the site was still down!
I logged a call to my VPS provider, and attempted to troubleshoot the problem while I was waiting.
Very soon it was apparent my server appeared to be OK, but my web hosting platform (NGINX) was not running, and when I attempted to get it running this happened;
[box]
Aug 12 13:42:28 localhost nginx[2045]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) Aug 12 13:42:28 localhost nginx[2045]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use) Aug 12 13:42:29 localhost nginx[2045]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) Aug 12 13:42:29 localhost nginx[2045]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use) Aug 12 13:42:29 localhost nginx[2045]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) Aug 12 13:42:29 localhost nginx[2045]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use) Aug 12 13:42:30 localhost nginx[2045]: nginx: [emerg] still could not bind,() Aug 12 13:42:30 localhost systemd[1]: nginx.service: Control process exited, code=exited status=1 Aug 12 13:42:30 localhost systemd[1]: nginx.service: Failed with result 'exit-code'. Aug 12 13:42:30 localhost systemd[1]: Failed to start A high performance web server and a reverse proxy server.
[/box]
Solution
A Google search kept pointing me towards my config files for NGINX being improperly formatted for port 80, but a) NIGINX has been running fine since the server was built, and b) I update things regularly! But nevertheless I wasted an hour and half going down that road. THIS WAS A BLIND ALLEY, MY NGINX CONFIG FILES WERE FINE!
Other posts were, (more correctly) telling me something is using that port (TCP 80 or HTTP). So, to find out what;
[box]
sudo netstat -plant | grep 80
[/box]
BOOM! theres my problem Apache, what’s that doing running? I’m pretty sure I (stupidly) managed to install this a while ago, when updating my PHP to the latest version. I’m guessing that this had been a ticking time bomb and my WordPress update and reboot had caused it to explode! This would also explain why a restore didn’t fix the problem!
Lets stop and disable Apache;
[box]
sudo systemctl disable apache2 && sudo systemctl stop apache2
[/box]
And then (fingers crossed) start NGINX;
[box]
service nginx start sudo service nginx status
Site back up and running again (lesson learnt!)
Related Articles, References, Credits, or External Links
NA