3

I have the following vhost configured:

<VirtualHost *:80>
    DocumentRoot /var/www/myvhost
    ServerName myv.host.com
    ServerAlias myv.host.com
    ErrorLog logs/myvhost-error_log
    CustomLog logs/myvhost-access_log combined
    ServerAdmin [email protected]
    <Directory /var/www/myvhost>
        AllowOverride All
        Options +Indexes
    </Directory>
</VirtualHost>

The configuration appears to be correct from the apachectl tool's perspective.

However, I cannot get a directory listing on that vhost:

Forbidden

You don't have permission to access / on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

The error log shows the following:

[Wed Mar 07 19:23:33 2012] [error] [client 66.6.145.214] Directory index forbidden by Options directive: /var/www/******

update2

More recently, the following is now kicking-into the error.log:

[Wed Mar 07 20:16:10 2012] [error] [client 192.152.243.233] Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /var/www/error/noindex.html

update3

Today, the following is getting kicked-out:

[Thu Mar 08 14:05:56 2012] [error] [client 66.6.145.214] Directory index forbidden by Options directive: /var/www/<mydir>
[Thu Mar 08 14:05:56 2012] [error] [client 66.6.145.214] Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /var/www/error/noindex.html
[Thu Mar 08 14:05:57 2012] [error] [client 66.6.145.214] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

This is after modifying the vhosts.conf file thusly:

<VirtualHost *:80>
    DocumentRoot /var/www/<mydir>
    ServerName myhost
    ServerAlias myhost
    ErrorLog logs/myhost-error_log
    CustomLog logs/myhost-access_log combined
    ServerAdmin admin@myhost
    <Directory "/var/www/<mydir>">
         Options All +Indexes +FollowSymLinks
         AllowOverride All
         Order allow,deny
         Allow from all
    </Directory>
</VirtualHost>

What is missing?

update 4

All subdirectories of the root directory do directory listings properly - it is only the root which cannot.

6
  • 5
    Anything interesting in your error log ? What does your browser display ?
    – user9517
    Mar 7, 2012 at 19:44
  • @Chris S - no mod_index listed in the httpd.conf - nor is there a mod_index on the filesystem
    – warren
    Mar 7, 2012 at 19:49
  • is there a local .htaccess file that might be setting -Indexes ?
    – voretaq7
    Mar 7, 2012 at 19:50
  • @voretaq7 - no .htaccess in this vhost
    – warren
    Mar 7, 2012 at 19:50
  • @warren Sorry, that should have been mod_autoindex, it's the module that creates directory listing pages.
    – Chris S
    Mar 7, 2012 at 19:52

4 Answers 4

8

A 403 means the resource is being found. Check that apache has at some level permission to r-x the document root and all the directories above it and r-- the files therein.

Try changing you Directory directive to

<Directory /var/www/myvhost>
    AllowOverride All
    Options +Indexes
    Order allow,deny 
    Allow from all
</Directory>
7
  • 1
    775 on the parent dir, and at least 644 on all contents
    – warren
    Mar 7, 2012 at 19:58
  • check it has suitable r-x perms on /var and /var/www too.
    – user9517
    Mar 7, 2012 at 20:01
  • all other vhosts on this server render properly - which makes this really annoying. Also, even with an 'index.htm' file added, still getting a 403 error
    – warren
    Mar 7, 2012 at 20:15
  • If the filesystem paths are ok then something else is blocking it try adding Order allow,deny Allow from all to your vhosts <Directory /var/www/myvhost> definition
    – user9517
    Mar 7, 2012 at 20:23
  • added - and still no dice ... fs perms look completely normal: vhost config looks like all others (except for the directory listing bit).
    – warren
    Mar 7, 2012 at 20:28
1

I had a similar problem today where I was seeing an error like yours shown above:

[Wed Oct 17 14:19:08 2012] [error] [client 123.66.66.22] Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /var/www/mysite/

Mixing options with and without +/- is problematic, note the apache docs on options:

Mixing Options with a + or - with those without is not valid syntax, and will be rejected during server startup by the syntax check with an abort.

Also the effect of validly using a directive without a +/- removes all other previously set directives for that directory.

I had used an Indexes without the + and had the error I copied above.

Since you say you are not using any .htaccess files, why not change the Directory directive to this:

<Directory /var/www/myvhost>
    AllowOverride None
    Options +Indexes
    Order allow,deny
    Allow from all
</Directory>
0

My solution (as of 21 Mar 2012)

  • move all content to a subdirectory
  • create a redirect index.html file in the root that reloads to the subdirectory

I still want to know why I cannot just traverse the directory itself, but this is working for now.

0

On my CentOS 5/6/7 systems this problem is caused by some kind of conflict in the default /etc/httpd/conf.d/welcome.conf that comes with the system. Commenting every line of welcome.conf out and restarting the webserver results in the directory index to be viewable in the webroot. It appears to simply be a bug in the default webserver configuration that ships out of the box at least on Red Hat/CentOS systems, but potentially others as well. Your system may have been experiencing a similar issue.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .