原文: http://blog.csdn.net/ReadyYes/article/details/51038192
进入C:\Apache24\conf\httpd.conf
把那个“#”号去掉
进入C:\Apache24\conf\extra\httpd-vhosts.conf 配置如下
#*代表当前服务器的所有IP地址
<VirtualHost *:80>
#主机名
ServerName www.zy.com
#主机别名 多个主机别名用空格分开
ServerAlias zy.com xy.com
ServerAdmin admin@zy.com
DocumentRoot "E:/phptest"
#Directory 中的路径要和DocumentRoot的路径一致,Directory配置访问权限
<Directory "E:/phptest">
Options Indexes FollowSymLinks
#默认主页
DirectoryIndex test.php
#自定义后缀php处理
AddType application/x-httpd-php .php .ppp .phtml
AllowOverride all
Require all granted
</Directory>
#配置虚拟目录
Alias /abc "E:/php100"
#配置虚拟目录权限
<Directory "E:/php100">
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</Directory>
ErrorLog "logs/dummy-www.zy.com-error.log"
CustomLog "logs/dummy-www.zy.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:\Apache24\htdocs"
<Directory "C:\Apache24\htdocs">
Options Indexes FollowSymLinks
#默认主页
DirectoryIndex index.html
#自定义后缀php处理
AddType application/x-httpd-php .php .ppp .phtml
AllowOverride all
Require all granted
</Directory>
ServerName localhost
</VirtualHost>