Create vhost in wamp 2.5 in different directory on win7 returns forbidden error

。_饼干妹妹 提交于 2019-12-30 02:29:07

问题


I have installed wamp in C:\wamp and I want to make DocumentRoot folder in E:\zf2 as virtual host for a dummy domain www.skeltonapplicaiton-zf2.local.

Uncommitted the line Include conf/extra/httpd-vhosts.conf in httpd.conf file.

httpd-vhosts.conf code is

<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>

Added its entry in hosts file as

127.0.0.1 www.skeltonapplicaiton-zf2.local
127.0.0.1 skeltonapplicaiton-zf2.local

Then restarted the wamp server.

After opening www.skeltonapplicaiton-zf2.local in browser I am getting error

Forbidden

You don't have permission to access / on this server.

Apache Error log is

[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/

回答1:


Your all setting is correct, but there are some changes in apache 2.4 (wamp 2.5 uses apache 2.4) that is the directive Allow was dropped in favor of new directive Require . The correct configuration will be with virtual host is

<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>

So, Just Remove

 Order Deny,Allow
    Deny from all
    Allow from all

and use

Require all granted


来源:https://stackoverflow.com/questions/25196611/create-vhost-in-wamp-2-5-in-different-directory-on-win7-returns-forbidden-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!