server { listen 80; listen [::]:80; server_name localhost; # ABM 项目根目录 root /usr/share/nginx/html; index index.html index.htm; # ABM 主路径 - 重写 /ABM 到根目录 location /ABM/ { rewrite ^/ABM/(.*)$ /$1 break; try_files $uri $uri/ /index.html; # 静态资源缓存 expires 1d; add_header Cache-Control "public, max-age=86400"; } # 处理 /ABM 不带斜杠的情况 location = /ABM { return 301 /ABM/; } # 健康检查端点 location /health { access_log off; return 200 "healthy\n"; add_header Content-Type text/plain; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } }