apache配置虚拟主机

 1.  设置域名映射同一个IP,修改hosts(C:\WINDOWS\system32\drivers\etc\hosts)

127.0.0.1 www.test1.com

2.  在httpd.conf中将附加配置文件httpd-vhosts.conf包含进来

把httpd-vhosts.conf一行最前面的 # 去掉

3.  接着在httpd-vhosts.conf中添加如下配置

<VirtualHost *:80>
ServerAdmin www.test1.com
DocumentRoot "D:/test1"
ServerName www.test1.com
<Directory "D:/test1">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

4.重启apache,在浏览器中输入www.test1.com

 

你可能感兴趣的:(apache)