menu

Questions & Answers

client denied by server configuration

I try to setup kohana 3 project as virtual host.

Config:

<VirtualHost *:80>
  DocumentRoot "D:/Devel/matysart/matysart_dev1"
  ServerName matysart-one.local
  ServerAlias www.matysart-one.local
  DirectoryIndex index.php
</VirtualHost>

Error (403):

[client 127.0.0.1] client denied by server configuration: D:/Devel/matysart/matysart_dev1/

Could somebody help?

Comments:
2023-01-20 00:10:03
This error will only occur if: the client address matches 127.0.0.0/8 or the client address is ::1 or both the client and the server address of the connection are the same. This is a new feature that was added to Apache 2.4. In short if you are testing this on your local host make sure this flag "Require local" is set. It is not however needed for your production server
2023-01-20 00:10:03
Answers(7) :

The error "client denied by server configuration" generally means that somewhere in your configuration are Allow from and Deny from directives that are preventing access. Read the mod_authz_host documentation for more details.

You should be able to solve this in your VirtualHost by adding something like:

<Location />
  Allow from all
  Order Deny,Allow
</Location>

Or alternatively with a Directory directive:

<Directory "D:/Devel/matysart/matysart_dev1">
  Allow from all
  Order Deny,Allow
</Directory>

Some investigation of your Apache configuration files will probably turn up default restrictions on the default DocumentRoot.

Comments:
2023-01-20 00:10:03
For me the following worked which is copied from example in /etc/apache2/apache2.conf: ` <Directory /srv/www/default> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> `
2023-01-20 00:10:03
For me it was Require all granted that got it.

In my case, I modified directory tag.

From

<Directory "D:/Devel/matysart/matysart_dev1">
  Allow from all
  Order Deny,Allow
</Directory>

To

<Directory "D:/Devel/matysart/matysart_dev1">
  Require local
</Directory>

And it seriously worked. It's seems changed with Apache 2.4.2.

Comments:
2023-01-20 00:10:03
Thank you. I did a small upgrade to my dev server and my projects went down. "Require local" did miracles for me :)
2023-01-20 00:10:03
Cheers! after an hour of playing with Deny,Allow Require local is a life saver.
2023-01-20 00:10:03
where did you find that tag? did you need to add it to a file?
2023-01-20 00:10:03
It's not a bug. It's a feature. I found somewhere from there httpd.apache.org/docs
2023-01-20 00:10:03
Thanks a lot , I will vote up every time you comment here!! :D
2023-01-20 00:10:04
Just built a new machine with the latest copy of xampp. All the virtual hosts stopped working. Require local fixed it.
2023-01-20 00:10:04
This got me too using 2.4, Require local fixed it... guess RTM?
2023-01-20 00:10:04
I had a better experience with "Require all granted".
2023-01-20 00:10:04
It is a required step when upgrading to Apache 2.4. See httpd.apache.org/docs/2.4/upgrading.html#run-time
2023-01-20 00:10:04
Thank you! You saved me from an hour of searching

For me the following worked which is copied from example in /etc/apache2/apache2.conf:

<Directory /srv/www/default>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

Require all granted option is the solution for the first problem example in wiki.apache.org page dedicated for this issue for Apache version 2.4+.

More details about Require option can be found on official apache page for mod_authz module and on this page too. Namely:

Require all granted -> Access is allowed unconditionally.

Comments:
2023-01-20 00:10:04
This worked on my local installation /home/userx/Development/site

This has happened to me several times migrating from Apache 2.2.

What I have found is that there is an Order,Deny that I missed with VIM's Search feature somehow that is the default main Vhost, line 379. Hope this helps someone. I commented out the Order Deny,Allow and Deny from All and it worked!

this worked for me..

<Location />
 Allow from all
 Order Deny,Allow
</Location>

I have included this code in my /etc/apache2/apache2.conf

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.

I have servers with proper lists of hosts and IPs. None of that allow all stuff. My fix was to put the hostname of my new workstation into the list. So the advise is:

Make sure the computer you're using is ACTUALLY on the list of allowed IPs. Look at IPs from logmessages, resolve names, check ifconfig / ipconfig etc.

*Google sent me due to the error-message.