【问题标题】:uWSGI configuration to use HTTPSuWSGI 配置以使用 HTTPS
【发布时间】:2016-12-16 11:57:07
【问题描述】:

我需要 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。

提前致谢。

【问题讨论】:

标签: linux web-services python-3.x https uwsgi


【解决方案1】:

让它适用于 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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-02-17
    • 1970-01-01
    • 2014-12-17
    • 1970-01-01
    • 2016-10-13
    • 2015-10-22
    • 2016-05-01
    • 1970-01-01
    相关资源
    最近更新 更多