xampp下创建多个虚拟网站目录

大家知道,伟大的IIS下面增加多个网站就1分钟搞定。现在换XAMPP下运行多个PHP目录,那我们需要有点探索精神。那么进入正题

首先,下载安装官方最新版本的xampp,地址:点击。记得如果电脑安装有IIS,记得点击config来修改端口号

安装成功后,运行软件,点击Explorer.


会打开软件的安装目录,选择.apacheconfextrahttpd-vhosts.conf  ,打开。


添加如下内容:



    1. <VirtualHost 127.0.0.2:80>  
    2.     ServerAdmin "127.0.0.2:80"    
    3.     DocumentRoot "E:/wwwroot/xxx"  
    4.     ServerName 127.0.0.2  
    5.     ErrorLog "logs/xxx.log"  
    6.     CustomLog "logs/xxx.log" combined  
    7. </VirtualHost>   
    8.   
    9. DocumentRoot "E:/wwwroot"  
    10. <Directory "E:/wwwroot">  
    11.     #  
    12.     # Possible values for the Options directive are "None", "All",  
    13.     # or any combination of:  
    14.     #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews  
    15.     #  
    16.     # Note that "MultiViews" must be named *explicitly* --- "Options All"  
    17.     # doesn't give it to you.  
    18.     #  
    19.     # The Options directive is both complicated and important.  Please see  
    20.     # http://httpd.apache.org/docs/2.4/mod/core.html#options  
    21.     # for more information.  
    22.     #  
    23.     Options Indexes FollowSymLinks Includes ExecCGI  
    24.   
    25.     #  
    26.     # AllowOverride controls what directives may be placed in .htaccess files.  
    27.     # It can be "All", "None", or any combination of the keywords:  
    28.     #   AllowOverride FileInfo AuthConfig Limit  
    29.     #  
    30.     AllowOverride All  
    31.   
    32.     #  
    33.     # Controls who can get stuff from this server.  
    34.     #  
    35.     Require all granted  
    36. </Directory>  

,之后依次添加127.0.0.3,127.0.0.4,就直接复制

 

比网上那些改HOST半天还不成功的方便多了吧?

原文地址:https://www.cnblogs.com/wishbay/p/5241205.html