服务器配置拒绝Apache错误客户端

时间:2020-01-09 10:40:51  来源:igfitidea点击:

问题描述:我在CentOS Linux上运行Apache 2 Web服务器并收到如下错误:

[Wed Sep 17 21:53:49 2008] [error] [client 122.1xx.y9.zzz] client denied by server configuration: /var/www/examples.com/

如何解决此错误?

解决方法:默认情况下,Apache被配置为限制性服务器。
它将不允许最终用户(客户端)对默认DocumentRoot进行任何操作。
要解决此问题,您需要在VirtualHost配置指令中添加以下行:

<Directory "/var/www/example.com">
    Options -Indexes FollowSymLinks
    AllowOverride AuthConfig FileInfo
    Order allow,deny
    Allow from all
</Directory>

从全部订购allow,deny和Allow将为目录设置适当的权限。
最后,它应如下所示:

<VirtualHost *:80>
	ServerAdmin [email protected]
        DocumentRoot "/var/www/example.com"
        ServerName example.com
        ServerAlias www.example.com
        ErrorLog "/var/logs/httpd/example.com/error.log"
        CustomLog "/var/logs/httpd/example.com/access.log" common
        ScriptAlias /cgi-bin/ "/var/suexec/example.com/cgi-bin/"
 
<Directory "/var/www/example.com">
	Options -Indexes FollowSymLinks
	AllowOverride AuthConfig FileInfo
	Order allow,deny
	Allow from all
</Directory>
 
  SuExecUserGroup user group
</VirtualHost>

重新启动Apache:

# service httpd restart