代码之家  ›  专栏  ›  技术社区  ›  RobbieGee

当documentroot指向两个不同的驱动器时,Apache提供403禁止访问

  •  50
  • RobbieGee  · 技术社区  · 16 年前

    当我试图打开一个vhost下的页面时,我被禁止访问403,该页面的文档根目录与Apache所在的驱动器不同。我使用ApacheFriends版本安装。这是我的httpd-vhosts.conf文件:

    
    NameVirtualHost 127.0.0.1
    
    

    <VirtualHost 127.0.0.1> ServerName foo.localhost DocumentRoot "C:/xampp/htdocs/foo/public" </VirtualHost>

    <VirtualHost 127.0.0.1> ServerName bar.localhost DocumentRoot "F:/bar/public" </VirtualHost>

    在浏览器中打开bar.localhost时,Apache禁止我访问403。我试着设置很多不同的访问权限,甚至是对每个人的完全权限,但我没有尝试过任何帮助。

    编辑:谢谢!为供将来参考,请在中添加“选项索引”以显示目录索引。

    4 回复  |  直到 16 年前
        1
  •  57
  •   Michael Klink    12 年前

    Options Indexes FollowSymLinks MultiViews Includes ExecCGI
    AllowOverride All
    Order Allow,Deny
    Allow from all
    Require all granted
    

    Require all granted
    

    http://httpd.apache.org/docs/2.4/upgrading.html

        2
  •  50
  •   Mark Embling    16 年前

    <Directory "F:/bar/public">
        Order Allow,Deny
        Allow from All
        # Any other directory-specific stuff
    </Directory>
    

    More info

        3
  •  24
  •   cloudwhale    12 年前

    blog < <

    <Directory "C:/wamp/www">
        Options Indexes FollowSymLinks MultiViews Includes ExecCGI
        AllowOverride All
        Order Allow,Deny
        Allow from all
        Require all granted
    </Directory>
    
        4
  •  0
  •   mujaffars Vidya    10 年前

    <VirtualHost *:80>
        ServerAdmin webmaster@dummy-host.example.com
        DocumentRoot "c:/Apache24/docs/dummy-host.example.com"
        ServerName dummy-host.example.com
        ServerAlias www.dummy-host.example.com
        ErrorLog "logs/dummy-host.example.com-error.log"
        CustomLog "logs/dummy-host.example.com-access.log" common
     </VirtualHost>
    
    <VirtualHost *:80>
        ServerAdmin webmaster@dummy-host2.example.com
        DocumentRoot "c:/Apache24/docs/dummy-host2.example.com"
        ServerName dummy-host2.example.com
        ErrorLog "logs/dummy-host2.example.com-error.log"
        CustomLog "logs/dummy-host2.example.com-access.log" common
    </VirtualHost>
    

    <VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot "c:/wamp/www"
        ServerName localhost
        ErrorLog "logs/localhost-error.log"
        CustomLog "logs/localhost-access.log" common
    </VirtualHost>