Apache2 on Ubuntu 12.04 — DirectoryIndex ignored

apache-2.2directoryindexubuntu-12.04

I have a relatively fresh installation of LAMP on Ubuntu 12.04 (installed using tasksel). I've got a virtual host pointed at a development project in my home directory containing plain Hello World index.html. Apache is showing the directory index instead of displaying the index.html. The PDF here(page 190) says that the default DirectoryIndex is in /etc/apache2/mods-available/dir.conf, which I've confirmed, and mod_dir is enabled.

DirectoryIndex works inside a .htaccess in the project root directory, but I'd like to have it set up server-wide. I'm probably missing something simple.

Best Answer

Don't mess with apache configuration files unless you know what you're doing.

If you want to edit the Apache2 default site edit /etc/apache2/sites-available/default add to the VirtualHost section the name(s) of the file you want apache to search, more info at http://httpd.apache.org/docs/2.0/mod/mod_dir.html ex:

    DirectoryIndex  lookforme-first.html lookforme-next.php

afterward reload apache with sudo service apache2 reload.

Related Topic