Reset Root Password - Website went down (502 Bad Gateway)

March 19, 2018 592 views
Apache Firewall Logging Linux Basics Ubuntu 16.04

Hi!

I'm super new to managing my own VPN and stupidly changed my root password from the DigitalOcean "Access" panel without checking the possible ramifications. I'm now getting a "502 Bad Gateway" error on my website and can't quite work out what is causing it. I've Googled in the hope I can try and figure this out on my own, but I have to throw in the towel and ask for help...

I checked the service status list and it seems that Apache2 has not been started, but even after trying to start it, it stays "inactive".

Here are the last from the logs after trying to restart it:

Mar 19 07:57:29 lair-ubuntu systemd[1]: apache2.service: Unit cannot be reloaded because it is inactive.
Mar 19 07:57:42 lair-ubuntu systemd[1]: Starting LSB: Apache2 web server...
Mar 19 07:57:43 lair-ubuntu apache2[2403]: * Starting Apache httpd web server apache2
Mar 19 07:57:43 lair-ubuntu apache2[2403]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.
Mar 19 07:57:43 lair-ubuntu apache2[2403]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Mar 19 07:57:43 lair-ubuntu apache2[2403]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Mar 19 07:57:43 lair-ubuntu apache2[2403]: no listening sockets available, shutting down
Mar 19 07:57:43 lair-ubuntu apache2[2403]: AH00015: Unable to open logs
Mar 19 07:57:43 lair-ubuntu apache2[2403]: Action 'start' failed.
Mar 19 07:57:43 lair-ubuntu apache2[2403]: The Apache error log may have more information.
Mar 19 07:57:43 lair-ubuntu apache2[2403]: *
Mar 19 07:57:43 lair-ubuntu apache2[2420]: * Stopping Apache httpd web server apache2
Mar 19 07:57:43 lair-ubuntu apache2[2420]: *
Mar 19 07:57:43 lair-ubuntu systemd[1]: Started LSB: Apache2 web server.
Mar 19 07:57:45 lair-ubuntu systemd[1]: apache2.service: Unit cannot be reloaded because it is inactive.
Mar 19 07:57:47 lair-ubuntu systemd[1]: Starting LSB: Apache2 web server...
Mar 19 07:57:47 lair-ubuntu apache2[2438]: * Starting Apache httpd web server apache2
Mar 19 07:57:47 lair-ubuntu apache2[2438]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.
Mar 19 07:57:47 lair-ubuntu apache2[2438]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Mar 19 07:57:47 lair-ubuntu apache2[2438]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Mar 19 07:57:47 lair-ubuntu apache2[2438]: no listening sockets available, shutting down
Mar 19 07:57:47 lair-ubuntu apache2[2438]: AH00015: Unable to open logs
Mar 19 07:57:47 lair-ubuntu apache2[2438]: Action 'start' failed.
Mar 19 07:57:47 lair-ubuntu apache2[2438]: The Apache error log may have more information.
Mar 19 07:57:47 lair-ubuntu apache2[2438]: *
Mar 19 07:57:47 lair-ubuntu apache2[2455]: * Stopping Apache httpd web server apache2
Mar 19 07:57:47 lair-ubuntu apache2[2455]: *
Mar 19 07:57:47 lair-ubuntu systemd[1]: Started LSB: Apache2 web server.

Any help on this would be hugely appreciated!

🀜 πŸ’₯ πŸ€›

1 Answer

Resetting the root password reboots the Droplet. Apache is returning an Address already in use error so I'm guessing another service was started on boot and took over port 80 before Apache could have a chance to start.

What's the output of this command? It will list all processes that are listening on network ports:

sudo netstat -plutn

You can filter port 80 specifically like so:

sudo netstat -plutn | grep :80
Have another answer? Share your knowledge.