apache 配置虚拟目录

#添加我的虚拟目录myweb,需要重启
<IfModule dir_module>
    DirectoryIndex index.html
    Alias /myweb  "C:/myweb"
    <Directory C:/myweb>
 order allow,deny
 Allow from all
    </Directory>
</IfModule>

  注: order allow,deny  这行的逗号之间千万不要有空格,,,,不然会启动失败!!!

#配置自己的虚拟主机
<VirtualHost 127.0.0.1:80>
    DocumentRoot "C:/myweb"
    DirectoryIndex index.html index.htm default.htm index.php default.php index.cgi default.cgi index.pl default.pl index.shtml
    <Directory />
 Options FollowSymLinks IncludesNOEXEC Indexes
 AllowOverride None       

 Order Deny,Allow
 Allow from all
    </Directory>
</VirtualHost>

注:这个<Directory />为什么一定要直接用"/"闭合。。。。。不闭合apache还不能启动。。。。。不解。。

原文地址:https://www.cnblogs.com/605395451/p/2182571.html