Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.)

share|improve this question
    
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 Answers 2

up vote 1 down vote accepted

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>
share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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