Apache 2.2 升级到 2.4 的 Conf 修整

admin 发布于:2014-11-19 9:31 分类:Linux  有 4145 人浏览,获得评论 0 条 标签: apache hosts 

[Wed Nov 19 09:27:39.414078 2014] [authz_core:error] [pid 2000:tid 872] [client 127.0.0.1:51495] AH01630: client denied by server configuration: 错误路径

发生错误: Forbidden 403


解决方案:


<Directory /var/>
Require all granted
</Directory>


原因: Apache 2.2 VS Apache 2.4 设定差异


Deny All

2.2 configuration:

Order deny,allow

Deny from all

2.4 configuration:

Require all denied

Allow All

2.2 configuration:

Order allow,deny

Allow from all

2.4 configuration:

Require all granted

Allow Host

2.2 configuration:

Order Deny,Allow

Deny from all

Allow from xxx.org

2.4 configuration:

Require host xxx.org



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

FilesMatch 维持用 Order
<FilesMatch ".+\.phps$">
SetHandler application/x-httpd-php-source
Order Deny,Allow
Allow from all
</FilesMatch>