Download deploy/scripts/nginx_geoevents.conf from eduzrh/helloworld: direct link, hf CLI and curl.
- Browser
- Download file 4.88 kB
-
https://huggingface.co/datasets/eduzrh/helloworld/resolve/main/deploy/scripts/nginx_geoevents.conf
- Command line
-
hf download hf://datasets/eduzrh/helloworld/deploy/scripts/nginx_geoevents.conf
-
curl -L -o nginx_geoevents.conf https://huggingface.co/datasets/eduzrh/helloworld/resolve/main/deploy/scripts/nginx_geoevents.conf
4.88 kB
| proxy_cache_path /data/cache/tiles levels=1:2 keys_zone=gibs:64m max_size=3g | |
| inactive=30d use_temp_path=off; | |
| # 全球极端事件平台 | |
| # / Shadowbroker(Next.js,根路径,预构建镜像无法改 basePath) | |
| # /cdhe/ 自建 CDHE 四态看板(静态) | |
| # /wm/ worldmonitor(静态构建,若可用) | |
| upstream shadowbroker_fe { server 127.0.0.1:3000; keepalive 16; } | |
| upstream shadowbroker_be { server 127.0.0.1:8000; keepalive 16; } | |
| server { | |
| listen 80 default_server; | |
| listen [::]:80 default_server; | |
| server_name _; | |
| charset utf-8; | |
| client_max_body_size 64m; | |
| access_log /data/logs/nginx.access.log; | |
| error_log /data/logs/nginx.error.log warn; | |
| gzip on; | |
| gzip_comp_level 5; | |
| gzip_types text/plain text/css application/json application/javascript application/wasm image/svg+xml; | |
| gzip_min_length 1024; | |
| # ---------- NASA GIBS 卫星底图(本机缓存,避免每次回源) ---------- | |
| location ^~ /tiles/gibs/ { | |
| proxy_pass https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/; | |
| proxy_ssl_server_name on; | |
| proxy_set_header Host gibs.earthdata.nasa.gov; | |
| proxy_set_header User-Agent "GeoEvents/1.0"; | |
| proxy_cache gibs; | |
| proxy_cache_key "$uri"; | |
| proxy_cache_valid 200 30d; | |
| proxy_ignore_headers Cache-Control Expires Set-Cookie; | |
| proxy_cache_use_stale error timeout updating; | |
| proxy_cache_lock on; | |
| add_header X-Cache $upstream_cache_status; | |
| expires 7d; | |
| } | |
| # ---------- 自建 CDHE 看板 ---------- | |
| # alias + try_files 在 nginx 1.18 下会回落到 index,故只用 alias | |
| location ^~ /cdhe/ { | |
| alias /data/apps/cdhe/www/; | |
| index index.html; | |
| autoindex off; | |
| expires 1h; | |
| add_header Cache-Control "public"; | |
| } | |
| location = /cdhe { | |
| return 301 /cdhe/; | |
| } | |
| # ---------- 版本别名(v1 多源 / v2 图层库 / v3 气候 / v4 地球) ---------- | |
| location = /v1 { return 302 /; } | |
| location = /v2 { return 302 /wm/; } | |
| location = /v3 { return 302 /cdhe/; } | |
| location = /v4 { return 302 /globe/; } | |
| # ---------- 全球视角 3D 地球(MapLibre globe,静态) ---------- | |
| location ^~ /globe/ { | |
| alias /data/apps/globe/; | |
| index index.html; | |
| autoindex off; | |
| expires 5m; | |
| add_header Cache-Control "public"; | |
| } | |
| location = /globe { | |
| return 301 /globe/; | |
| } | |
| # ---------- worldmonitor 的绝对路径静态资源 ---------- | |
| # 前端有若干 fetch('/data/...') 写死绝对路径,base=/wm/ 时打不到,这里补一条映射 | |
| location ^~ /data/ { | |
| proxy_pass http://127.0.0.1:3001/wm/data/; | |
| proxy_http_version 1.1; | |
| proxy_set_header Host 127.0.0.1:3001; | |
| proxy_read_timeout 120s; | |
| } | |
| # ---------- 中文入口页 ---------- | |
| location ^~ /portal/ { | |
| alias /data/apps/portal/; | |
| index index.html; | |
| autoindex off; | |
| } | |
| location = /portal { | |
| return 301 /portal/; | |
| } | |
| # ---------- worldmonitor(vite 开发服务器,base=/wm/) ---------- | |
| location ^~ /wm/ { | |
| proxy_pass http://127.0.0.1:3001; | |
| proxy_http_version 1.1; | |
| proxy_set_header Upgrade $http_upgrade; | |
| proxy_set_header Connection "upgrade"; | |
| # Vite 的 host 校验只认 localhost/127.0.0.1,这里强制改写,否则公网访问 403 | |
| proxy_set_header Host 127.0.0.1:3001; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| proxy_read_timeout 600s; | |
| proxy_buffering off; | |
| } | |
| # ---------- Shadowbroker 后端 API(显式前缀,便于单独排查) ---------- | |
| location /sbapi/ { | |
| proxy_pass http://shadowbroker_be/; | |
| proxy_http_version 1.1; | |
| 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; | |
| proxy_read_timeout 300s; | |
| proxy_buffering off; | |
| } | |
| # ---------- Shadowbroker 前端(根路径) ---------- | |
| location / { | |
| proxy_pass http://shadowbroker_fe; | |
| 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; | |
| proxy_read_timeout 600s; | |
| proxy_send_timeout 600s; | |
| proxy_buffering off; | |
| proxy_cache_bypass $http_upgrade; | |
| } | |
| location = /healthz { | |
| access_log off; | |
| default_type text/plain; | |
| return 200 "ok\n"; | |
| } | |
| } | |