【问题标题】:uWSGI as HTTP server: in config.ini option is called `http-socket`, not `http`uWSGI 作为 HTTP 服务器:在 config.ini 选项中称为 `http-socket`,而不是 `http`
【发布时间】:2016-04-07 10:52:53
【问题描述】:

我正在尝试将 uWSGI 用作独立的 http 服务器,而不是 uwsgi 服务器。

这里是我的配置文件mysite.ini:

[uwsgi]
chdir = /srv/workflows
module = workflows.wsgi:application
plugin = python

# We can receive connections either via http or from frontend via uwsgi socket

# http:
http = 0.0.0.0:8000

# uwsgi:
#socket = 0.0.0.0:8000
#chmod-socket = 664

vacuum = true
master = true
need-app = true
processes = 10
harakiri  = 20
max-requests = 5000

所以,我使用了 http 选项并注释掉了 socketchmod-socket 选项。

作为对 uWSGI 诅咒的回应:

uWSGI: --s/--socket option is missing and stdin is not a socket.

我是否理解正确,如果我指定socket 选项,uWSGI 期望连接实现 WSGI 协议?如果我指定http 选项,它期望连接是http,在这种情况下我不应该指定socket 选项。

【问题讨论】:

    标签: django wsgi uwsgi


    【解决方案1】:

    对我来说,HTTP 工作正常,而不是用于 TCP 连接的套接字

    示例:http = 127.0.0.1:8080

    【讨论】:

      【解决方案2】:

      尝试使用 http-socket 而不是 http

      【讨论】:

      • 谢谢你,jonatron。你是对的。不过,我也取消了 plugin=python 字符串的注释 - 它也是 http 所必需的(我想这是合乎逻辑的,uWSGI 本身通过 WSGI 与 python 应用程序对话)。
      【解决方案3】:

      如果你想在网络中使用http,官方文档建议使用http 用于公共服务器,http-socket 用于Nginx 或Apache 之后的Web 服务器。

      https://uwsgi-docs.readthedocs.io/en/latest/ThingsToKnow.html

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-09-16
        • 2018-07-06
        • 1970-01-01
        • 2016-05-25
        • 1970-01-01
        • 1970-01-01
        • 2014-09-22
        • 1970-01-01
        相关资源
        最近更新 更多