首页 > 解决方案 > 如何使用 mod_wsgi 和 SSL 将 Http 协议定向到 Django 中的 Https 协议?

问题描述

我正在使用 mod_wsgi 运行我的 Django API,但它运行在 HTTP 协议上。我希望它在 HTTPS 协议中运行,但我不知道如何在 Dockerfile 中安装/配置 SSL。我已经搜索了为我的 Django API 实现 SSL,但我找不到任何使用 mod_wsgi 的 dockerized Django 应用程序的示例。

Dockerfile:

FROM python:3
RUN echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && locale-gen
ENV LANG=en_US.UTF-8 LC_ALL=en_US.UTF-
COPY ./requirements.txt /requirements.txt
RUN pip install --no-cache-dir -r /requirements.txt
WORKDIR /opt/app-root
COPY . /opt/app-root

EXPOSE 80
CMD ["mod_wsgi-express", "start-server", "--port", "80", "--threads","20","--processes","5","--user","www-data", "--group", "www-data", "--log-to-terminal", "/opt/app-root/mysite/wsgi.py"]

这个站点描述了在 mod_wsgi 中 OpenSSL 的实现,但我不知道如何在 Dockerfile 中使用它。请在这件事上给予我帮助

标签: djangohttpsopenssldockerfilemod-wsgi

解决方案


推荐阅读