转 xampp vhost 配置多虚拟主机

本文详细介绍了如何利用Apache的httpd.conf配置文件,通过修改host文件,实现同一IP与端口下,根据不同URL区分不同虚拟主机的功能。通过配置示例,展示了如何为两个不同的网站www.aupair.net和www.uab.net设置虚拟主机,确保它们能够独立运行于同一服务器环境中。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

转自 http://blog.youkuaiyun.com/nailwl/article/details/5465888

配置虚拟主机给aupair和Under a bus  
使用同一 IP:PORT,根据不同url来区分不同虚拟主机,配置步骤如下:
1、c:/WINDOWS/system32/drivers/etc目录下的host文件,添加配置信息如下:
127.0.0.1 www.aupair.net
127.0.0.1 www.uab.net
要配置apache的httpd.conf配置文件:
#如果要基于url的多虚拟机,必须要有这个配置
NameVirtualHost *:80
#VirtualHost For Under A Bus
<VirtualHost *:80>
ServerAdmin nailwl86@gmail.com
DocumentRoot F:/WebRoot/webuab
#here is the url, you should synchronize it with the host configuration
ServerName www.uab.net
ErrorLog logs/uabdev.5ims.net-error_log
CustomLog logs/uabdev.5ims.net-access_log common
<Directory />
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from All
</Directory>
<Directory "F:/WebRoot/webuab/">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from All
</Directory>
</VirtualHost>
#VirtualHost For Aupair
<VirtualHost *:80>
ServerAdmin nailwl86@gmail.com
DocumentRoot F:/WebRoot/aupair
#here is the url, you should synchronize it with the host configuration
ServerName www.aupair.net
ErrorLog logs/aupairdev.5ims.net-error_log
CustomLog logs/aupairdev.5ims.net-access_log common
<Directory />
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from All
</Directory>
<Directory "F:/WebRoot/aupair/">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from All
</Directory>
</VirtualHost>
重新启动apache,
分别在浏览器中输入:
http://www.uab.net
http://www.aupair.net
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值