Admin-Ahead Community

Linux => General Linux => Topic started by: joseletk on June 09, 2018, 07:13:31 pm

Title: Apache Error Client Denied By Server Configuration
Post by: joseletk on June 09, 2018, 07:13:31 pm
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:

Code: [Select]
<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:

Code: [Select]
<VirtualHost *:80>
ServerAdmin webmaster@example.com
        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>

Restart apache:

# service httpd restart
==========================================================================