分享

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

 面包小屋 2012-08-23

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./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条评论

    发表

    请遵守用户 评论公约

    类似文章 更多