diff --git a/infra/docker/nginx.conf b/infra/docker/nginx.conf old mode 100644 new mode 100755 index ea1c9587c..cd44ef4f7 --- a/infra/docker/nginx.conf +++ b/infra/docker/nginx.conf @@ -18,12 +18,19 @@ server { } # API proxy + # Use static proxy_pass with container name to avoid URI stripping issues + # that occur with variable-based proxy_pass (set $upstream ...). + # DNS resolver kept for container IP refresh on restart. + resolver 127.0.0.11 valid=10s; + resolver_timeout 5s; location /api/ { - proxy_pass http://api:8000/api/; + proxy_pass http://xiaoxia-api-staging:8000/api/; 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_read_timeout 300s; + proxy_send_timeout 300s; proxy_request_buffering off; } diff --git a/infra/docker/web.Dockerfile b/infra/docker/web.Dockerfile old mode 100644 new mode 100755 index 85c26776f..debf6aff9 --- a/infra/docker/web.Dockerfile +++ b/infra/docker/web.Dockerfile @@ -12,8 +12,9 @@ RUN npm run build # Production stage with nginx FROM docker.m.daocloud.io/library/nginx:alpine AS runner +ARG NGINX_CONF=infra/docker/nginx.conf WORKDIR /usr/share/nginx/html COPY --from=builder /app/apps/web/dist ./ -COPY infra/docker/nginx.conf /etc/nginx/conf.d/default.conf +COPY ${NGINX_CONF} /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]