当把apache2.2的配置文件修改后在apache2.4中运行遇到了这个问题:[access_compat:error] [pid 6095] [client ::1:53090] AH01797: client denied by server configuration。
这个问题与2.2及2.4的版本在访问认证和授权方面又很大的修改。具体可以查看官方wiki: https://wiki.apache.org/httpd/ClientDeniedByServerConfiguration .
The 2.4 release introduced significant changes to the authorization and authentication process. Users of that release are encouraged to read this link to migrate their older config files.
复制一段相关配置,展示一下2.2和2.4的区别:
DocumentRoot /var/www/example.com
2.2:
<Directory /var/www/example.com>
Order deny,allow
Deny from all
</Directory>
2.4:
<Directory /var/www/example.com>
Require all denied
</Directory>
In the above examples, using the following configuration will resolve the issue:
2.2:
<Directory /var/www/example.com>
Order allow,deny
Allow from all
</Directory>
2.4:
<Directory /var/www/example.com>
Require all granted
</Directory>
An attempt to access a directory outside of the DocumentRoot defined by an alias without a corresponding directory block.
DocumentRoot /var/www/example.com
Alias /foo /var/www/foo
Solution (2.2):
<Directory /var/www/foo>
Order allow,deny
Allow from all
</Directory>
Solution (2.4):
<Directory /var/www/foo>
Require all granted
</Directory>