Q. I’m running Apache 2 Web sever under CentOS Linux and getting an error that read as follows:
[Wed Sep 17 21:53:49 2008] [error] [client 122.1xx.y9.zzz] client denied by server configuration: /var/www/examples.com/
How do I fix this error?
A. By default Apache is configured as restrictive server. It will not allow end users (client) to do anything on default DocumentRoot. To fix this issue you need to add following lines to your VirtualHost configuration directives:
<Directory "/var/www/example.com"> Options -Indexes FollowSymLinks AllowOverride AuthConfig FileInfo Order allow,deny Allow from all </Directory>
‘Order allow,deny’ and ‘Allow from all’ will set appropriate permission for the directory. At the end it should look like as follows:
<VirtualHost *:80> ServerAdmin firstname.lastname@example.org DocumentRoot "/var/www/example.com" ServerName example.com ServerAlias www.example.com ErrorLog "/var/logs/httpd/example.com/error.log" CustomLog "/var/logs/httpd/example.com/access.log" common ScriptAlias /cgi-bin/ "/var/suexec/example.com/cgi-bin/" <Directory "/var/www/example.com"> Options -Indexes FollowSymLinks AllowOverride AuthConfig FileInfo Order allow,deny Allow from all </Directory> SuExecUserGroup user group </VirtualHost>
# service httpd restart