Apache: client denied by server configuration

前端 未结 9 1703
抹茶落季
抹茶落季 2020-11-27 10:42

I am getting

[Tue Apr 24 12:12:55 2012] [error] [client 127.0.0.1] client denied by server configuration: /labs/Projects/Nebula/bin/

相关标签:
9条回答
  • 2020-11-27 10:49

    Apache 2.4.3 (or maybe slightly earlier) added a new security feature that often results in this error. You would also see a log message of the form "client denied by server configuration". The feature is requiring an authorized user identity to access a directory. It is turned on by DEFAULT in the httpd.conf that ships with Apache. You can see the enabling of the feature with the directive

    Require all denied
    

    This basically says to deny access to all users. To fix this problem, either remove the denied directive (or much better) add the following directive to the directories you want to grant access to:

    Require all granted
    

    as in

    <Directory "your directory here">
       Order allow,deny
       Allow from all
       # New directive needed in Apache 2.4.3: 
       Require all granted
    </Directory>
    
    0 讨论(0)
  • 2020-11-27 10:52

    Can you try changing "Allow from 127.0.0 192.168.1 ::1 localhost" to "Allow from all". If that fixes your problem, you need to be less restrict about where content can be requested from

    0 讨论(0)
  • 2020-11-27 10:55

    OK I am using the wrong syntax, I should be using

    Allow from 127.0.0.1
    Allow from ::1
    ...
    
    0 讨论(0)
  • 2020-11-27 11:02

    In Apache 2.4 the old access authorisation syntax has been deprecated and replaced by a new system using Require.

    What you want then is something like the following:

    <Directory "/labs/Projects/Nebula/">
      Options All
      AllowOverride All
      <RequireAny>
        Require local
        Require ip 192.168.1
      </RequireAny>
    </Directory>
    

    This will allow connections that originate either from the local host or from ip addresses that start with "192.168.1".

    There is also a new module available that makes Apache 2.4 recognise the old syntax if you don't want to update your configuration right away:

    sudo a2enmod access_compat
    
    0 讨论(0)
  • 2020-11-27 11:02

    I had this issue using Vesta CP and for me, the trick was remove .htaccess and try to access to any file again.

    That resulted on regeneration of .htaccess file and then I was able to access to my files.

    0 讨论(0)
  • 2020-11-27 11:04

    In my case the key was:

    AllowOverride All
    

    in vhost definition. I hope it helps someone.

    0 讨论(0)
提交回复
热议问题