Directory index forbidden (Apache)

I'm trying to set up a site to serve up files and which should allow browsing and directory listings. I have several virtual hosts already successfully running, but none of them serve up files. With this new site, I can't seem to get past the 403 problem. Here's an example log:

[Sat Aug 03 15:38:51 2013] [error] [client 1.2.3.4] Directory index forbidden by Options directive: /var/www/html/example.com/www/

Apache version:

[root@talyn html]# /usr/sbin/httpd -v

Server version: Apache/2.2.3

Server built: Jun 26 2013 10:33:42

Permissions appear to be correct:

[root@talyn html]# ll /var/www/html/example.com/

drwxr-x–- 2 me apache 4096 Aug 3 14:02 www

Modules are loaded:

LoadModule autoindexmodule modules/modautoindex.so

LoadModule dirmodule modules/moddir.so

LoadModule aliasmodule modules/modalias.so

Here is the relevant portion of my httpd.conf:

DocumentRoot /var/www/html/example.com/www/

ServerName rpm.example.com

Options +Includes +Indexes

IndexOptions FancyIndexing VersionSort NameWidth=* HTMLTable

IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t

Alias /icons/ "/var/www/icons/"

-Indexes should not be overriding this anywhere. I know it is in welcome.conf, but I have commented out the entire contents.

If I place an index.html file in the web root it displays it, but not the directory. My understanding is that I should not need to have one in there, as mod_autoindex should generate the listing.

There are no .htaccess files in play. I don't use them at all.

What am I missing?

3 Replies

Just a guess, but shouldn't those permissions be drwxr-xr-w ?

Since the last trio of permissions is "everybody", and your web visitors fall into the "everybody" group, you'll want them to be able to access the files in that directory.

I'm not spotting a misconfiguration, but a few suggestions.

You did reload Apache after making changes to the configuration, right? Maybe look at the error log to see if it complains about your configuration at startup.

The error specifically complains about the Options directive, so check through all the included config files to see if -Indexes appears anywhere.

The below are longer shots given the error message, but other possible things to look at.

The permissions look fine (accesses to the filesystem will be as the user/group Apache is running as). Double-check that the user/group "apache" is the correct one - for example, in Debian and Ubuntu, the user and group are named "www-data" instead. If necessary, change group ownership of the /var/www/html/example.com/www/ directory.

Perhaps one of the settings is causing trouble? Try commenting out the IndexOptions and IndexIgnore directives, reload Apache, and see if you at least get a basic index display.

Thanks for the replies, everyone. It turns out that the reason this wasn't working was because my "Options Indexes" was in the section when it needed to be in the section.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct