apache虚拟主机配置

<VirtualHost *:80>
        ServerName www.wanwan.net
        DocumentRoot "G:/test_prj/platform_web"
        <Directory "G:/test_prj/platform_web"> 
                Options Indexes FollowSymLinks
                AllowOverride All 
                Order allow,deny
                Allow from all
        </Directory>
</VirtualHost>

<VirtualHost *:80>
        ServerName passport.wanwan.net
        DocumentRoot "G:/test_prj/passport_web"
        <Directory "G:/test_prj/passport_web"> 
                Options Indexes FollowSymLinks
                AllowOverride All 
                Order allow,deny
                Allow from all
        </Directory>
</VirtualHost>

如果上述还不可以,则换成:

<VirtualHost *:80>
 ServerName shop.test
 DocumentRoot "D:\data_online\test_niufeecms"
 DirectoryIndex index.html index.php

 <Directory "D:\data_online\test_niufeecms>
  Options -Indexes +FollowSymlinks
  AllowOverride All
  Require all granted
 </Directory>

</VirtualHost>


一个IP,不同目录下的虚拟主机配置


注: 1.<Directory "G:/test_prj/passport_web"> //如果不添加,这会出现  AccessForbidden

     2.  AllowOverride All //默认为 AllowOverride None 此处修改为 All 目的是可以访问 .htaccess

你可能感兴趣的:(apache虚拟主机配置)