server { listen 80; server_name localhost; # 鍓嶇闈欐€佹枃浠? root /usr/share/nginx/html; index index.html; # gzip 鍘嬬缉 gzip on; gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; # 鍓嶇璺敱锛圫PA锛? location / { try_files $uri $uri/ /index.html; } # API 浠g悊 location /api/ { proxy_pass http://baodan-api:5001/; 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; } # Insurance API 浠g悊 location /insurance/ { proxy_pass http://baodan-api:5001/insurance/; 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; } # Insurance SSE 娴佸紡鎺ュ彛锛堝璇濓級 location /insurance/chat/message { proxy_pass http://baodan-api:5001/insurance/chat/message; 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_set_header Connection ''; proxy_http_version 1.1; chunked_transfer_encoding off; proxy_buffering off; proxy_cache off; proxy_read_timeout 300s; proxy_send_timeout 300s; } # 鍋ュ悍妫€鏌? location /health { proxy_pass http://baodan-api:5001/health; } # 闈欐€佽祫婧愮紦瀛? location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ { expires 1y; add_header Cache-Control "public, immutable"; } }