【问题标题】:Apache 2.4 with mod_wsgi: 403 Forbidden, don't have permission to access /calbase on this server带有 mod_wsgi 的 Apache 2.4:403 Forbidden,无权访问此服务器上的 /calbase
【发布时间】:2017-02-08 08:23:24
【问题描述】:

所以我试图在 Windows 服务器上部署我的 django 项目,使用 apache 2.4 和 mod_wsgi 和 pythong 3.4。在我配置 httpd.conf 并尝试在安装了 mod-wsgi 的情况下启动 apache 之前,它可以工作并向我显示“它可以工作”页面。然后我在httpd.conf中做了如下配置:

# Change Python path used by the server.
WSGIPythonPath “/EquipmentCalibration”

# Make calls to http://localhost/ refer to the Python/WSGI-script located at the specified location.
WSGIScriptAlias / /EquipmentCalibration/equipcal/wsgi.py

# Make calls to http://localhost/static refer to the specified folder.
Alias /static/ /EquipmentCalibration/static

Alias /media/ /EquipmentCalibration/media

<Directory /EquipmentCalibration/static>
Require all granted
</Directory>

<Directory /EquipmentCalibration/media>
Require all granted
</Directory>

<Directory /EquipmentCalibration/equipcale>
<Files wsgi.py>
Require all granted
</Files>
</Directory>

然后尝试访问 localhost:8080(我将端口从 80 更改为 8080),我收到此错误消息:

禁止

您无权访问此服务器上的 /。

下面是相关的error.log。

[Thu Sep 29 15:05:25.171920 2016] [mpm_winnt:notice] [pid 7756:tid 528] AH00456: Apache Lounge VC10 Server built: Jul  9 2016 11:59:00
[Thu Sep 29 15:05:25.171920 2016] [core:notice] [pid 7756:tid 528] AH00094: Command line: 'C:\\Apache24\\bin\\httpd.exe -d C:/Apache24'
[Thu Sep 29 15:05:25.171920 2016] [mpm_winnt:notice] [pid 7756:tid 528] AH00418: Parent: Created child process 7524
[Thu Sep 29 15:05:25.500078 2016] [wsgi:warn] [pid 7524:tid 456] mod_wsgi: Compiled for Python/3.4.2.
[Thu Sep 29 15:05:25.500078 2016] [wsgi:warn] [pid 7524:tid 456] mod_wsgi: Runtime using Python/3.4.3.
[Thu Sep 29 15:05:26.171978 2016] [mpm_winnt:notice] [pid 7524:tid 456] AH00354: Child: Starting 64 worker threads.
[Thu Sep 29 15:05:27.174429 2016] [mpm_winnt:notice] [pid 7636:tid 456] AH00364: Child: All worker threads have exited.
[Thu Sep 29 15:05:29.923754 2016] [authz_core:error] [pid 7524:tid 1108] [client ::1:55483] AH01630: client denied by server configuration: C:/EquipmentCalibration/equipcal/wsgi.py

有人可以帮忙吗? TIA。

【问题讨论】:

    标签: django apache mod-wsgi


    【解决方案1】:

    部分:

    <Directory /EquipmentCalibration/equipcale>
    <Files wsgi.py>
    Require all granted
    </Files>
    </Directory>
    

    有一个与WSGIScriptAlias 指令中使用的名称匹配的目录名称。一个使用equipcal,另一个使用equipcale。他们需要匹配该段名称。

    【讨论】:

    • 天哪,简直不敢相信这是一个错字.....非常感谢!现在它有一些我可以处理的内部服务器错误。再次感谢
    猜你喜欢
    • 2019-02-16
    • 1970-01-01
    • 2017-06-22
    • 2013-09-27
    • 2019-10-17
    • 2015-10-20
    • 2020-01-11
    • 2018-07-12
    • 2014-03-20
    相关资源
    最近更新 更多