【问题标题】:Apache2 "You don't have permission to access / on this server"Apache2“您无权访问此服务器上的/”
【发布时间】:2014-05-23 07:20:25
【问题描述】:

无法访问文档根文件夹文件 - 出现此错误:

You don't have permission to access / on this server.

Apache 版本

Server version: Apache/2.2.22 (Ubuntu)

虚拟主机配置 内部网站-可用

<VirtualHost *:80>
        ServerName site1

        ServerAlias www.site1


        RailsEnv production
        RackEnv production


        DocumentRoot /var/www/site1/webservices/public

        <Directory "/var/www/site/webservices/public">
                Options FollowSymLinks
                AllowOverride None
                Order allow,deny
                Allow from all
                Header set Access-Control-Allow-Origin "*"
        </Directory>


</VirtualHost>

添加到 apache2/hosts 文件中

127.0.0.1 site1

重启 Apache2

/etc/init.d/apache2 restart

可能是权限问题吗?

【问题讨论】:

  • 检查文件系统中文档根文件夹的权限。也许,apache 没有权限遍历和/或读取文档根文件夹。使用ls -l
  • 尝试以递归方式授予 drwxrwsrwx 对其中所有子文件夹的完全访问权限,但仍然出现相同的错误

标签: apache apache2


【解决方案1】:

我认为您需要告诉 Apache 如何处理文件夹(因为 / 是一个文件夹)。您需要告诉 Apache 应该使用哪个文件来列出文件夹内容。

尝试设置:

DirectoryIndex index.html

现在我不确定 ruby​​,但也许你忘记了 index.html 文件?

在选项设置中,您可以添加索引,并删除多视图以防万一,因为多视图试图猜测要使用的文件,这通常会使事情变得更难。所以使用类似的东西:

Options FollowSymLinks Indexes -Multiviews

【讨论】:

  • 感谢您的明确回复。欣赏它!问题是由于另一个具有相同站点名称和不同文档根目录的虚拟主机配置具有优先权。
  • random: 好的,你应该把真正的答案放在那里并检查它作为答案,从打开的问题中删除它并帮助面临同样问题的用户。
猜你喜欢
  • 1970-01-01
  • 2013-06-30
  • 2019-02-22
  • 2023-03-10
  • 2017-05-04
  • 2015-10-06
  • 2015-10-07
相关资源
最近更新 更多