apache升级到2.4后,站点配置文件需要变化,否则会出现403 Forbidden错误:
Forbidden
You don't have permission to access / on this server.
下述是 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 example.org
2.4 configuration:
Require host example.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>