According to the Apache documentation, found here, the DirectoryIndex
directive needs to be specified in the site .conf
file (typically found in /etc/apache2/sites-available
on linux).
Quoting from the docs, it reads:
If no file from the DirectoryIndex
directive can be located in the
directory, then mod_autoindex can generate a listing of the directory
contents. This is turned on and off using the Options
directive. For
example, to turn on directory listings for a particular directory, you
can use:
<Directory /usr/local/apache2/htdocs/listme>
Options +Indexes
</Directory>
To prevent directory listings (for security purposes, for example),
you should remove the Indexes keyword from every Options directive in
your configuration file. Or to prevent them only for a single
directory, you can use:
<Directory /usr/local/apache2/htdocs/dontlistme>
Options -Indexes
</Directory>