Apache搭建创建完虚拟主机之后,搭建完成之后却报错,提示为:“apache AH01630: client denied by server configuration”,这个报错是因为apache2.4与apache2.2的虚拟主机配置写法不同所致,因为apache2.2的写法是:
[plain] view plain copy 在CODE上查看代码片派生到我的代码片
<VirtualHost *:80>
ServerName fdipzone.demo.com
DocumentRoot "/home/fdipzone/sites/www"
DirectoryIndex index.html index.php
<Directory "/home/fdipzone/sites/www">
Options -Indexes +FollowSymlinks
AllowOverride All
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
所以在2.4中使用以上写法就会有apache AH01630: client denied by server configuration错误。解决方法如下:
[plain] view plain copy 在CODE上查看代码片派生到我的代码片
Order deny,allow
Allow from all
Allow from host ip
修改为
[plain] view plain copy 在CODE上查看代码片派生到我的代码片
Require all granted
Require host ip
修改后的配置如下:
[plain] view plain copy 在CODE上查看代码片派生到我的代码片
<VirtualHost *:80>
ServerName fdipzone.demo.com
DocumentRoot "/home/fdipzone/sites/www"
DirectoryIndex index.html index.php
<Directory "/home/fdipzone/sites/www">
Options -Indexes +FollowSymlinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>