apache设置多个虚拟主机

php php 1526      收藏
apache设置多个虚拟主机,可以直接用自己设置的虚拟主机名字访问本地项目,而不需要使用http://localhost/xxxx来访问了。

自学php博客

1、httpd-vhosts.conf添加虚拟机

    DocumentRoot "D:/Program Files (x86)/wamp/www/"

    ServerName test.local.com

    

    Options Indexes

    AllowOverride all

    

2、Include conf/extra/httpd-vhosts.conf去掉前面的#,开启功能

3、C:\Windows\System32\drivers\etc\hosts

添加:127.0.0.1       test.local.com

重启服务器即可。