当我试图通过浏览器访问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>
null
如果您正在使用Apache 2.4
您必须检查“允许”和“拒绝”规则
查看http://httpd.apache.org/docs/2.4/upgrading.html#访问
在2.2中,基于客户端主机名、IP地址和客户端请求的其他特征的访问控制是使用指令Order、Allow、Deny和sampety完成的。
在2.4中,使用新模块mod_authz_host以与其他授权检查相同的方式完成这样的访问控制。
新指令要求:
2.2配置:
Order allow,deny
Allow from all
2.4配置:
Require all granted
此外,不要忘记在这些更改之后重新启动apache服务器(#service httpd restart
)
更新
如果上面的操作不起作用,那么也删除下面提到的行:
订单允许、拒绝