Files
rag/deploy/nginx.conf
lacerate551 100d1a06eb init: RAG 知识库服务初始提交
- 后端 API(Flask + Gunicorn)
- RAG 引擎(混合检索 + 云端 Reranker + 引用溯源)
- 文档解析(MinerU + 多格式支持)
- Docker 生产部署配置
- 排除前端项目、敏感配置、模型文件
2026-06-04 17:35:27 +08:00

61 lines
1.6 KiB
Nginx Configuration File
Raw Permalink 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.conf - RAG服务反向代理配置
upstream rag_backend {
# 负载均衡策略least_conn最少连接
least_conn;
# 多个RAG服务实例可选用于高可用
server rag-service-1:5001 max_fails=3 fail_timeout=30s;
# server rag-service-2:5001 max_fails=3 fail_timeout=30s;
# server rag-service-3:5001 max_fails=3 fail_timeout=30s;
}
server {
listen 80;
server_name rag.example.com;
# 请求体大小限制(文档上传)
client_max_body_size 100M;
# 超时配置RAG问答可能较慢
proxy_connect_timeout 120s;
proxy_send_timeout 120s;
proxy_read_timeout 120s;
# RAG服务代理
location / {
proxy_pass http://rag_backend;
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_set_header X-Forwarded-Proto $scheme;
# SSE流式响应支持
proxy_buffering off;
proxy_cache off;
proxy_http_version 1.1;
chunked_transfer_encoding on;
}
# 健康检查
location /health {
proxy_pass http://rag_backend/health;
access_log off;
}
# 请求限流(防止滥用)
limit_req_zone $binary_remote_addr zone=rag_limit:10m rate=10r/s;
limit_req zone=rag_limit burst=20 nodelay;
}
# HTTPS配置推荐
server {
listen 443 ssl http2;
server_name rag.example.com;
ssl_certificate /etc/nginx/ssl/cert.pem;
ssl_certificate_key /etc/nginx/ssl/key.pem;
# 其他配置同上...
}