如何构建支持 SSL 的 uWSGI 以使用 websocket 握手 API 功能? [英] how to build uWSGI with SSL support to use the websocket handshake API function?
问题描述
我所拥有的:Ubuntu 14.4uwsgi 与flask (python) 一起运行,nginx 作为反向代理.
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屋!