uWSGI 配置使用 HTTPS

uWSGI configuration to use HTTPS

我需要让 uWSGI 只允许通过 https 进行连接。 我只能使用 uWSGI 而不能使用额外的应用程序,例如 NGINX。

现在,如果我能让 https 部分正常工作,我会很满足。

我尝试了来自 uwsgi 站点的代码(稍作修改):http://uwsgi-docs.readthedocs.io/en/latest/HTTPS.html。但它不起作用。

[uwsgi]
master = true

socket = 127.0.0.1:9000
shared-socket = 0.0.0.0:443
https = =0,foo.crt,foo.key,HIGH

module=project.wsgi:application

enable-threads = true
vacuum = true
die-on-term = true

从浏览器,我得到了网站无法访问 我将证书 "foo.crt" 和 "foo.key" 放在与上面和下面代码的配置文件相同的文件夹中。该证书是自签名证书。

我也试过下面的代码,但只适用于 http 而不是 https:

[uwsgi]
;master process with 5 workers.
master = true
processes = 5

http = :80
https = :443,foo.crt,foo.key

buffer-size = 32768

module=project.wsgi:application

enable-threads = true
vacuum = true
die-on-term = true

如果您知道如何使此 HTTPS 正常工作,那就太棒了。 更好的是,如果它还包括 http 重定向到 https。

提前致谢。

让这个适用于 https。

就像奥列格说的,我很怀念=0

[uwsgi]
;master process with 5 workers.
master = true
processes = 5

shared-socket = 0.0.0.0:443
https =  =0,foo.crt,foo.key,HIGH

module=project.wsgi:application

enable-threads = true
vacuum = true
die-on-term = true