适用于https

时间:2018-08-28 17:19:03

标签: https uwsgi systemd

uWSGI支持套接字激活(来自systemd),但是我只能使它适用于http,不适用于https连接。

  • 不带套接字激活功能的https
    • shared-socket =:443
    • https-socket = = 0,/ etc / ssl / certs / mycert_chained-certificate.crt,/ etc / ssl / private / mycert_privatekey.pem
  • 似乎systemd提供的套接字被用作http-socket, 不作为共享套接字。因此,https-socket = = 0没什么可绑定的。
  • 由于systemd的文件描述符始终为3,因此我试图强制 共享套接字到3。在未套接字激活的情况下,systemd单元中的以下命令有效,但在套接字激活时仍尝试绑定到http-socket
  

ExecStart = / bin / bash -c'/ usr / bin / uwsgi_psgi --shared-socket $(/ usr / bin / test -n“ $ LISTEN_FDS” && / bin / echo“ fd:// 3” | | / bin / echo“ 0.0.0.0:443”)--ini /etc/uwsgi.ini'

  • 查看uwsgi的源代码,我在 core / setup_utils.c 中发现,绑定到systemd套接字的代码被char包围* listen_pid = getenv(“ LISTEN_PID”); if(listen_pid){...}。因此,我尝试取消设置LISTEN_PID以防止uWSGI将http-socket绑定到文件描述符3。但是现在uWSGI将shared-socket绑定到随机端口号(并且不起作用)。
  

ExecStart = / bin / bash -c'LISTEN_PID = / usr / bin / uwsgi_psgi --shared-socket $(/ usr / bin / test -n“ $ LISTEN_FDS” && / bin / echo“ fd:// 3 “ || / bin / echo” 0.0.0.0:443“)--ini /etc/uwsgi.ini'

还有其他想法吗?任何提示都非常感谢。

0 个答案:

没有答案