apache2.4 AH01630: client denied by server configuration错误

apache 2.4.x与2.2.x版本很多配置信息的写法不同,如果2.4.x版本按2.2.x版本的写法书写,则会出现标题中的错误;

apache-2.2.x配置虚拟机的大致写法如下:

NameVirtualHost 192.168.10.81:80

ServerAdmin [email protected]
directoryIndex  index.html index.php index.htm index.shtml login.php
ServerName 192.168.10.81
DocumentRoot /var/www/vhosts/wwwroot

    Options -Indexes
    AllowOverride All
    Order allow,deny
    Allow from all


apache-2.4.x配置虚拟机的大致写法如下:


ServerAdmin [email protected]
directoryIndex  index.html index.php index.htm index.shtml login.php
ServerName 192.168.10.81
DocumentRoot /var/www/vhosts/wwwroot

    Options -Indexes
    AllowOverride All
    Require all granted


可以看到apache-2.4.x把NameVirtualHost给取消,现在配置虚拟主机不需要再配置NameVirtualHost了.
删除了 Order deny,allow 和 Order allow,deny
把 Deny from all 替换成了 Require all denied
把Allow from all 替换成了 Require all granted
然后还把 Allow from 192.168.10.21 这样的语句给替换成了 Require host 192.168.10.21

转自:http://www.111cn.net/phper/apache/60401.htm


你可能感兴趣的:(apache)