Apache 2.4 Error AH01630: client denied by server configuration — Fix

Category: Linux How-To
Posted: August 22, 2019
Author: Antonio

Every time I set up a new server, something has been updated. This time Apache 2.4 replaced Apache 2.2, which used to be the default.

Apache HTTP server logo

The configuration changed a bit in version 2.4, so simply copying the “old configs” and virtual host files won’t be enough.

In Apache 2.4 you get the error AH01630: client denied by server configuration.


As usual, the fix is simple, but in a hurry you can spend a long time looking for it, so I’m writing it down :-)

Remove all “Order deny,allow” and “Order allow,deny” lines, and

replace “Deny from all” with “Require all denied”,
replace “Allow from all” with “Require all granted”.

Example of a working Apache 2.4 virtual host file:

<VirtualHost *:81>
    ServerName nemcd.com
    ServerAlias www.nemcd.com
    ServerAdmin [email protected]
    DocumentRoot /site/nemcd.com/www

<Directory /site/nemcd.com/www>
    Options -Indexes
    Require all granted
    Options FollowSymLinks
    AllowOverride All
</Directory>

    ErrorLog  ${APACHE_LOG_DIR}/nemcd.com-error.log
#    CustomLog ${APACHE_LOG_DIR}/nemcd.com-access.log combined
</VirtualHost>

Here AllowOverride All is set, so you need to enable the mod_rewrite module, because you often need .htaccess files. If you don’t need them, you can write AllowOverride None.

To make .htaccess files work, run:

a2enmod rewrite

Restart Apache after the changes (or stop and start it):

service apache2 reload

If you still see the error after the change, check that the Directory block of the right site contains Require all granted, and look at the log for the exact path being denied.

Related posts:

Leave a Comment

Copying content from this site is allowed only with a direct link to the source - https://nemcd.com