Apache2: 'Ah01630: Client Denied by Server Configuration'
I Get This Error When Trying to Access Localhost via a Browser. Ah01630: Client Denied by Server Configuration I Checked My Site Folder Permissions Using: Sudo...
I get this error when trying to access localhost via a browser.
AH01630: client denied by server configuration
I checked my site folder permissions using:
sudo chmod 777 -R *
Here is my configuration file:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /home/user-name/www/myproject
<Directory />
Options FollowSymLinks
AllowOverride all
Allow from all
</Directory>
<Location />
Allow from all
Order Deny,Allow
</Location>
<Directory /home/user-name/www/myproject/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride all
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride all
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
30 Answers
If you are using Apache 2.4
You have to check allow and deny rules
Check out
In 2.2, access control based on client hostname, IP address, and other characteristics of client requests was done using the directives Order, Allow, Deny, and Satisfy.
In 2.4, such access control is done in the same way as other authorization checks, using the new module mod_authz_host.
The new directive is Require:
2.2 configuration:
Order allow,deny
Allow from all
2.4 configuration:
Require all granted
Also don't forget to restart the apache server after these changes (# service httpd restart)
For all directories write Require all granted instead of Allow from all
Update
If the above doesn't work then also remove this below mentioned line:
Order allow,deny
Double check that the DocumentRoot path is correct. That can cause this error.
I made the same changes that ravisorg suggested to OSX 10.10 Yosemite that upgrades Apache to version 2.4. Below are the changes that were added to http.conf.
<Directory />
AllowOverride none
Require all denied
</Directory>
<Directory /Volumes/Data/Data/USER/Sites/>
AllowOverride none
Require all granted
</Directory>
The problem is in VirtualHost but probablely is not
Require all granted
Confirm your config is correct,here is correct sample
This drove me absolutely nuts for a day and a half but I found a solution if all other solutions have been tried unsuccessfully.
This is for macOS.
- Go to activity Monitor (spotlight search for: activity)
- In activity monitor search for httpd which is the Apache service
- Select the one that belongs to root and click X on the top left to close it.
At that point I immediately stopped getting 403 errors and everything started working as expected. Weird thing is i didn't even have to restart apache it just worked, i guess it restarted itself when i went to my localhost, I honestly don't know but I guess the problem is Apache not actually restarting when using apachectl restart, or stop or start. Hope this helps someone.
For me, all proposed solutions won't worked. This can help, if you use cgi, fastcig or fpm as proxy you have to add a location in your vhost to avoid this problem. This allows 404 to be passthrough proxy.
<Location />
require all granted
</Location>
I got resolved my self after spending couple of hours.
I installed Apache/2.4.7 (Ubuntu) through coookbook in vagrant vm.
/etc/apache2/apache2.conf file does not have <VirtualHost *:80> element by default.
I did two changes to get it done
- added
<VirtualHost *:80> - added
Options Indexes FollowSymLinks
AllowOverride all
Allow from all
then finally I just booted vm..
Has anyone thought about that wamp server default not include the httpd-vhosts.conf file.
My approach is to remove the note below
conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
in httpd.conf file.
That is all.
in my case,
i'm using macOS Mojave (Apache/2.4.34). There was an issue in virtual host settings at /etc/apache2/extra/httpd-vhosts.conf file. after adding the required directory tag my problem was gone.
Require all granted
Hope the full virtual host setup structure will save you.
<VirtualHost *:80>
DocumentRoot "/Users/vagabond/Sites/MainProjectFolderName/public/"
ServerName project.loc
<Directory /Users/vagabond/Sites/MainProjectFolderName/public/>
Require all granted
</Directory>
ErrorLog "/Users/vagabond/Sites/logs/MainProjectFolderName.loc-error_log"
CustomLog "/Users/vagabond/Sites/logs/MainProjectFolderName.loc-access_log" common
</VirtualHost>
all you've to do replace the MainProjectFolderName with your exact ProjectFolderName.
If you tail the error log and reload the page, you should see some more information as to the exact problem.
Grab the environment variables so ${APACHE_LOG_DIR} will actually work...
source /etc/apache2/envvars
Then tail and watch...
tail -f ${APACHE_LOG_DIR}/error.log
If you are using Apache 2.4 in WampServer on windows OS.
You need to open https-vhosts.conf file in notepad.
C:\wamp64\bin\apache\apache2.4.37\conf\extra\https-vhosts.conf
If you unable to find above file. check screenshot below
<VirtualHost *:80>
ServerName localhost
DocumentRoot c:/wamp64/www
<Directory "c:/wamp64/www/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
In above code Replace
Require local
with
Require all granted
And save it. Restart Apache service and try again.
For me, I had actually updated the Allow and Deny rules based on the 2.4 standard.
Require all granted
However, this was still causing me to receive the same AH01630 error. I found another thread and it suggested reinstalling apache2. Somehow this worked! If anyone cares to explain why, that would be helpful.
Credit to: AH01630: client denied by server configuration but require all granted is set (Apache 2.4, CentOs)
...
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
...
This was driving me crazy. Finally figured out what the problem was: I was using direct paths for the error log and they were wrong.
Why does Apache give a vague (and wrong) error message? Instead use a correct and useful error message like: Path for ErrorLog directive "/wrong/path/and/filename.log" is invalid.
Anyway, to fix make sure your error log directives look something like this:
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
When using Ubuntu check whether the CGI module is enabled. If not:
sudo a2enmod cgi
Ensure that any user-specific configs are included!
If none of the other answers on this page for you work, here's what I ran into after hours of floundering around.
I used user-specific configurations, with Sites specified as my UserDir in /private/etc/apache2/extra/httpd-userdir.conf. However, I was forbidden access to the endpoint .
I could see in /var/log/apache2/error_log that access to /Users/jwork/Sites/ was being blocked. However, I was permitted to access the DocumentRoot, via . This suggested that I didn't have rights to view the ~jwork user. But as far as I could tell by ps aux | egrep '(apache|httpd)' and lsof -i :80, Apache was running for the jwork user, so something was clearly not write with my user configuration.
Given a user named jwork, here was my config file:
Must Read
/private/etc/apache2/users/jwork.conf
<Directory "/Users/jwork/Sites/">
Require all granted
</Directory>
This config is perfectly valid. However, I found that my user config wasn't being included: