【问题标题】:Deploying Sanic Raw部署 Sanic Raw
【发布时间】:2017-11-27 16:40:38
【问题描述】:

Sanic 似乎是 Python 的高性能 Web 框架(服务器)。根据使用其他框架(包括 Flask 和 Django)的经验,我知道出于安全原因,通常建议将 Python 服务器放在 Nginx 等另一台服务器(例如反向代理)后面。这如何转化为 Sanic 或运行 Sanic 的 gunicorn 服务器?有没有人有这方面的经验。我想知道将 Python 服务器暴露给 Web 是否安全。

【问题讨论】:

  • 您能否指出一个详细说明安全问题的资源?当我将 Nginx 放在我的 Python 应用程序前面时,通常是为了将流量封装在 TLS 中或有效地提供静态内容。

标签: python deployment sanic


【解决方案1】:

我还没有将 sanic 部署到 prod 环境,但之前的部署遵循以下逻辑:

Internet Nginx Uwsgi(或gunicorn) python 框架(django 或其他框架)

根据Deploy Sanic,您可以在 gunicorn 后面与多个工人一起启动 sanic。

所以我猜是 nginx gunicorn gunicorn myapp:app --bind 0.0.0.0:8080 --worker-class sanic.worker.GunicornWorker

【讨论】:

    猜你喜欢
    • 2021-07-21
    • 1970-01-01
    • 2020-07-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-24
    相关资源
    最近更新 更多