Spaces:
Sleeping
Sleeping
File size: 1,296 Bytes
aec7019 1199a79 aec7019 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Node-RED 最新实时快照;必须放在通用 /api 代理之前
location = /api/realtime {
proxy_pass http://nodered:1880/api/realtime;
proxy_set_header Host $host;
add_header Cache-Control "no-store";
}
# 优化后端 API(同源 /api → backend 容器)
location /api/ {
proxy_pass http://backend:8077;
proxy_set_header Host $host;
}
# Node-RED 实时数据 WebSocket(同源 /ws → nodered 容器)
location /ws/ {
proxy_pass http://nodered:1880;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
# 展示页不缓存(改动即时生效);js 长缓存
location = /index.html { add_header Cache-Control "no-store"; }
location = /config.html { add_header Cache-Control "no-store"; }
location = /home.html { add_header Cache-Control "no-store"; }
location = / { try_files /home.html =404; add_header Cache-Control "no-store"; }
location ~* \.js$ { add_header Cache-Control "public, max-age=86400"; }
location / { try_files $uri $uri/ /index.html; }
}
|