windows 下的 Apache 二级域名 目录绑定配置

通常我们注册的域名都是顶级域名  如 www.potatog.com,我们希望这个域名可以访问服务器的不同网站或者不同功能等等 可能会这样 www.potatog.com/api 或者 www.potatog.com/admin,,,另一种二级域名的方式 api.potatog.com来指向特定目录

在httpd.conf中添加如下内容

顶级域名指定一个目录

<VirtualHost *:80>
  ServerAdmin admin@potatog.com
  DocumentRoot "C:\xampp\htdocs\"
  ServerName www.potatog.com
  ErrorLog "C:\xampp\apache\logs\www.potatog.localhost-error.log"
  CustomLog "C:\xampp\apache\logs\www.potatog.localhost.access.log" combined
</VirtualHost>

二级域名指定一个目录

<VirtualHost *:80>
  ServerAdmin admin@potatog.com
  DocumentRoot "C:\xampp\htdocs\api"
  ServerName api.potatog.com
  ErrorLog "C:\xampp\apache\logs\api.potatog.localhost-error.log"
  CustomLog "C:\xampp\apache\logs\api.potatog.localhost.access.log" combined
</VirtualHost>

参考:

https://www.cnblogs.com/phonecom/p/6363268.html

 

转载于:https://www.cnblogs.com/potatog/p/11027762.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值