proxy_pass http://backend; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade;
据说1.3以后就支持了 不需要编译那个tcp 模块了
firebug会看到状态是
101 Switching Protocols
本文详细介绍如何在Nginx中正确配置WebSocket,包括使用proxy_pass指令指向后端服务器,设置HTTP版本为1.1,以及正确设置Upgrade和Connection头以确保与WebSocket客户端的连接升级。自Nginx 1.3版本起,无需额外编译TCP模块即可支持WebSocket,通过实例展示如何让firebug显示正确的101 Switching Protocols状态。
proxy_pass http://backend; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade;
据说1.3以后就支持了 不需要编译那个tcp 模块了
firebug会看到状态是
101 Switching Protocols
转载于:https://www.cnblogs.com/vaal-water/p/3169827.html

被折叠的 条评论
为什么被折叠?