gpt4 book ai didi

python-3.x - 如何为通过 Gunicorn 运行的 Flask 应用程序获取 SSL?

转载 作者:行者123 更新时间:2023-12-04 22:36:51 25 4
gpt4 key购买 nike

我在 Ubuntu 18.04 上通过 Gunicorn 运行 Flask 应用程序。 Gunicorn 在端口 80 上运行。我有 NGINX 设置,但它没有被使用并且被禁用。我能够成功地为 NGINX 设置 cert-bot,但它没有帮助,因为 NGINX 没有被使用,并且它也与端口 80 上的 gunicorn 冲突。是否可以获得专门用于 Gunicorn/Flask 的 SSL 证书或其他东西可以使用它吗? SSL 和 https对页面至关重要。

最佳答案

您可以将 certbot 生成的 SSL 证书与 Gunicorn 一起使用:

  • 关注 certbot instructions对于软件“其他”。请注意保存生成文件的位置。
  • 运行 Gunicorn 并使用 --keyfile 指定证书和 key 路径和 --certfile选项。例子:gunicorn --keyfile /some/path/key.pem --certfile /some/path/cert.pem main:app
  • 关于python-3.x - 如何为通过 Gunicorn 运行的 Flask 应用程序获取 SSL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62714873/

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