如何使用SSL支持构建uWSGI以使用websocket握手API函数? [英] how to build uWSGI with SSL support to use the websocket handshake API function?

查看:332
本文介绍了如何使用SSL支持构建uWSGI以使用websocket握手API函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我所拥有的: Ubuntu 14.4 使用nginx作为反向代理的烧瓶(python)运行的uwsgi.

What I have: ubuntu 14.4 uwsgi running with flask (python) with nginx as reverse proxy.

我想要的东西: 运行以下WebSockets示例: https://github.com/zeekay/flask -uwsgi-websocket/blob/master/examples/echo/echo.py

What I want: running this example of WebSockets: https://github.com/zeekay/flask-uwsgi-websocket/blob/master/examples/echo/echo.py

当我在端口5000上使用chromepy运行此应用程序时,它运行正常,但是当我尝试不使用chromepy运行时,出现错误

When I'm running this application with chromepy on port 5000, it is working fine but when I try to run without chromepy I get an error

错误:

Thu Jun 12 12:58:24 2014 - you need to build uWSGI with SSL support to use the websocket handshake api function !!!
Traceback (most recent call last):
  File "/home/lab_alglab/rep/car/local/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/lab_alglab/rep/car/local/lib/python2.7/site-packages/flask_uwsgi_websocket/websocket.py", line 54, in __call__
    uwsgi.websocket_handshake(environ['HTTP_SEC_WEBSOCKET_KEY'], environ.get('HTTP_ORIGIN', ''))
IOError: unable to complete websocket handshake

推荐答案

我必须通过brew安装OpenSSL.然后运行此命令.

I had to install OpenSSL via brew. Then run this command.

CFLAGS="-I/usr/local/opt/openssl/include" LDFLAGS="-L/usr/local/opt/openssl/lib" UWSGI_PROFILE_OVERRIDE=ssl=true pip install uwsgi -Iv

这篇关于如何使用SSL支持构建uWSGI以使用websocket握手API函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆