【curl检查测试nginx支持websocket是否配置成功】

curl --no-buffer -is -H 'Connection: keep-alive, Upgrade' -H 'Upgrade: websocket' -v -H 'Sec-WebSocket-Version: 13' -H 'Sec-WebSocket-Key: websocket' -H 'Host:xxxx.aaa.com' http://10.0.2.64:19303/websocket ws | od -t c

结果:
* Connected to 10.0.2.64 (10.0.2.64) port 19303 (#0)
> GET /websocket HTTP/1.1
> Host:xxxx.aa.com
> User-Agent: curl/7.79.1
> Accept: */*
> Connection: keep-alive, Upgrade
> Upgrade: websocket
> Sec-WebSocket-Version: 13
> Sec-WebSocket-Key: websocket
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 101
< Upgrade: websocket
< Connection: upgrade
< Sec-WebSocket-Accept: qVby4apnn2tTYtB1nPPVYUn68gY=
< Date: Fri, 16 Sep 2022 02:22:09 GMT
<
{ [707 bytes data]

当看到返回的101 就说明nginx代理websocket配置正常确了; 
注意若看到仍然是200 就是未成功开启; 

你可能感兴趣的:(unix&linux,websocket,网络协议,网络)