WAMP上的虚拟主机在192.168.1.6上导致403禁止...其他别名仍然有效

时间:2016-10-03 06:38:43

标签: apache wampserver

最近修改了httpd.conf和httpd-vhosts.conf以添加vhosts ...

    #IncludeOptional "E:/wamp/vhosts/*"
Include "E:/wamp/alias/*"

NameVirtualHost *:80
<VirtualHost *:80>
    DocumentRoot "e:/wamp/www"
    ServerName localhost
    ServerAlias localhost
    <Directory  "e:/wamp/www">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require local
        Require ip 192.168.1
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot E:/activeWork/projects
    ServerName projects.local
        <Directory  "E:/activeWork/projects">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require local
    </Directory>

</VirtualHost>
<VirtualHost *:80>
    DocumentRoot E:/activeWork/projects
    ServerName www.projects.local
        <Directory  "E:/activeWork/projects">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot E:/activeWork/projects
    ServerName api.projects.local
        <Directory  "E:/activeWork/projects">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

之后当我尝试加载192.168.1.6或127.0.0.1时,给我:

Forbidden

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

我试图解决它this answer,但不适合我

并通过recommandation在答案中检查我的access.log,这就是结果:

192.168.1.6 - - [03/Oct/2016:11:03:00 +0330] "GET / HTTP/1.1" 403 288
127.0.0.1 - - [03/Oct/2016:11:00:55 +0330] "GET / HTTP/1.1" 403 286

3 个答案:

答案 0 :(得分:0)

如果你确定你的wamp安装路径在E里面: 那么我建议你查看访问日志和错误日志以收集更多信息。

答案 1 :(得分:0)

我假设您在Wampserver上使用Apache 2.4或更高版本?如果是,则用&#34;要求全部授予&#34;替换require规则。在你的虚拟主机中,像这样:

<VirtualHost *:80>
    DocumentRoot "e:/wamp/www"
    ServerName localhost
    ServerAlias localhost
    <Directory  "e:/wamp/www">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

如果仍然无效,请检查您的防火墙是否阻止了您的访问。

答案 2 :(得分:0)

我的问题是定义3个vhost指向同一个目录,这个混淆apache ...最后tnx到riggsfolly我修复了......除此之外我从这个guide to define VHost做了更改以正确的方式设置事物

相关问题