Apache2.2多域名虚拟主机配置

Apache2.2多域名虚拟主机配置

 

第一步:修改E:\Program Files\Apache2.2\conf\httpd.conf

 

--------------------注释掉一下内容-----------------

##DocumentRoot "E:/Program Files/Apache2.2/htdocs"

 

@注释中重点一(如果不注释以下内容,后面内容会有一些改变)

##<Directory />

##    Options FollowSymLinks

##    AllowOverride None

##    Order deny,allow

##    Deny from all

##</Directory>

 

 

 

##<Directory "E:/Program Files/Apache2.2/htdocs">

    #

    # Possible values for the Options directive are "None", "All",

    # or any combination of:

    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

    #

    # Note that "MultiViews" must be named *explicitly* --- "Options All"

    # doesn't give it to you.

    #

    # The Options directive is both complicated and important.  Please see

    # http://httpd.apache.org/docs/2.2/mod/core.html#options

    # for more information.

    #

##    Options Indexes FollowSymLinks

    #

    # AllowOverride controls what directives may be placed in .htaccess files.

    # It can be "All", "None", or any combination of the keywords:

    #   Options FileInfo AuthConfig Limit

    #

##    AllowOverride None

    #

    # Controls who can get stuff from this server.

    #

##    Order allow,deny

##    Allow from all

##</Directory>

 

 

 

----------------------取消注释,释放以下内容---------------

Include conf/extra/httpd-vhosts.conf

 

 

 

 

 

 

第二步:修改E:\Program Files\Apache2.2\conf\extra\httpd-vhosts.conf

 

----------------------取消注释,释放以下内容---------------

NameVirtualHost *:80

----------------------添加自己定义的域名虚拟主机---------------

 

<VirtualHost *:80>

    ServerAdmin admin@xingmo.com

    DocumentRoot "D:/www/test"

    ServerName www.test1.com

    ErrorLog "logs/www.test1.com-error_log"

    CustomLog "logs/www.test1.com-access_log" common

</VirtualHost>

 

<VirtualHost *:80>

    ServerAdmin admin@xingmo.com

    DocumentRoot "D:/www/test"

    ServerName www.test2.com

    ErrorLog "logs/www.test2.com-error_log"

    CustomLog "logs/www.test2.com-access_log" common

</VirtualHost>

 

 

 

 

 

@如果上面的“注释中重点一”中的内容没有注释掉,则需要为以上每个虚拟主机配置

<Directory "D:/www/test">(每个虚拟主机的路径不一样)

    Options Indexes FollowSymLinks

    AllowOverride None

    Order allow,deny

    Allow from all

</Directory>

否则不需要

 

 

第三步:修改C:\WINDOWS\system32\drivers\etc\hosts

----------------------------增加以下内容-----------------------------

127.0.0.1       www.test2.com

127.0.0.2       www.test1.com

 

第四步:完成


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值