当我试图通过浏览器访问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>


当前回答

使用Ubuntu时,检查是否启用了CGI模块。如果不是:

sudo a2enmod cgi

其他回答

获得问题的解决方案,需要在apache2.conf文件中进行更改,之后它将工作, /etc/apache2/apache2.conf中的旧代码

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

改为

 <Directory /var/www/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
    </Directory>

之后,为了让Apache理解重写规则,我们首先需要激活mod_rewrite。它已经安装了,但是在默认的Apache安装中禁用了它。使用a2enmod命令启用模块:

$ sudo a2enmod rewrite

这将激活模块或提醒您模块已启用。要使这些更改生效,请重新启动Apache。

$ sudo systemctl restart apache2

终于对我有用了。

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

Require all granted

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

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

我做了与ravisorg建议的OSX 10.10 Yosemite相同的更改,将Apache升级到2.4版本。下面是添加到http.conf中的更改。

<Directory />
    AllowOverride none
    Require all denied
</Directory>

<Directory /Volumes/Data/Data/USER/Sites/>
    AllowOverride none
    Require all granted
</Directory>

问题可能是指令不在<目录>下

https://httpd.apache.org/docs/2.4/mod/mod_authz_host.html#requiredirectives

该指令可以在< Directory>, < Files>,或< Location> section以及.htaccess文件中引用,以控制对服务器特定部分的访问。访问可以基于客户端主机名或IP地址进行控制。

再次检查DocumentRoot路径是否正确。这可能会导致此错误。