server { listen 80; server_name _; # 用户端前端 location / { root /usr/share/nginx/user; index index.html; try_files $uri $uri/ /index.html; } # 管理后台前端 location /admin/ { root /usr/share/nginx; try_files $uri $uri/ /admin/index.html; add_header Cache-Control "no-cache, no-store, must-revalidate"; } # 后端 API(含 OAuth 回调) location /api/ { proxy_pass http://backend:8010; 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://backend:8010; proxy_set_header Host $host; } }