0

I have the following virtual host in my Apache configuration:

<VirtualHost *:80>
    ServerName foobarspaz
    DocumentRoot "/path/to/document/root"
</VirtualHost>

There is no index.html file in the document root directory so accessing http://foobarspaz serves up the default Apache test page for my server.

I'd like it instead to serve up a mod_autoindex generated directory listing of the document root instead of the default page. How would I go about this? (I'm not exactly sure how to go about 'undoing' the default page behaviour for the server root.)

  • Is this on centos? Then you may want to remove /etc/httpd/conf.d/welcome.conf – becomingwisest Jan 26 '11 at 5:11
  • Yeah, after having a look in that file that indeed would do the trick. I'm looking to solve it next to my existing configuration as it's one less step to do if the server ever needs to be rebuilt. – Simon Lieschke Jan 26 '11 at 6:19
2

Markus' suggestion didn't work, but after having a look at the /etc/httpd/conf.d/welcome.conf file that Christopher pointed out in his comment I tried the following inside my VirtualHost directive which had the desired outcome:

<LocationMatch "^/+$">
    Options Indexes
</LocationMatch>
0

Maybe something like this might work:

<Directory /path/to/document/root>
   Options Indexes
</Directory>

And yes, as the other poster pointed out, remove the welcome.conf (in Ubuntu) or similar default config.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.