Apache 多域名配置

1、修改本机的hosts文件,文件位置 C:\Windows\System32\drivers\etc\hosts

  

2、打开Apache的安装目录,找到httpd.conf文件,分别去掉下面两行文字前面的#号。 

 

  LoadModule vhost_alias_module modules/mod_vhost_alias.so(启用apache的虚拟主机功能)


  Include conf/extra/httpd-vhosts.conf (导入虚拟主机配置)  

 

3、打开extra目录内的httpd-vhosts.conf文件,把默认的配置改为自己想要的目录和域名

  

  ############ manage #################
  <VirtualHost *:80>
  DocumentRoot "D:/xampp/htdocs/manage/"
    ServerName localhost
    ServerAlias localhost
    ErrorLog "logs/localhost-error_log"
  </VirtualHost>

  ############ 7dd #################
  <VirtualHost *:80>
    DocumentRoot "D:/xampp/htdocs/7dd/"
    ServerName test.7dd.com
    ErrorLog "logs/localhost-error_log"
  </VirtualHost>

 

4、如果出现403错误 修改httpd.conf 里的Directory 配置,如下

  <Directory />

    Options FollowSymLinks ExecCGI Indexes
    AllowOverride all
    Allow from all
    #Require all denied
  </Directory>

 

  

转载于:https://www.cnblogs.com/starfish29/p/10621101.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值