Hosting on Ubuntu Linux 20.04

Case Details

24th March 2022

Repair Failed Apache2 on Ubuntu Linux 20.04

During my deployment and re-deployment, I faced this issue two times and would like to document it for future reference to fix it. Problem was, that my hosted web app is up and running and suddenly my website shows this default page.

Repair-Apache2

1. Check the status of your Apache

sudo systemctl status apache2

It shows as Failed because TCP/80 binds twice. Bind to address [::]:80 and 0.0.0.0:80.

Repair-Apache2

You can find usage of the TCP/80 by this command as well

sudo netstat -an | grep 80

Repair-Apache2

One TCP/80 is used by Apache and another one is used by NGINX. Both can host applications.

2. Check the status of nginx

systemctl status nginx

It is actively running. That means, Apache is getting down and this one Nginx is up and running.

Repair-Apache2

3. Stop the nginx

We have to stop Nginx as we used Apache.

sudo systemctl stop nginx

4. Check the status of nginx

It is completely inactive now.

Repair-Apache2

5. Restart to apache

sudo service apache2 restart

6. Check the status of apache

sudo systemctl status apache2

Now it is up and running

Repair-Apache2

We can completely disable or uninstall Nginx to avoid such a failure in the future.

To Disable Nginx

sudo systemctl disable nginx

To uninstall Nginx

sudo apt purge nginx

Project Details
  • Technology: .Net 6.0
  • Database: MS SQL
  • Platform: Linux Ubuntu 20.04

Related Case Studies