1.先安装好wamp环境并启动,打开配置文件httpd.conf,搜 httpd-vhosts.conf
Include conf/extra/httpd-vhosts.conf //去掉前面的#,这样就开启了httpd-vhosts虚拟主机模块
搜Directory 约160行
<Directory />
Options FollowSymLinks //(选)Options Indexes FollowSymLinks 加索引
#AllowOverride None #创建
AllowOverride All
Order deny,allow
#Deny from all
Allow from all
#Satisfy all
</Directory>
#DocumentRoot "C:/wamp/www" 约150行更改网站根目录
DocumentRoot "D:/www"
2.打开扩展配置文件 \conf\extra httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "G:/wamp/www/808"
ServerName www.test.com
</VirtualHost>
3.打开本地 C:\Windows\System32\drivers\etc hosts 复制出来修改后再覆盖
127.0.0.1 www.test.com