本文介绍了当 DocumentRoot 指向两个不同的驱动器时,Apache 给了我 403 Access Forbidden的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在文档根目录所在的驱动器与 apache 所在的驱动器不同的虚拟主机下打开一个页面时,我收到 403 访问被禁止.我使用 apachefriends 版本安装.这是我的 httpd-vhosts.conf 文件:

I am getting an 403 access forbidden when attempting to open a page under a vhost where the document root is sitting on a different drive than where apache is sitting. I installed using the apachefriends release. This is my httpd-vhosts.conf file:


NameVirtualHost 127.0.0.1

服务器名称 foo.localhostDocumentRoot "C:/xampp/htdocs/foo/public"</虚拟主机>

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

服务器名称栏.localhostDocumentRoot "F:/bar/public"</虚拟主机>

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

在浏览器中打开 bar.localhost 时,Apache 给我 403 Access Forbidden.我尝试设置许多不同的访问权限,甚至为每个人设置完全权限,但我尝试过的一切都没有帮助.

When opening bar.localhost in my browser, Apache is giving me 403 Access Forbidden. I tried setting lots of different access rights, even full rights to everyone, but nothing I tried helped.

谢谢!为了将来参考,请在其中添加选项索引"以显示目录索引.

Thanks! For future reference, add 'Options indexes' within to show directory indexes.

推荐答案

你不需要

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

你唯一需要的是......

the only thing what you need is...

Require all granted

...在目录部分内.

查看 Apache 2.4 升级端:

See Apache 2.4 upgrading side:

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

这篇关于当 DocumentRoot 指向两个不同的驱动器时,Apache 给了我 403 Access Forbidden的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 11:17