# Virtual hosts #Include conf/extra/httpd-vhosts.conf把“#Include conf/extra/httpd-vhosts.conf”的#祛除,作用是开启vhost
2、打开wamp\bin\apache\Apache2.2.21\conf\extra\httpd-vhosts.conf,找到如下代码:
<VirtualHost *:80> ServerAdmin webmaster@dummy-host2.appservnetwork.com DocumentRoot "D:/wamp/www" ServerName localhost </VirtualHost>这里的“*:80”是端口号,“D:/wamp/www”是vhost的路径,“localhost”是域名,这是默认的host主机,可以复制上面的代码,紧接着后面粘贴,修改下参数即可。如:
<VirtualHost *:80> ServerAdmin webmaster@dummy-host2.appservnetwork.com DocumentRoot D:/hongfeng ServerName www.hongfeng.com </VirtualHost>
3、如果更改了端口号,请打开Apache 的 httpd.conf文件(wamp\bin\apache\apache2.2.8\conf),找到如下的代码:
#Listen 12.34.56.78:80 Listen 80在后面追加端口号,如:
Listen 8888
4、进入C:\Windows\System32\drivers\etc\hosts,打开hosts,在后面追加,如:
127.0.0.1 www.hongfeng.com
5、完成以上几步,重启Apache服务器即可。