django - 带有 mod_wsgi : 403 Forbidden, 的 Apache 2.4 无权访问此服务器上的 calbase

标签 django apache mod-wsgi

所以我尝试使用 apache 2.4 和 mod_wsgi 和 pythong 3.4 在 Windows 服务器上部署我的 django 项目。在我配置 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),我收到以下错误消息:

Forbidden

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

下面是相关的错误日志。

[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。

最佳答案

该部分:

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

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

关于django - 带有 mod_wsgi : 403 Forbidden, 的 Apache 2.4 无权访问此服务器上的 calbase,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39779960/

相关文章:

Apache/mod_wsgi 进程意外终止

python - 如何在 Django 更新语句中将字段设置为空

python - 基于表达式的django表格单元格颜色

Django South - 将外键更改为必需

java - FTPSClientretrievefile() 挂起

KeepAlive 关闭时的 Apache MaxClients

Django 电子邮件后端(不断从错误的 "sender"发送电子邮件)

apache - phpMyAdmin 500 内部服务器错误

python - 垃圾邮件机器人使我的日志文件困惑 [Django]

python - 在 mod_wsgi 上部署 django 应用程序时出现问题