![](/img/trans.png)
[英]Virtual Hosts on WAMP causing 403 forbidden on localhost… other aliases still work
[英]Virtual Hosts on WAMP causing 403 forbidden on 192.168.1.6… other aliases still work
最近修改了httpd.conf和httpd-vhosts.conf以添加虚拟主机...
#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.
我试图解决这个问题,但对我不起作用
和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
如果您确定wamp的安装路径在E:内,则建议您检查访问日志和错误日志以收集更多信息。
我假设您在Wampserver上使用Apache 2.4或更高版本? 如果是这样,则在您的虚拟主机中将require规则替换为“ Require all allowed”,如下所示:
<VirtualHost *:80>
DocumentRoot "e:/wamp/www"
ServerName localhost
ServerAlias localhost
<Directory "e:/wamp/www">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
如果仍然无法使用,请检查您的防火墙是否阻止了您的访问。
我的问题是定义3个vhost指向同一目录,并且这个混淆的apache ...最终tnx到riggsfolly我修复了...除了此,我对本指南进行了更改以定义VHost以正确的方式进行设置
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.