网上教程很多,仅记录我的配置,可供参考
一、修改httpd.conf
打开appserv的安装目录,找到httpd.conf文件,分别去掉下面两行文字前面的#号。
- #LoadModule vhost_alias_module modules/mod_vhost_alias.so
去掉#意思是启用apache的虚拟主机功能。
- #Include conf/extra/httpd-vhosts.conf
去掉这一行的#意思是从conf/extra/httpd-vhosts.conf这个文件导入虚拟主机配置
二、修改httpd-vhosts.conf
<VirtualHost *:80> ServerAdmin 1091209485@qq.com DocumentRoot "E:\developer\Apache24\htdocs" ServerName localhost </VirtualHost> <VirtualHost *:80> ServerAdmin 1091209485@qq.com DocumentRoot "E:\developer\www\a.sivkun.com" ServerName a.sivkun.com #ServerAlias www.dummy-host.example.com #ErrorLog "logs/dummy-host.example.com-error.log" #CustomLog "logs/dummy-host.example.com-access.log" common <Directory "E:\developer\www\a.sivkun.com"> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost> <VirtualHost *:80> ServerAdmin 1091209485@qq.com DocumentRoot "E:\developer\www\b.sivkun.com" ServerName b.sivkun.com <Directory "E:\developer\www\b.sivkun.com"> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost> <VirtualHost *:80> ServerAdmin 1091209485@qq.com DocumentRoot "E:\developer\www\c.sivkun.com" ServerName c.sivkun.com <Directory "E:\developer\www\c.sivkun.com"> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> </VirtualHost>
三、修改hosts
windows路径:C:\Windows\System32\drivers\etc\hosts
127.0.0.1 localhost 127.0.0.1 a.sivkun.com 127.0.0.1 b.sivkun.com 127.0.0.1 c.sivkun.com
参考了:http://blog.csdn.net/zm2714/article/details/8351342