Question

I have Apache2 actively running, apache2.service is enabled, curl -4 icanhazip.com returns IP doesn't show apache2 default page, why?

Apache2 is successfully installed with the following:

 apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor >    
      Active: active (running) since Tue 2023-05-09 17:11:23 UTC; 7h ago

firewall all set properly

sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW       Anywhere
80/tcp                     ALLOW       Anywhere
443                        ALLOW       Anywhere
443/tcp                    ALLOW       Anywhere
22/tcp (v6)                ALLOW       Anywhere (v6)
80/tcp (v6)                ALLOW       Anywhere (v6)
443 (v6)                   ALLOW       Anywhere (v6)
443/tcp (v6)               ALLOW       Anywhere (v6)

However when I type http://(IP address) just don’t display the default Apache2 landing page, instead it shows Nothing here yet :/ [Read Docs]


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

alexdo
Site Moderator
Site Moderator badge
May 12, 2023

Heya,

You can make sure that the DocumentRoot in the configuration file is pointing to the correct directory (usually /var/www/html) and that the default index.html file is present in that directory.

You can restart the Apache2 service by running:

  1. sudo systemctl restart apache2

If you still encounter issues, check the Apache error log at /var/log/apache2/error.log for any errors.

Hope that this helps!

I have checked sudo netstat -tuln | grep :80 no other process is using port 80

have tried restart apache2 sudo systemctl restart apache2 however, it is still not displaying the default Apache home page.

Then I gave a try to uninstall complete removal of apache2 and reinstall it as fresh.

Surprisingly, it works this time, not able to know the cause, though.

KFSys
Site Moderator
Site Moderator badge
May 11, 2023

Hey @8374a2e23a1b41f68cd667622f7d59,

Do you have a default configuration file created or another websirvice configured?

Check if another web server or application is running:

It’s possible that another web server like Nginx or a different application is running on port 80. To check the processes listening on port 80, run:

  1. sudo netstat -tuln | grep :80

If you see another process listening on port 80, stop that process and try accessing your Apache server again.

Check your Apache configuration:

Make sure your Apache configuration is set up to serve the default landing page. The configuration file for the default site should be located at /etc/apache2/sites-available/000-default.conf. Check the content of this file:

  1. cat /etc/apache2/sites-available/000-default.conf

Make sure the DocumentRoot directive is pointing to the correct directory containing the default Apache2 landing page. Typically, this should be /var/www/html:

  1. DocumentRoot /var/www/html

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel