Why am I getting the Apache2 Ubuntu Default Page instead of my own index.html page?

Solution 1:

For me, one of the suggestions from @Dan solved it.

sudo a2dissite 000-default.conf
service apache2 reload

Apparently the default site configuration was overriding my vhost configuration.

Solution 2:

Try the following

Enable verbose logs

sudo nano /etc/apache2/apache2.conf

Locate the LogLevel variable, and update it from the default warn to info or debug. debug will produce the greatest amount of output.

# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
# 
LogLevel debug

Restart Apache

sudo service apache2 restart

Apache includes a nice little syntax checking tool

apache2ctl -t

Checking Virtual Host Definitions

apache2ctl -S

Solution 3:

after installation index.html has higher priority that's why you still seeing default Ubuntu page check this folder var/www/html/ rename or remove this page simple as that

Solution 4:

Turns out the problem was permissions.

When you're storing the web site in a directory outside of /var/www and connected by symlink, then the source directory, and its parent directory have to have permissions of 755.

For some unknown reason, the two misbehaving sites had different permissions, and running chmod -R 755 on the web site directory, and its parent directory, solved the problem.

Solution 5:

I battled with the same issue.

I even deleted /var/www/html, did sudo a2dissite 000-default and deleted /etc/apache2/sites-available/000-default.conf and even then, the issue persisted.

In the end I figured out that the index.html was persisted due to some hardcoding in the c++ code.

The built in default DirectoryIndex is in /mods-available/dir.conf and goes like this:

DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm

My project had no index.html just an index.php

The solution was to add a DirectoryIndex to my vhost .conf in /etc/apache2/sites-available/ like this:

<Directory "/var/www/mysite">
   RewriteEngine On
   AllowOverride All
   Options Indexes FollowSymLinks MultiViews
   Require all granted
        
   #extra config to disable default index.html
   DirectoryIndex disabled
   DirectoryIndex index.php
</Directory>

This solved the issue completely for me.