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


当前回答

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

Require local

with

Require all granted

如果在httpd.conf中有

Include conf/extra/httpd-vhosts.conf

其他回答

实际上,我通过向:80条目添加目录访问来解决这个问题。

 <Directory "c:/whatever-directory-you-use/">
    AllowOverride All
    Require all granted
</Directory>

在所有人都对我“安全”之前,在我的特定情况下,这不是一个安全问题。

如果您正在使用远程资源,我建议确保您的CURL请求通过HTTPS / TLS传输,然后这个目录条目将在443端口上传输。

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

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

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

因为这个线程是在搜索提到的错误时弹出的第一件事,我想为这个错误添加另一个可能的原因:你可能有mod_evaving活动,客户端看到这个错误只是越过了mod_evaving .conf中配置的限制

如果您突然为一个以前没有任何问题且其他内容都没有更改的客户端得到这个错误,那么这是一个特别值得研究的原因。

(如果mod_evaded是原因,那么错误将自行消失,如果客户端只是暂时停止尝试访问站点;然而,这可能是一个迹象,你设置了太紧的限制)

这花了我一些摆弄,让这个工作在我自己的FreeBSD服务器运行..

FreeBSD 13 Apache 2.4 Python 3.8 LetsEncrypt

. .但最终我想出了一个可行的VirtualHost:

<VirtualHost *:443>

    ServerName mysite.mydomain.com
    DocumentRoot "/usr/local/www/apache24/data/mysite

    WSGIDaemonProcess mysite python-path=/usr/local/www/apache24/data/mysite/venv/lib/python3.8/site-packages/
    WSGIProcessGroup mysite
    WSGIScriptAlias / /usr/local/www/apache24/data/mysite/core/wsgi.py

    SSLEngine on
    SSLCertificateFile "/usr/local/etc/letsencrypt/live/mysite.mydomain.com/cert.pem"
    SSLCertificateKeyFile "/usr/local/etc/letsencrypt/live/mysite.mydomain.com/privkey.pem"
    SSLCertificateChainFile "/usr/local/etc/letsencrypt/live/mysite.mydomain.com/fullchain.pem"

    <FilesMatch "\.(cgi|shtml|phtml|php|py)$">
        SSLOptions +StdEnvVars
    </FilesMatch>

    BrowserMatch "MSIE [2-5]" \
        nokeepalive ssl-unclean-shutdown \
        downgrade-1.0 force-response-1.0

    CustomLog "/usr/local/www/apache24/data/mysite/log/py-ssl.log" \
        "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
    CustomLog "/usr/local/www/apache24/data/mysite/log/py-access.log" combined
    ErrorLog "/usr/local/www/apache24/data/mysite/log/py-error.log"

    <Directory "/usr/local/www/apache24/data/mysite">
        AllowOverride All
        Options +ExecCGI
        Require all granted
        Allow from all
    </Directory

</VirtualHost>

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

Require all granted

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

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