proxy_read_timeout 600;
proxy_buffers 8 16k; proxy_buffer_size 32k;
const server = app.listen(port, () => {
server.timeout = 120000; // 设置超时时间为2分钟
console.log(Listening on: http://localhost:${port}
);
});
upstream backend { server 127.0.0.1:3000; keepalive 32; }
location / { proxy_pass http://backend; proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; proxy_connect_timeout 5s; // 连接超时时间 proxy_read_timeout 10s; // 读取超时时间 }