Create vhost in wamp 2.5 in different directory on

2020-02-26 02:12发布

问题:

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