Linux Blog

Apache “Directory index forbidden by Options directive:”

Filed under: Quick Linux Tutorials — at 9:29 pm on Friday, June 27, 2008

This is a common problem with the Apache web server. It is considered a security risk to show the directory contents by default. Especially those in the root directory. The way to fix this is pretty simple, you first need to make sure that there are no -Index directives in any of the configuration files. In your httpd configuration directory grep with a line number for Options like so:

grep -n Options *

If you don’t see any -Indexes then its possible there are included files. Check these directories if you know them, if you don’t grep your configuration file for the Includes:

grep -n Include *

If you’re still getting the test page or a permission denied error after removing the directive that disables Indexes then it may be a permissions issue. Apache needs +x access for all users to enable directory listings. Change the permissions and it should work.

On Fedora there is a file called welcome.conf in the conf.d directory. This can be removed and if you have Options All set, then you should be good to go. On other distributions like Slackware it is easier to accomplish. I wouldn’t recommend allowing any sort of directory listing in a production environment but in my development case, where I only allow access to my test server on a per host basis this is not a big problem.

Also, remember to restart the server after making changes.

Hope this helps, if it doesn’t be sure to drop a comment!


Comment by rajesh

November 14, 2008 @ 12:50 pm

Hi ,
All that you said , plus the inclusion of ‘Options All’ solved my problem

Comment by wat4dog

August 27, 2009 @ 9:45 am

Options +Indexes solve this problem (for directory, on which this problem appears)

Comment by sambola

January 4, 2010 @ 9:50 am

my is not working.

I am build a Proxy server with mysar to view logs.
But apache is give me “[Mon Jan 04 13:44:58 2010] [error] [client] Directory index forbidden by Options directive: /usr/local/mysar/www/”

Dont know that to do.

Comment by Vince Samios

January 21, 2011 @ 9:44 am

We are trying to install RoR on CentOS (Ruby 1.8.7 Rails 3.0.3 Gems 1.4.2 MongoDB 1.6.5)

Nothing we do is able to solve this problem without also taking down all the other websites on the server.

Any suggestions?

Comment by

January 21, 2011 @ 9:49 am

You could try setting it to a vhost and setting the configuration options that way. It should not interfere with other sites on the server. It will require an apache restart.

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>