2013-10-04 218 views
1

我一直有這個access denied錯誤。我正在使用apache 2.2.15 on CentOs 6.4。 服務器正以用戶apache和組apache運行。 在家中,我有一個用戶中轉。我將他添加到apache羣組禁止:您沒有權限訪問/在此服務器上

權限上的文檔文件夾是:

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 [email protected] 
     CustomLog /home/staging/logs/access_log combined 
</VirtualHost> 

如果你需要更多的信息,讓我知道,但任何想法,爲什麼它給了我這個錯誤?

回答

1

好吧,正如你所說,docs文件夾只能由分段用戶和分段組讀取。所以Apache用戶可能不會讀取它。

一個解決方案是將apache用戶添加到分段組。

+0

apache用戶是apache組的一部分,我像我說的那樣將分段用戶添加到apache組。 – user2847120

+0

我讀到了,但apache組沒有對文檔文件夾的讀取權限。 –

+0

我將/ home/staging/docs及其內容組更改爲apache,但它什麼都沒做...... – user2847120

-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/

+0

Apache 2.2.15不支持''語法 – sufinawaz

相關問題