89 lines
2.2 KiB
Nginx Configuration File
89 lines
2.2 KiB
Nginx Configuration File
# Nginx 反向代理配置
|
|
# 西安云美电子科技有限公司 - 企业知识库
|
|
|
|
upstream dify_api {
|
|
server api:5001;
|
|
}
|
|
|
|
upstream dify_web {
|
|
server web:3000;
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
# 请求体大小限制(文件上传)
|
|
client_max_body_size 50M;
|
|
|
|
# API 请求
|
|
location /console/api {
|
|
proxy_pass http://dify_api;
|
|
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;
|
|
|
|
# WebSocket 支持
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
}
|
|
|
|
location /v1 {
|
|
proxy_pass http://dify_api;
|
|
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_read_timeout 300s;
|
|
}
|
|
|
|
# 静态资源
|
|
location /files {
|
|
proxy_pass http://dify_api;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
}
|
|
|
|
location /elegant {
|
|
proxy_pass http://dify_api;
|
|
proxy_set_header Host $host;
|
|
}
|
|
|
|
# Web 前端
|
|
location / {
|
|
proxy_pass http://dify_web;
|
|
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;
|
|
}
|
|
}
|
|
|
|
# HTTPS 配置(取消注释并配置 SSL 证书后启用)
|
|
# server {
|
|
# listen 443 ssl;
|
|
# server_name kb.xayunmei.com;
|
|
#
|
|
# ssl_certificate /etc/nginx/ssl/server.crt;
|
|
# ssl_certificate_key /etc/nginx/ssl/server.key;
|
|
# ssl_protocols TLSv1.2 TLSv1.3;
|
|
# ssl_ciphers HIGH:!aNULL:!MD5;
|
|
#
|
|
# client_max_body_size 50M;
|
|
#
|
|
# # 同上 location 配置...
|
|
# }
|
|
|
|
# HTTP → HTTPS 重定向(启用 HTTPS 后取消注释)
|
|
# server {
|
|
# listen 80;
|
|
# server_name kb.xayunmei.com;
|
|
# return 301 https://$server_name$request_uri;
|
|
# }
|