一、修改httpd.conf
1. 启用apache的虚拟主机功能
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
2. 导入虚拟主机配置
#Include conf/extra/httpd-vhosts.conf
二、修改httpd-vhosts.conf
NameVirtualHost *:80 <VirtualHost *:80> ServerName www.test.com ServerAlias test.test.com my.test.com DocumentRoot "D:/www" <Directory "D:/www"> Order allow,deny Allow from all </Directory> </VirtualHost>