server {
    listen 8383;
    server_name _;

    # 前端静态文件
    root /app/SmyWorkCollect-Frontend/build;
    index index.html;

    # 尽量命中静态资源
    location / {
        try_files $uri $uri/ /index.html;
    }

    # 反向代理到 Flask 后端
    location /api/ {
        proxy_pass http://127.0.0.1:5000;
        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;

        # 大文件与超时
        client_max_body_size 5000M;
        proxy_connect_timeout 600;
        proxy_send_timeout 600;
        proxy_read_timeout 600;
        send_timeout 600;
    }

    error_page 500 502 503 504 /50x.html;
    location = /50x.html { root /usr/share/nginx/html; }
}
