① httpd.conf 找到VirtualHost example,在后面引入httpd-vhosts.conf文件:
Include conf/extra/httpd-vhosts.conf
这个句话,高版本的apache里面已经写有了,只需吧Include前面的#号去掉就OK
② httpd-vhosts.conf配置文件的内容如下:
#
# DocumentRoot 是网站文件存放的根目录
# ServerName 是网站域名, 需要跟 DNS 指向的域名一致
Include conf/extra/httpd-vhosts.conf
这个句话,高版本的apache里面已经写有了,只需吧Include前面的#号去掉就OK
② httpd-vhosts.conf配置文件的内容如下:
#
# DocumentRoot 是网站文件存放的根目录
# ServerName 是网站域名, 需要跟 DNS 指向的域名一致
#
例如
#VirtualHost *:80#
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "D:\wamp\www\项目名"
ServerName my.xiangmu.com
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
#/VirtualHost#
把#号换为< 或者 >
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "D:\wamp\www\ 项目名"
ServerName my.xiangmu.com
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
。。。。。。可以写多个虚拟主机。。。。。。。
DocumentRoot "D:\wamp\www\项目名"
ServerName my.xiangmu.com
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
#/VirtualHost#
把#号换为< 或者 >
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "D:\wamp\www\ 项目名"
ServerName my.xiangmu.com
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
。。。。。。可以写多个虚拟主机。。。。。。。