Apache Directory Index forbidden by rule on CentOS

On an old CentOS 4 system, I had problems getting a simple directory indexing working. The log files were showing only the message:

[Fri Mar 14 16:15:09 2014] [error] [client 192.168.x.y] Directory index forbidden by rule: /data/www/www.yourwebsite.com/

After a bit of fiddling around, it was clear my configuration was fine, and something else was going on. I turned to the Wisdom Of The Internet for a hint, and found this thread on linuxforums.com: apparently, if there’s no index file in the docroot, the directory indexing is forbidden by default. Indeed, testing with a subdirectory, the listing was working.

So, if you need to list your docroot too, edit /etc/httpd/conf.d/welcome.conf and comment out the whole locationmatch section:

#<LocationMatch "^/+$">
#    Options -Indexes
#    ErrorDocument 403 /error/nolisting.html

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.