现在的位置: 首页 > 综合 > 正文

XP下apache的基于域名的虚拟主机配置

2013年07月30日 ⁄ 综合 ⁄ 共 702字 ⁄ 字号 评论关闭

        这两天配了一下本机的Apache的基于域名的虚拟主机,写篇完整的文章记录一下吧。

        以域名mengyou.com为例。

        一、修改host文件

        打开此文件:C:/Windows/System32/drivers/etc/hosts。添加一行如下:

127.0.0.1    mengyou.com

       二、修改http.conf文件

       打开http.conf文件,进行以下修改。

...
# Virtual hosts
Include conf/extra/httpd-vhosts.conf          //将此行前面的#去掉

      三、配置httpd-vhosts.conf文件(此文件目录见上面的配置)
      添加以下几行进行虚拟域名配置
<VirtualHost *:80>
    DocumentRoot "F:/Apache/htdocs/alliancecircle"
    ServerName mengyou.com
    ErrorLog "logs/dummy-mengyou.com-error.log"
    CustomLog "logs/dummy-mengyou.com-access.log" common
</VirtualHost>

      四、查看站点目录权限
      打开http.conf,修改以下内容  

<Directory />
Options FollowSymLinks
AllowOverride None
# Deny from all
Order allow,deny
Allow from all    //记得修改或添加此行才有权限访问
</Directory>

Linux下的配置也基本一致,供参考。

抱歉!评论已关闭.