【发布时间】:2023-03-27 10:18:02
【问题描述】:
我将我的 Django 项目部署到 AWS Linux AMI 并认为是 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 设为 ON,但我不确定我现在使用的是哪一个。 如您所知,我对 VirtualHost *:443 有相同的代码
【问题讨论】:
-
您有
WSGIRestrictEmbedded到On来禁用嵌入式模式,但没有正确设置您的配置以使WSGI 应用程序在守护程序模式下运行。显示 WSGI 应用程序的 Apache 配置。您是否在任何地方使用WSGIProcessGroup指令或process-group选项到WSGIScriptAlias? -
我想我正在使用 WSGIScriptAlias,但我不确定,因为我对这部分很陌生。如果我有 WSGIScriptAlias,我应该删除 WSGIRestrictEmbedded 吗?
-
@GrahamDumpleton 我编辑了帖子以添加我的 WSGI。请检查一下。
-
@GrahamDumpleton 就像你问的那样,我正在使用
WSGIProcessGroup、WSGIScriptAlias和WSGIScriptAlias。我应该删除所有这些吗?