100 行
2.9 KiB
Plaintext
100 行
2.9 KiB
Plaintext
|
|
server {
|
|||
|
|
listen 80;
|
|||
|
|
server_name _;
|
|||
|
|
|
|||
|
|
charset utf-8;
|
|||
|
|
client_max_body_size 100m;
|
|||
|
|
|
|||
|
|
# 健康检查(宿主机 nginx 探活用)
|
|||
|
|
location /health {
|
|||
|
|
return 200 "ok\n";
|
|||
|
|
add_header Content-Type text/plain;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# 版本管理 — 必须在通用 /api/ 之前
|
|||
|
|
location /api/v1/updates/ {
|
|||
|
|
proxy_pass http://update-service:8084/api/v1/updates/;
|
|||
|
|
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 60s;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
location /api/v1/rn/ {
|
|||
|
|
proxy_pass http://update-service:8084/api/v1/rn/;
|
|||
|
|
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 120s;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# IM HTTP — 必须在通用 /api/ 之前
|
|||
|
|
location /api/im/ {
|
|||
|
|
proxy_pass http://im-service:8082/api/im/;
|
|||
|
|
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 60s;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# IM WebSocket
|
|||
|
|
location /ws/im {
|
|||
|
|
proxy_pass http://im-service:8082/ws/im;
|
|||
|
|
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_read_timeout 3600s;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# License — 必须在通用 /api/ 之前
|
|||
|
|
location /api/license/ {
|
|||
|
|
proxy_pass http://license-service:8085/api/license/;
|
|||
|
|
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 60s;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# 文件上传下载
|
|||
|
|
location /file/ {
|
|||
|
|
proxy_pass http://file-service:8086/file/;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|||
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|||
|
|
client_max_body_size 500m;
|
|||
|
|
proxy_read_timeout 300s;
|
|||
|
|
proxy_send_timeout 300s;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# 核心 API(兜底,在所有具体 /api/xxx/ 之后)
|
|||
|
|
location /api/ {
|
|||
|
|
proxy_pass http://tenant-service:9001/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_read_timeout 60s;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
location /actuator/ {
|
|||
|
|
proxy_pass http://tenant-service:9001/actuator/;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# 运营后台
|
|||
|
|
location /ops {
|
|||
|
|
proxy_pass http://ops-web:80;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# 控制台前端(兜底路由,必须最后)
|
|||
|
|
location / {
|
|||
|
|
proxy_pass http://tenant-web:80;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|||
|
|
}
|
|||
|
|
}
|