'commit'
This commit is contained in:
30
dsLightRag/Doc/13、在Nginx中发布Websocket的方法.txt
Normal file
30
dsLightRag/Doc/13、在Nginx中发布Websocket的方法.txt
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# Nginx配置文件修改
|
||||||
|
location /api/xueban/streaming-chat {
|
||||||
|
proxy_pass http://10.10.21.20:8200/api/xueban/streaming-chat;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_read_timeout 86400s; # 添加长连接超时设置
|
||||||
|
proxy_send_timeout 86400s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 测试配置是否正确
|
||||||
|
nginx -t
|
||||||
|
|
||||||
|
# 重新加载配置
|
||||||
|
nginx -s reload
|
||||||
|
|
||||||
|
# ### 验证方法:
|
||||||
|
使用wscat测试连接(需先安装Node.js):
|
||||||
|
|
||||||
|
wscat -c ws://10.10.21.20:8300/api/xueban/streaming-chat
|
||||||
|
|
||||||
|
返回结果:
|
||||||
|
D:\nginx>wscat -c ws://10.10.21.20:8300/api/xueban/streaming-chat
|
||||||
|
Connected (press CTRL+C to quit)
|
||||||
|
>
|
Reference in New Issue
Block a user