我在C:\ wamp中安装了wamp,我想在E:\ zf2中创建DocumentRoot文件夹作为虚拟域www.skeltonapplicaiton-zf2.local的虚拟主机。
在httpd.conf文件中未提交包含conf / extra / httpd-vhosts.conf的行。
httpd-vhosts.conf代码是
<VirtualHost *:80>
ServerName www.skeltonapplicaiton-zf2.local
ServerAlias skeltonapplicaiton-zf2.local
DocumentRoot "E:\zf2"
<directory "E:\zf2">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from all
</directory>
</VirtualHost>
在主机文件中添加其条目为
127.0.0.1 www.skeltonapplicaiton-zf2.local
127.0.0.1 skeltonapplicaiton-zf2.local
然后重新启动wamp服务器。
在浏览器中打开www.skeltonapplicaiton-zf2.local后,我收到错误
Forbidden
You don't have permission to access / on this server.
Apache错误日志
[Fri Aug 08 11:00:41.940054 2014] [authz_core:error] [pid 7256:tid 796] [client 127.0.0.1:59500] AH01630: client denied by server configuration: E:/zf2/
答案 0 :(得分:9)
您的所有设置都是正确的,但是apache 2.4(wamp 2.5使用apache 2.4)中有一些更改,这是指令Allow被删除,支持新指令Require。正确的配置将是虚拟主机
<VirtualHost *:80>
ServerName www.skeltonapplicaiton-zf2.local
ServerAlias skeltonapplicaiton-zf2.local
DocumentRoot "E:\zf2"
<directory "E:\zf2">
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</directory>
</VirtualHost>
所以,只需删除
Order Deny,Allow
Deny from all
Allow from all
并使用
Require all granted