转 xampp vhost 配置多虚拟主机

转自 http://blog.csdn.net/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 [email protected]    
        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 [email protected]    
        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 

猜你喜欢

转载自arcko.iteye.com/blog/1490137