Why am I getting the Apache2 Ubuntu Default Page instead of my own index.html page?
Emily Wong
I have an Ubuntu 14.10 computer that is used for local website testing, it is not serving to the internet. On it, I have seven websites set up. However, when I access two of the seven, I get the Apache2 Ubuntu Default Page instead of my own index page.
As far as I can tell, I set up all seven using the exact same process, so I don't know what these two are missing. Also, in my Apache logs directory, I have two log files, error and access for each of the two misbehaving sites, but all of them are empty. When I restart the apache2 service, there are no errors. I have retraced my steps multiple times and I can not see any difference between the working sites and the non working sites.
What options do I have for diagnosing this problem? Can I force more verbose error logs somehow? Is there another log somewhere that I can reference?
Here is an example of a .conf file for one of the malfunctioning sites:
<VirtualHost *:80> ServerName ServerAlias local_example.com ServerAdmin DocumentRoot /var/www/Websites/example.com <Directory /var/www/Websites/ Options Indexes FollowSymLinks MultiViews # pcw AllowOverride None AllowOverride All Order allow,deny allow from all # This directive allows us to have apache2's default start page # in /apache2-default/, but still have / go to the right place # Commented out for Ubuntu #RedirectMatch ^/$ /apache2-default/ </Directory> ErrorLog /home/example/Apache_Logs/local_example.com_error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /home/example/Apache_Logs/local_example.com_access.log combined ServerSignature On
</VirtualHost> 4 5 Answers
For me, one of the suggestions from @Dan solved it.
sudo a2dissite 000-default.conf
service apache2 reloadApparently the default site configuration was overriding my vhost configuration.
1Try the following
Enable verbose logs
sudo nano /etc/apache2/apache2.confLocate 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 debugRestart Apache
sudo service apache2 restartApache includes a nice little syntax checking tool
apache2ctl -tChecking Virtual Host Definitions
apache2ctl -S 2 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
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.
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.
1