1、开启主机名虚拟主机 端口80
NameVirtualHost *:80
2、添加主机
<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs/"
ServerName localhost
</VirtualHost>
<VirtualHost *:80> //第一个主机
DocumentRoot "D:/xampp/htdocs/zdss/"
ServerName www.zdss.com
</VirtualHost>
<VirtualHost *:80> //第二个主机
DocumentRoot "D:/xampp/htdocs/zhonglu/"
ServerName www.zhonglu.com
</VirtualHost>
3、本地域名解析
打开 C:\Windows\System32\drivers\etc\hosts文件
添加内容:
192.168.0.122 www.zdss.com
192.168.0.122 www.zhonglu.com