【发布时间】:2020-07-09 11:45:16
【问题描述】:
首先,我是第一次这样做,我知道我迷路了。
我想使用 Python Sanic 作为我网站的框架。但我也想使用我的 SSL 证书和我的域。 Sanic 文档中的方法不起作用。我在网上搜索,发现我需要 nginx 或 Apache2。但我不知道该怎么办。
【问题讨论】:
标签: python-3.x apache nginx webserver sanic
首先,我是第一次这样做,我知道我迷路了。
我想使用 Python Sanic 作为我网站的框架。但我也想使用我的 SSL 证书和我的域。 Sanic 文档中的方法不起作用。我在网上搜索,发现我需要 nginx 或 Apache2。但我不知道该怎么办。
【问题讨论】:
标签: python-3.x apache nginx webserver sanic
为此最好使用 Nginx 代理。 https://sanic.readthedocs.io/en/latest/sanic/nginx.html 应该很快就会有一个完整的指南(一旦重建文档,很快)。
要启用内置 SSL 支持,
app.run(host="0.0.0.0", port=443, ssl=dict(
cert="/etc/letsencrypt/live/example.com/fullchain.pem",
key="/etc/letsencrypt/live/example.com/privkey.pem",
))
【讨论】: