遇到了这样的问题,装好了wamp2.5 ,配置站点时,发现配好的shop111.com可以访问,而localhost不能,加了下面这个就可以了
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "E:/wamp/www"
ServerName localhost
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
在下面也有讲到。
下面是所有的配置:
httpd.conf 文件(在 E:\wamp\bin\apache\apache2.4.9\conf 我装在了E盘)
打开(即去掉前面的“#”)
Include conf/extra/httpd-vhosts.conf
打开
LoadModule php5_module"E:/wamp/bin/php/php5.5.12/php5apache2_4.dll"
打开
PHPIniDir E:/wamp/bin/php/php5.5.12
httpd-vhosts.conf文件 (E:\wamp\bin\apache\apache2.4.9\conf\extra)
加入下面两部分
这是为了让localhost正常显示:
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "E:/wamp/www"
ServerName localhost
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
这是为了让shop111.com正常显示:
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "E:/wamp/www/yii1/shop"
ServerName shop111.com
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
ps: 这两行是主要的
DocumentRoot "E:/wamp/www/yii1/shop" (这是想访问的那个文件夹目录)
ServerName shop111.com (这是网址)
其余的没有改...
hosts文件(位置:C:\Windows\System32\drivers\etc)
加入:
127.0.0.1 shop111.com