gpt4 book ai didi

与mod_wsgi相关的Django https ssl配置错误

转载 作者:太空宇宙 更新时间:2023-11-03 13:14:31 27 4
gpt4 key购买 nike

我将我的 Django 项目部署到 AWS Linux AMI thought Elastic Beanstalk。目前,它在 http 上运行良好,但在 https 上,它会显示如下错误。

[:error] [pid 3090] [client 24.43.39.130:64135] Embedded mode of mod_wsgi disabled by runtime configuration: /opt/python/current/app/connectshops/wsgi.py

我一直在努力调试错误,但我还无法弄清楚。有谁知道出了什么问题?我应该在我的 ssl.conf 文件中添加一些配置吗?

编辑

/opt/httpd/conf.d/wsgi.conf

LoadModule wsgi_module modules/mod_wsgi.so
WSGIPythonHome /opt/python/run/baselinenv
WSGISocketPrefix run/wsgi
WSGIRestrictEmbedded On

<VirtualHost *:80>

Alias /static/ /opt/python/current/app/static/
<Directory /opt/python/current/app/static/>
Order allow,deny
Allow from all
</Directory>


WSGIScriptAlias / /opt/python/current/app/connectshops/wsgi.py


<Directory /opt/python/current/app/>
Require all granted
</Directory>

WSGIDaemonProcess wsgi processes=1 threads=15 display-name=%{GROUP} \
python-home=/opt/python/run/venv/ \
python-path=/opt/python/current/app:/opt/python/run/venv/lib64/python3.6/site-packages:/opt/python/run/venv/lib/python3.6/site-packages user=wsgi group=wsgi \
home=/opt/python/current/app
WSGIProcessGroup wsgi
</VirtualHost>

LogFormat "%h (%{X-Forwarded-For}i) %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" comb$

这是我的 wsgi.conf 中的代码。正如您所说,我目前正在启用 WSGIRestrictEmbedded,但我不确定我现在正在使用其中的哪一个。只是想让你知道,我有相同的 VirtualHost 代码 *:443

最佳答案

尝试使用:

  WSGIDaemonProcess wsgi processes=1 threads=15 display-name=%{GROUP} \
python-home=/opt/python/run/venv/ \
python-path=/opt/python/current/app user=wsgi group=wsgi \
home=/opt/python/current/app

WSGIScriptAlias / /opt/python/current/app/connectshops/wsgi.py process-group=wsgi

<Directory /opt/python/current/app/>
Require all granted
</Directory>

我没有发现您所拥有的有任何特别的错误,但是已经更改了顺序并使用 process-group 而不是 WSGIProcessGroup

还从 python-path 中删除了不需要添加的目录。

单独保留 WSGIRestrictEmbedded 指令。

关于与mod_wsgi相关的Django https ssl配置错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49700648/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com