Apache Error Client Denied By Server Configuration

When we get “client denied by server configuration” error first thing in our mind comes that how we fix the error? By default Apache will not allow end users to do anything on default DocumentRoot. To fix this issue you need to make some changes in the Apache Configuration file.
apache Client Denied

On Apache 2.4.3 Web Server under CentOS Linux a new security feature added that often results in error. If you will see the Apache log message then you will get an error “client denied by server configuration”. The feature is requiring an authorized user identity to access a directory.

# vim /etc/httpd/conf/httpd.conf

Default Configuration:

<Directory "/path/of/DocumentRoot">
    Options -Indexes FollowSymLinks
    AllowOverride AuthConfig
    Order deny, allow
    Deny from all
</Directory>

New Configuration:

<Directory "/path/of/DocumentRoot">
    Options -Indexes FollowSymLinks
    AllowOverride AuthConfig
    Order allow, deny
    Allow from all
</Directory>

If you are using multiple virtual host then add above line in your virtual host. At the end it should look like as follows:

<VirtualHost *:80>
    ServerAdmin dennis.r@techoism.com
    DocumentRoot /home/techoism/virtual-one
    ServerName virtual.techoism.com
    ErrorLog logs/virtual.techoism.com-error_log
    CustomLog logs/virtual.techoism.com-access_log common
<Directory "/home/techoism/public_html">
    Options -Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
</VirtualHost>

After all the changes first check your configuration using below command:

# httpd -t

Output:

Syntax OK
You have new mail in /var/spool/mail/root

Now restart the Apache Web Service to reflact the changes.

For CentOS/RHEL 7:
# systemctl restart httpd
For CentOS/RHEL 5/6:
# service httpd restart

See Also:

  • How to create Apache Virtual Host on Ubuntu
  • How To Set Up Apache Virtual Hosts on CentOS
  • Types of Virtual Web Hosting in Apache
  • How to Password Protect your Website using .htaccess
  • Enjoy it!

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

    The reCAPTCHA verification period has expired. Please reload the page.