简体   繁体   English

Python3 Sanic + ssl证书

[英]Python3 Sanic + ssl certificate

First of all, I am doing this for the first time and I know that I am lost.首先,我是第一次这样做,我知道我迷路了。

I want to use Python Sanic as the Framework for my website.我想使用 Python Sanic 作为我网站的框架。 But I ALSO want to use my SSL certificate and my Domain.但我也想使用我的 SSL 证书和我的域。 The method in the Sanic docs doesn't work. Sanic 文档中的方法不起作用。 I search in the web and found that I need nginx or Apache2.我在网上搜索,发现我需要nginx或Apache2。 But I have no idea what to do then.但我不知道该怎么做。

It is probably best to use Nginx proxy for this.最好为此使用 Nginx 代理。 There should soon be a complete guide to this at https://sanic.readthedocs.io/en/latest/sanic/nginx.html (once docs are rebuilt, soon).很快就会在https://sanic.readthedocs.io/en/latest/sanic/nginx.html 上有一个完整的指南(一旦文档被重建,很快)。

To enable built-in SSL support,要启用内置 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",
))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM