当我试图通过浏览器访问localhost时,我得到这个错误。

AH01630: client denied by server configuration

我检查了我的网站文件夹权限使用:

sudo chmod 777 -R *

这是我的配置文件:

<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>


当前回答

如果您在windows操作系统的WampServer上使用Apache 2.4。

请在记事本中打开“http -vhosts.conf”文件。

C:\wamp64\bin\apache\apache2.4.37\conf\extra\https-vhosts.conf 

如果您无法找到以上文件。查看下面的截图

 <VirtualHost *:80>
     ServerName localhost
     DocumentRoot c:/wamp64/www
     <Directory  "c:/wamp64/www/">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

在上述代码中替换

Require local

with

Require all granted

然后保存。重启Apache服务后重试。

其他回答

对我来说,我实际上已经根据2.4标准更新了允许和拒绝规则。

Require all granted

然而,这仍然导致我收到相同的AH01630错误。我找到了另一个线程,它建议重新安装apache2。不知何故,这奏效了!如果有人愿意解释一下,我会很有帮助的。

信用:AH01630:客户端被服务器配置拒绝,但要求设置所有授予(Apache 2.4, CentOs)

对于Wamp 3 (Apache 2.4),除了像其他答案中描述的那样让服务器在线之外,在虚拟主机文件conf/extra/httpd-vhosts.conf中 你可能需要更换

Require local

with

Require all granted

如果在httpd.conf中有

Include conf/extra/httpd-vhosts.conf

这个“bug”实际上是Apache 2.4的新常态。在我的例子中,我有一个非常具体的规则,拒绝访问任何名称以“。”开头的文件夹或文件,因此我必须为需要这种奇怪名称的特定公用文件夹设置一个异常。

声明一下,我的重写规则是:

RewriteRule”(? ! \ .trusted)(^ | /) \”。- [F]

这条规则[F]删除了所有以“。”开头的东西,但是。trusted,多亏了正则表达式“?!”否定的魔力。

问题出在VirtualHost中,但可能不是

要求全部批准

确认您的配置是正确的,下面是正确的示例

我还有一个可能对某人有用的。 从PHP 5.6 => 7.0升级后收到相同的错误消息。我们已经更改了PHP上传设置,并且在复制后忘记更改。 尽管我当时没有上传图像,但Silverstripe(我们的CMS)拒绝保存并抛出错误。增加图像上传大小,它直接工作。