61 lines
1.4 KiB
Plaintext
61 lines
1.4 KiB
Plaintext
# MemoryWeave (织忆) Nginx 反向代理配置
|
||
# 位置: /etc/nginx/sites-enabled/zhiyi.conf
|
||
# 端口: 7821 → 对外
|
||
|
||
upstream zhiyid {
|
||
# 主力机 primary
|
||
server 127.0.0.1:7821 max_fails=3 fail_timeout=30s;
|
||
|
||
# 局域网 replica(可选)
|
||
# server 192.168.123.x:7821 backup;
|
||
}
|
||
|
||
server {
|
||
listen 7821;
|
||
server_name localhost;
|
||
|
||
# 请求体大小限制 (batch-commit)
|
||
client_max_body_size 10M;
|
||
|
||
# 超时
|
||
proxy_read_timeout 300s; # 深度整合可能超过默认 60s
|
||
proxy_connect_timeout 10s;
|
||
proxy_send_timeout 60s;
|
||
|
||
# WebSocket 支持
|
||
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_set_header X-Forwarded-Proto $scheme;
|
||
|
||
# 健康检查
|
||
location /health {
|
||
proxy_pass http://zhiyid/health;
|
||
access_log off;
|
||
}
|
||
|
||
# Admin 健康检查(含依赖检测)
|
||
location /health/full {
|
||
proxy_pass http://zhiyid/health/full;
|
||
access_log off;
|
||
}
|
||
|
||
# API
|
||
location /api/ {
|
||
proxy_pass http://zhiyid;
|
||
}
|
||
|
||
# Prometheus metrics (internal only)
|
||
location /metrics {
|
||
allow 127.0.0.1;
|
||
allow 192.168.0.0/16;
|
||
deny all;
|
||
proxy_pass http://zhiyid/metrics;
|
||
}
|
||
}
|