init: RAG 知识库服务初始提交
- 后端 API(Flask + Gunicorn) - RAG 引擎(混合检索 + 云端 Reranker + 引用溯源) - 文档解析(MinerU + 多格式支持) - Docker 生产部署配置 - 排除前端项目、敏感配置、模型文件
This commit is contained in:
60
deploy/nginx.conf
Normal file
60
deploy/nginx.conf
Normal file
@@ -0,0 +1,60 @@
|
||||
# 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;
|
||||
|
||||
# 其他配置同上...
|
||||
}
|
||||
Reference in New Issue
Block a user