所以这是我的问题,我在Windows 8.1机器上运行wamp 2.2。
现在,安装后,localhost工作正常。 当我创建虚拟主机时,在设置httpd.conf文件后,如果我要创建例如:
<VirtualHost *:80>
DocumentRoot "c:/wamp/www/test/"
ServerName test.local
</VirtualHost>
这只是覆盖了我的localhost。首先,test.local不起作用,如果我使用localhost,它需要我c:/ wamp / www / test /
有人有解决方案吗?
PS:我正在为Windows正确设置我的主机文件(addind:127.0.0.1 test.local),我的80端口是免费的(没有关闭Skype和防病毒软件)。
编辑:我也尝试使用其他端口(8080),问题仍然存在。我在浏览器上收到的消息是:“Google Chrome无法找到该网站”
答案 0 :(得分:2)
如果您设置了虚拟主机并且仍想访问localhost webroot,则需要为localhost添加vhost 首先
主要主机消失
如果要将虚拟主机添加到现有Web服务器,则还必须为现有主机创建块。此虚拟主机中包含的ServerName和DocumentRoot应与全局ServerName和DocumentRoot相同。首先在配置文件中列出此虚拟主机,以便它将充当默认主机。
http://httpd.apache.org/docs/2.0/vhosts/name-based.html
示例(未经测试):
NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost
DocumentRoot C:\wamp/www
</VirtualHost>
<VirtualHost *:80>
ServerName otherdomain.local
DocumentRoot C:\wamp/www/otherdomain
</VirtualHost>
答案 1 :(得分:0)
试试这个:
<VirtualHost *:80>
DocumentRoot "c:/wamp/www/test"
ServerName test.local
ServerAlias test.local
<directory "c:/wamp/www/test">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Require local
</directory>
</VirtualHost>