apache配置多个虚拟主机

当需要多个apapche虚拟主机时
1.打开apache–conf–httpd.com
注销DocumentRoot “D:/wamp/apache/htdocs"选项
打开Include conf/extra/httpd-vhosts.conf选项
2.然后打开httpd-vhosts.conf
添加如下内容例

DocumentRoot D:/wamp/apache/htdocs/bigparty
ServerName www.bigparty.com
<Directory D:/wamp/apache/htdocs/bigparty >
    AllowOverride All
    Options All
</Directory>


DocumentRoot D:/wamp/apache/htdocs/yii/shop
ServerName www.shop.com
<Directory D:/wamp/apache/htdocs/yii/shop >
    AllowOverride All
    Options All
</Directory>


注: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

你可能感兴趣的:(apache配置多个虚拟主机)