Apache: You don't have permission to access the requested directory
Written by Guillermo Garron
Date: 2012-06-10 10:10:43 00:00
I usually get this error when creating a new virtual site on Apache:
"You don't have permission to access the requested directory"
That usually is because of Deny from all
or the no existence of the Allow from all
directive in the folder I'm working on.
Suppose you have this <VirtualHost>
configuration:
<VirtualHost *:80>
ServerAdmin me@myserver
DocumentRoot /srv/http/example/
ServerName www.example.com
ServerAlias example.com *.example.com
RewriteEngine On
RewriteOptions inherit
CustomLog /var/log/apache2/example.com.log combined
</VirtualHost>
You need to have something like this inside <VirtualHost>
tags.
<Directory /srv/http/example/>
Options +FollowSymLinks Indexes
AllowOverride All
order allow,deny
allow from all
</Directory>
So the whole configuration should see like this:
<VirtualHost *:80>
ServerAdmin me@myserver
DocumentRoot /srv/http/example/
ServerName www.example.com
ServerAlias example.com *.example.com
RewriteEngine On
RewriteOptions inherit
CustomLog /var/log/apache2/example.com.log combined
<Directory /srv/http/example/>
Options +FollowSymLinks Indexes
AllowOverride All
order allow,deny
allow from all
</Directory>
</VirtualHost>
Hope this helps you.