首页 > 代码库 > apache2.4 虚拟主机配置
apache2.4 虚拟主机配置
网上教程很多,仅记录我的配置,可供参考
一、修改httpd.conf
打开appserv的安装目录,找到httpd.conf文件,分别去掉下面两行文字前面的#号。
[plain] view plain copy
- #LoadModule vhost_alias_module modules/mod_vhost_alias.so
去掉#意思是启用apache的虚拟主机功能。
[plain] view plain copy
- #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
apache2.4 虚拟主机配置
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。