XAMPP配置基于虚拟目录、多域名的环境

 

打开Apache 2.x 配置文件 http.conf

搜索Include etc/extra/httpd-vhosts.conf,然后去掉前面的#号

再编辑extra/httpd-vhosts.conf

在最下面添加

---------------------------------------------------------

  <Directory "/webroot/blog">
       Options Indexes FollowSymLinks
       AllowOverride None
       Order allow,deny
       Allow from all
  </Directory>

 <VirtualHost 10.3.0.254:80>
       DocumentRoot "/webroot/blog"
       ServerName www.blog.cn
  </VirtualHost>

--------------------------------------------------------

  <Directory "/webroot/game">
       Options Indexes FollowSymLinks
       AllowOverride None
       Order allow,deny
       Allow from all
  </Directory>

 <VirtualHost 10.3.0.210:80>
       DocumentRoot "/webroot/game"
       ServerName www.game.cn
  </VirtualHost>

-------------------------------------------------------

上面是成对出现,根据实际情况来设置 

回到apache配置文件httpd .conf把下面这些代码都用#注释掉

DocumentRoot "/opt/lampp/htdocs"

<Directory "/opt/lampp/htdocs">

         Options Indexes FollowSymLinks ExecCGI Includes

         AllowOverride All

         Require all granted

</Directory>

然后重启Apache2.X  基于多目录多域名的设置就OK了