Reputation: 9817
I need to allow directory listing only for a particular directory: /var/www/test
. I followed the steps given here http://wiki.apache.org/httpd/DirectoryListings but I am doing something wrong because of which I get Forbidden 403 message if I browse http://localhost/test
. Following is what I have in my /etc/apache2/sites-available/test. Can you spot any error with this config?
<VirtualHost *:80>
DocumentRoot /var/www
<FilesMatch index.html>
deny from all
</FilesMatch>
<Directory /var/www/php/>
AllowOverride None
deny from all
</Directory>
<Directory /var/www/>
AllowOverride None
</Directory>
<Directory /var/www/test>
Options +Indexes
AllowOverride All
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
Upvotes: 1
Views: 11130
Reputation:
The Order
you're specifying for /var/www/test
is deny,allow
, so the Deny from all
on /var/www
is taking precedence over the Allow from all
for /var/www/test
. Switch that to allow,deny
and you'll get the behavior you're expecting.
I'd also strongly recommend that you remove the <FilesMatch index.html>
. It'll just cause you problems down the road. index.html
has nothing to do with automatic directory indexing; it's only involved when you've explicitly created such a file, so this directive will just keep normal index.html
files from ever working.
Upvotes: 1