server { listen 80; server_name localhost; client_max_body_size 100M; location / { if ($request_filename ~* .*\.(?:htm|html)$) { add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate"; } root /usr/share/nginx/html; index index.html index.htm; try_files $uri $uri/ /index.html; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # api 代理配置 location /api/ { # host 配置, 若api 依赖 host 解析,请手动修改指定 # 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_http_version 1.1; # proxy_set_header Connection ""; # # proxy address proxy_pass http://api:8086; } }