xampp vhost 配置多虚拟主机

  1. 配置虚拟主机给aupair和Under a bus  
  2. 使用同一 IP:PORT,根据不同url来区分不同虚拟主机,配置步骤如下:    
  3. 1、c:/WINDOWS/system32/drivers/etc目录下的host文件,添加配置信息如下:    
  4.     127.0.0.1 www.aupair.net    
  5.     127.0.0.1 www.uab.net    
  6. 要配置apache的httpd.conf配置文件:    
  7. #如果要基于url的多虚拟机,必须要有这个配置    
  8. NameVirtualHost *:80    
  9. #VirtualHost For Under A Bus     
  10. <VirtualHost *:80>    
  11.     ServerAdmin nailwl86@gmail.com    
  12.     DocumentRoot F:/WebRoot/webuab    
  13.     #here is the url, you should synchronize it with the host configuration    
  14.     ServerName www.uab.net    
  15.     ErrorLog logs/uabdev.5ims.net-error_log    
  16.     CustomLog logs/uabdev.5ims.net-access_log common    
  17.     <Directory />    
  18.         Options FollowSymLinks MultiViews    
  19.         AllowOverride All    
  20.         Order allow,deny    
  21.         Allow from All     
  22.     </Directory>    
  23.     <Directory "F:/WebRoot/webuab/">    
  24.         Options FollowSymLinks    
  25.         AllowOverride All    
  26.         Order allow,deny    
  27.         Allow from All    
  28.     </Directory>    
  29. </VirtualHost>    
  30. #VirtualHost For Aupair    
  31. <VirtualHost *:80>    
  32.     ServerAdmin nailwl86@gmail.com    
  33.     DocumentRoot F:/WebRoot/aupair    
  34.     #here is the url, you should synchronize it with the host configuration    
  35.     ServerName www.aupair.net    
  36.     ErrorLog logs/aupairdev.5ims.net-error_log    
  37.     CustomLog logs/aupairdev.5ims.net-access_log common    
  38.     <Directory />    
  39.         Options FollowSymLinks MultiViews    
  40.         AllowOverride All    
  41.         Order allow,deny    
  42.         Allow from All     
  43.     </Directory>    
  44.     <Directory "F:/WebRoot/aupair/">    
  45.         Options FollowSymLinks    
  46.         AllowOverride All    
  47.         Order allow,deny    
  48.         Allow from All    
  49.     </Directory>    
  50. </VirtualHost>    
  51. 重新启动apache,    
  52. 分别在浏览器中输入:    
  53. http://www.uab.net    
  54. http://www.aupair.net 
原文地址:https://www.cnblogs.com/cnsanshao/p/2466030.html