您的位置:首页 > 运维架构 > Apache

apache配置多个虚拟主机

2014-05-27 00:00 246 查看
当需要多个apapche虚拟主机时
1.打开apache--conf--httpd.com
注销DocumentRoot "D:/wamp/apache/htdocs"选项
打开Include conf/extra/httpd-vhosts.conf选项
2.然后打开httpd-vhosts.conf
添加如下内容例
<VirtualHost *:80>
DocumentRoot D:/wamp/apache/htdocs/bigparty
ServerName www.bigparty.com
<Directory D:/wamp/apache/htdocs/bigparty >
AllowOverride All
Options All
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot D:/wamp/apache/htdocs/yii/shop
ServerName www.shop.com
<Directory D:/wamp/apache/htdocs/yii/shop >
AllowOverride All
Options All
</Directory>
</VirtualHost>
注:DocumentRoot,Directory项目的地址
ServerName :虚拟网址
3.打开window--system32--drivers--etc-hosts文件
在最低下加入相应的
ServerName对应的虚拟网址
例:127.0.0.1 www.bigparty.com
127.0.0.1 www.shop.com

配置完保存后,重起apache
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: