wamp配置虚拟主机

首先

1  编辑httpd.conf,查找Include conf/extra/httpd-vhosts.conf,把前面注释符号“#”删掉。

2  找到安装目录下wamp\bin\apache\Apache2.2.17\conf\extra 下 httpd-vhosts.conf这个文件

3 把 里面的内容清空掉 换成下面的内容

<VirtualHost 127.0.0.1:80>
    DocumentRoot E:/htdocs/dz
   ServerName www.dz.com
 DirectoryIndex index.html index.htm default.htm index.php default.php index.cgi default.cgi index.pl default.pl index.shtml


<Directory "E:/htdocs/dz">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
</VirtualHost>
<VirtualHost 127.0.0.2:80>
    DocumentRoot E:/htdocs/cms
   ServerName www.dd.com

 DirectoryIndex index.html index.htm default.htm index.php default.php index.cgi default.cgi index.pl default.pl index.shtml

<Directory "E:/htdocs/cms">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
</VirtualHost>
<VirtualHost 127.0.0.3:80>
    DocumentRoot E:/htdocs/dgcms
   ServerName www.dg.com

 DirectoryIndex index.html index.htm default.htm index.php default.php index.cgi default.cgi index.pl default.pl index.shtml


<Directory "E:/htdocs/dgcms">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
</VirtualHost>
<VirtualHost 127.0.0.4:80>
    DocumentRoot E:/htdocs/phpmyadmin
   ServerName www.myadmin.com

 DirectoryIndex index.html index.htm default.htm index.php default.php index.cgi default.cgi index.pl default.pl index.shtml


<Directory "E:/htdocs/phpmyadmin">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
</VirtualHost>

4 修改C:/WINDOWS/system3/drivers/etc/host这个文件,用记事本打开,加上如下内容:
  127.0.0.1  www.maypp.com
5然后重启apache,在浏览器里面输入www.dd.com,看看访问到的内容  

原文地址:https://www.cnblogs.com/kakaxi/p/2092940.html