本地设置apache 用域名访问
#第一种是基于IP地址的虚拟主机 ip 不同
<VirtualHost www.mkaifa.com>
ServerName www.mkaifa.com
DocumentRoot D:\xampp\htdocs\mkaifa.com
</VirtualHost>
<VirtualHost www.anddd.com>
ServerName www.anddd.com
DocumentRoot D:\xampp\htdocs\anddd.com
</VirtualHost>
C:\WINDOWS\system32\drivers\etc\hosts
127.0.0.1 localhost
127.0.0.2 www.mkaifa.com
127.0.0.3 www.anddd.com
#第二种是基于主机名的虚拟主机 ip相同而主机头不同
#不能为 127.0.0.1
NameVirtualHost 127.0.0.8
<VirtualHost 127.0.0.8>
ServerName www.mkaifa.com
DocumentRoot D:\xampp\htdocs\mkaifa.com
</VirtualHost>
<VirtualHost 127.0.0.8>
ServerName www.anddd.com
DocumentRoot D:\xampp\htdocs\anddd.com
</VirtualHost>
Listen 88
<VirtualHost *:88>
DocumentRoot D:\xampp\htdocs\mkaifa.com
</VirtualHost>
C:\WINDOWS\system32\drivers\etc\hosts
127.0.0.1 localhost
127.0.0.8 www.mkaifa.com
127.0.0.8 www.anddd.com