server {
  listen 80;
  client_max_body_size 10G;

  # gzip 压缩
  gzip on;
  gzip_vary on;
  gzip_min_length 1024;
  gzip_proxied any;
  gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml;

  # 所有非 /api 请求全部代理给 frontend 容器
  location / {
    proxy_pass http://frontend:80;
  }

  # 所有 /api 请求代理给 backend 容器
  location /api/ {
    proxy_pass http://backend:8483;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
  }

  location /static/ {
    proxy_pass http://backend:8483/static/;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    expires 7d;
    add_header Cache-Control "public, immutable";
  }
}
