以前一直用的配置环境,在Apache中配置一个虚拟域名很轻松的, 现在换成了WampServer 集成环境 Apache2的配置信息被分成了很多地方存放,具体的配法如下:
1.打开**\wamp\bin\apache\Apache2.2.17\conf\extra
2.找到 httpd-vhosts.conf 这个文件
3.按照它里面的demo修改虚拟目录的配置信息
<VirtualHost *:80>
ServerAdmin www.****.com
DocumentRoot "C:/****/项目中要指定的路径/"
ServerName www.****.com
ServerAlias www.****.com
</VirtualHost>
当然前提是已经配置了系统盘中的 .hosts 中的配置信息
4.重启 Apache 就 ok了
提示:
原来的
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1:80>
ServerName www.test.com
DocumentRoot "E:/test/"
<Directory "E:/test/">
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</virtualHost>
在集成环境中是不支持的。