Apache 403 Error
There are two causes to 403 errors with virtual hosts.
1. First, every single parent path to the virtual document root must be Readable, Writable, and Executable by the web server httpd user. The access_log will show a 403 code, but the following message is returned to the browser with no "403" string printed:
Forbidden
You don't have permission to access /index.html on this server.
2. The second cause is actually a configuration problem -- the problem is forgetting to allow access in the httpd.conf. In this case the access_log will show a 403 error and Aapche2 will also sometimes send a "403" in the error string to the browser:
HTTP 403 / client denied by server configuration error
Forbidden
You don't have permission to access /index.html on this server.
A tail of the error_log gives a message like this for each access attempt:
[Tue Jul 25 17:58:17 2006] [error] [client 192.168.1.1] client denied by server configuration: /var/www/vhosts/prabhat/
The problem is that the extra/httpd-vhosts.conf is missing the directive to allow access to the directory.
Allow access by adding a <directory> section inside the <vhost> section.
<directory /vhost_document_root>
allow from all
<directory>
The following should give a better idea of how this should work:
<VirtualHost *>
ServerName prabhat.example.com
ServerAlias prabhat.example.com
DocumentRoot /var/www/vhosts/test
<directory /var/www/vhosts/test>
allow from all
</directory>
</VirtualHost>
1. First, every single parent path to the virtual document root must be Readable, Writable, and Executable by the web server httpd user. The access_log will show a 403 code, but the following message is returned to the browser with no "403" string printed:
Forbidden
You don't have permission to access /index.html on this server.
2. The second cause is actually a configuration problem -- the problem is forgetting to allow access in the httpd.conf. In this case the access_log will show a 403 error and Aapche2 will also sometimes send a "403" in the error string to the browser:
HTTP 403 / client denied by server configuration error
Forbidden
You don't have permission to access /index.html on this server.
A tail of the error_log gives a message like this for each access attempt:
[Tue Jul 25 17:58:17 2006] [error] [client 192.168.1.1] client denied by server configuration: /var/www/vhosts/prabhat/
The problem is that the extra/httpd-vhosts.conf is missing the directive to allow access to the directory.
Allow access by adding a <directory> section inside the <vhost> section.
<directory /vhost_document_root>
allow from all
<directory>
The following should give a better idea of how this should work:
<VirtualHost *>
ServerName prabhat.example.com
ServerAlias prabhat.example.com
DocumentRoot /var/www/vhosts/test
<directory /var/www/vhosts/test>
allow from all
</directory>
</VirtualHost>
Comments
Post a Comment