Files
xiaoxia-saas/infra/docker/nginx-staging.conf
T
xiaoxia a5f1d9685d
Deploy / Staging E2E Tests (push) Has been skipped
Deploy / Build Production Runtime Images (push) Has been skipped
Deploy / Deploy Production (push) Has been skipped
Deploy / Production Browser E2E (push) Has been skipped
Deploy / Deploy Staging (push) Failing after 141h44m9s
CI/CD Pipeline / Frontend Lint (push) Failing after 141h44m18s
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 141h44m18s
refactor(phase3): Docker 网络隔离 staging/production 环境
- compose.yml: 网络名根据 ENV 变量区分 (xiaoxia-net-staging/xiaoxia-net-production)
- infra-production.yml: 使用 xiaoxia-net-production 网络
- infra.yml: 使用 xiaoxia-net-staging 网络
- 新增 nginx-staging.conf (proxy_pass -> xiaoxia-api-staging:8000)
- 新增 nginx-production.conf (proxy_pass -> xiaoxia-api-production:8000)
- nginx.conf 更新为 production 默认配置
- web-artifact.Dockerfile: 添加 ARG NGINX_CONF 支持构建时选择 nginx 配置
- deploy-staging.sh: 添加 ENV=staging、网络创建、nginx 配置选择
- deploy-production.sh: 添加 ENV=production、网络创建
- deploy.yml: CI 构建传入 NGINX_CONF 参数、远程部署脚本添加网络创建
- deploy.yml: 冒烟测试添加网络隔离验证
2026-07-03 15:09:54 +08:00

46 lines
1.2 KiB
Plaintext

server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Gzip compression
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_types text/plain text/css text/xml text/javascript application/javascript application/json application/xml+rss;
client_max_body_size 800m;
# SPA routing - all routes to index.html
location / {
try_files $uri $uri/ /index.html;
}
# API proxy
# Staging environment: proxy to staging API container on isolated network
resolver 127.0.0.11 valid=10s;
resolver_timeout 5s;
location /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;
}
# Generated files proxy
location /generated-files/ {
alias /app/generated/;
}
# Cache static assets
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
}