Files
dsProject/dsLightRag/Doc/13、在Nginx中发布Websocket的方法.txt
2025-09-01 06:58:07 +08:00

31 lines
922 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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)
>