2014-01-20 31 views
0
使用的web2py

我得到403與網頁禁止顯示:獲得403禁止與錯誤的Apache2 WSGI在Fedora

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

訪問日誌顯示了以下對應於此:

[Mon Jan 20 17:12:03.888576 2014] [authz_core:error] [pid 1940] [client XX.XX.XX.XX:32491] AH01630: client denied by server configuration: /opt/web-apps/web2py/wsgihandler.py 

我已爲以上目錄設置以下權限:

 /]# ls -ld opt 
drwxrwxrwx. 4 root root 4096 Jan 10 20:05 opt 

    opt]# ls -ld web-apps 
drwxrwxrwx 3 root root 4096 Jan 10 20:10 web-apps 

web-apps]# ls -ld web2py 
drwxr-xr-x 11 apache apache 4096 Jan 10 21:21 web2py 

    web2py]# ls -l wsgihandler.py 
drwxrwxr-x 1 apache apache 1128 Nov 28 19:23 wsgihandler.py 

而我的conf文件/ etc/http d/conf.d/default.conf如下:

NameVirtualHost *:80 
NameVirtualHost *:443 

<VirtualHost *:80> 
    WSGIDaemonProcess web2py user=apache group=apache processes=1 threads=1 
    WSGIProcessGroup web2py 
    WSGIScriptAlias//opt/web-apps/web2py/wsgihandler.py 
    WSGIPassAuthorization On 

    <Directory /opt/web-apps/web2py> 
    AllowOverride None 
    Order Allow,Deny 
    Deny from all 
    <Files wsgihandler.py> 
     Allow from all 
    </Files> 
    </Directory> 

    AliasMatch ^/([^/]+)/static/(?:_[\d]+.[\d]+.[\d]+/)?(.*) /opt/web-apps/web2py/applications/$1/static/$2 

    <Directory /opt/web-apps/web2py/applications/*/static> 
    Options -Indexes 
    Order Allow,Deny 
    Allow from all 
    </Directory> 

    <Location /admin> 
    Deny from all 
    </Location> 

    <LocationMatch ^/([^/]+)/appadmin> 
    Deny from all 
    </LocationMatch> 

    CustomLog /var/log/httpd/access_log common 
    ErrorLog /var/log/httpd/error_log 
</VirtualHost> 

<VirtualHost *:443> 
    SSLEngine on 
    SSLCertificateFile /etc/httpd/ssl/self_signed.cert 
    SSLCertificateKeyFile /etc/httpd/ssl/self_signed.key 

    WSGIProcessGroup web2py 
    WSGIScriptAlias /web2py /opt/web-apps/web2py/wsgihandler.py 
    WSGIPassAuthorization On 

    <Directory /opt/web-apps/web2py> 
    AllowOverride None 
    Order Allow,Deny 
    Deny from all 
    <Files wsgihandler.py> 
     Allow from all 
    </Files> 
    </Directory> 

    AliasMatch ^/([^/]+)/static/(?:_[\d]+.[\d]+.[\d]+/)?(.*) /opt/web-apps/web2py/applications/$1/static/$2 

    <Directory /opt/web-apps/web2py/applications/*/static> 
    Options -Indexes 
    ExpiresActive On 
    ExpiresDefault "access plus 1 hour" 
    Order Allow,Deny 
    Allow from all 
    </Directory> 

    CustomLog /var/log/httpd/access_log common 
    ErrorLog /var/log/httpd/error_log 
</VirtualHost> 
+0

這是問題,如果阿帕奇讀到這裏http://stackoverflow.com/questions/10873295/error-message-forbidden-you-dont-have-允許訪問本服務器 –

+0

@Yogesh試過。並仍然得到相同的錯誤。增加了以下內容: #Options的FollowSymLinks 選項指標包括了FollowSymLinks ExecCGI 的AllowOverride所有 訂單拒絕,允許 所有 允許 – vivekprakash

回答

0

試試這個: 首先,如果你有Linux用戶apache和組阿帕奇然後把你的web2py的目錄中的/ home/apache中/後像這樣改變你的apache站點 - 可用文件。希望這會爲你。

<VirtualHost *:80> 
    ServerName example.com 
    WSGIDaemonProcess web2py user=apache group=apache display-name=%{GROUP} 
    WSGIProcessGroup web2py 
    WSGIScriptAlias//home/apache/web2py/wsgihandler.py 

    <Directory /home/apache/web2py> 
    AllowOverride None 
    Order Allow,Deny 
    Deny from all 
    <Files wsgihandler.py> 
     Allow from all 
    </Files> 
    </Directory> 

    AliasMatch ^/([^/]+)/static/(.*) /users/apache/web2py/applications/$1/static/$2 
    <Directory /users/apache/web2py/applications/*/static/> 
    Order Allow,Deny 
    Allow from all 
    </Directory> 
</VirtualHost> 

如果您使用的virtualenv檢查WSGI文件,以及這樣的:

activate_this = '/path/to/virtualenv/bin/activate_this.py' 
execfile(activate_this, dict(__file__=activate_this) 
import sys 
sys.path.insert(0, '/path/to/web2py_dir')