2
如何配置nginx(最新版本,他们说它支持websockets)来支持WebSockets。nginx + python + websockets
如何使用python运行websockets连接。
这就是我想要的:
- 客户端用JavaScript创建的WebSocket;
- websocket服务器脚本在python上运行;
- 和nginx在所有这一切的后端。
身体能帮助我吗?
如何配置nginx(最新版本,他们说它支持websockets)来支持WebSockets。nginx + python + websockets
如何使用python运行websockets连接。
这就是我想要的:
身体能帮助我吗?
我快速浏览了Nginx的相关changeset,看起来您开始处理websocket请求所需要做的就是在您的nginx配置中设置一个代理。因此,例如:
upstream pythonserver {
server localhost:5000;
}
server {
// normal server config stuff...
location /some/uri/here {
// Minimum required settings to proxy websocket connections
proxy_pass http://pythonserver;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
// Other settings for this location
}
}
这个小配置片段将代理传入的WebSocket流量到您的Python应用程序服务器,在本例中假设为监听本地连接端口5000
希望这有助于。
谢谢,非常有用。根据'/ some/uri/here','http:// pythonserver',它应该如何查看客户端和python服务器脚本? – 2013-04-05 14:31:52