kevin0490 发表于 2017-1-12 10:41:53

在xp上用apache配置虚拟域名时的一些小记

  由于工作需要,在本地配置测试环境,用apache配置多个虚拟域名,如www.test.com,img1.test.com。在网上查了好多资料,基本步骤是这样的,一、修改hosts文件,添加127.0.0.1    www.test.com    127.0.0.1   img1.test.com的域名映射;二、修改apache conf--> extra目录下的httpd-vhosts.conf文件,在最后加上
  <VirtualHost *:80>
    DocumentRoot "E:/xxxx/www/test"
    ServerName www.test.com
</VirtualHost>
  但是,结果总是不尽人意!
  后来仔细的检查了一下apache的conf目录下的httpd.conf文件,发现没有把Include conf/extra/httpd-vhosts.conf这个配置最前面的#号去掉!发现了这个高兴了一把,重启apache,又出错了,这回是403权限的错!
  最后在配置中加上
  <Directory "E:/xxxx/www/test">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>
  重启apache,成功了!高兴一下!在此记录一下,以免以后出现同样的错误!
  在httpd-vhosts.conf的完整配置如下:
  <VirtualHost *:80>
    DocumentRoot "E:/xxxx/www/test"
    ServerName www.test.com
    <Directory "E:/ding/xxxx/test">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>
</VirtualHost>
页: [1]
查看完整版本: 在xp上用apache配置虚拟域名时的一些小记