禁止访问:您无权访问此服务器上的/

时间:2013-10-04 15:09:52

标签: apache

我一直有这个access denied错误。我在 CentOs 6.4。上使用 apache 2.2.15 服务器正在与用户apache和组apache一起运行。 在家里,我有一个用户登台。我将他添加到 apache组

docs文件夹的权限是:

drwxrwx--- 2 staging staging 4096 Oct  4 14:33 docs

我正在使用index.html文件进行测试:

-rw-r--r-- 1 staging staging   13 Oct  4 14:28 index.html

SELinux 已停用。我正在使用的地址是 staging.mysite.com

我的httpd.conf看起来像这样:

<Directory "/home/*/docs">

#
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
# 
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
# 
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
    Options FollowSymLinks

# 
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
    AllowOverride All

# 
# Controls who can get stuff from this server.
#
    Order allow,deny
    Allow from all

</Directory>

我还有一个虚拟主机设置到我的暂存地址:

<VirtualHost SERVERIP:80>
        ServerName staging.mysite.com
        DocumentRoot /home/staging/docs
        ServerAdmin staging@mysite.com
        CustomLog /home/staging/logs/access_log combined
</VirtualHost>

如果您需要更多信息,请告诉我,但不知道为什么它会给我这个错误?

2 个答案:

答案 0 :(得分:1)

好吧,正如您所说,docs文件夹只能由登台用户和登台组读取。所以apache用户可能无法读取它。

一种解决方案是将apache用户添加到分段组。

答案 1 :(得分:-1)

我可以修复同样的错误:

要在您的nagios配置中修改选项参数+Indexes并添加DirectoryIndex index.php

也许显示为:

<Directory "/home/*/docs">

#
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
# 
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
# 
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
    Options FollowSymLinks +Indexes

    DirectoryIndex index.php

# 
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
    AllowOverride All

# 
# Controls who can get stuff from this server.
#
    Order allow,deny
    Allow from all

</Directory>

最后重启你的apache服务。

检查权限/home/可以是+ x和+ r,例如chmod +rx /home/