在 Fedora 上使用 web2py 和 Apache2 WSGI 出现 403 禁止错误 [英] Getting 403 Forbidden Error Using web2py with Apache2 WSGI on Fedora

查看:21
本文介绍了在 Fedora 上使用 web2py 和 Apache2 WSGI 出现 403 禁止错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在显示网页时收到 403 Forbidden:

I'm getting 403 Forbidden with the webpage displaying:

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

访问日志显示与此相对应的以下内容:

The access log shows the following corresponding to this:

[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

我为上述目录设置了以下权限:

I've the following permissions set for the above directory:

       /]# 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/httpd/conf.d/default.conf如下:

And my conf file /etc/httpd/conf.d/default.conf is as follows:

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>

推荐答案

主要是因为你的apache2版本是2.4.你需要升级你的conf文件..按照链接将 apache2 升级到 2.4

It is mostly because your apache2 version is 2.4. You will need to upgrade you conf file.. Follow the link Upgrading apache2 to 2.4

这篇关于在 Fedora 上使用 web2py 和 Apache2 WSGI 出现 403 禁止错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆