63

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?

Codium
  • 3,200
  • 6
  • 34
  • 60
  • 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 – John Crawford Aug 31 '13 at 23:18
  • possible duplicate of [Apache2: 'AH01630: client denied by server configuration'](http://stackoverflow.com/questions/18392741/apache2-ah01630-client-denied-by-server-configuration) – Denilson Sá Maia Feb 26 '14 at 19:13

6 Answers6

108

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.

Umair A.
  • 6,690
  • 20
  • 83
  • 130
37

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.

Robert Lujo
  • 15,383
  • 5
  • 56
  • 73
Daniel Sokolowski
  • 11,982
  • 4
  • 69
  • 55
21

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.

larsks
  • 277,717
  • 41
  • 399
  • 399
6

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.

sh6210
  • 4,190
  • 1
  • 37
  • 27
1

this worked for me..

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

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

santosh
  • 51
  • 1
  • 7
-1

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.

Chris
  • 5,788
  • 4
  • 29
  • 40