问题原文
原帖链接 · k0pernikus · CC BY-SA 3.0
On a local development machine, I have a nginx reverse proxy like so:
server {
listen 80;
server_name myvirtualhost1.local;
location / {
proxy_pass http://127.0.0.1:8080;
}
server {
listen 80;
server_name myvirtualhost2.local;
location / {
proxy_pass http://127.0.0.1:9090;
}
Yet if I debug my application, the response may be delayed for an infinite amount of time, yet after 30 seconds I get:
504 Gateway Time-out
as a response.
How can I disable the timeout and have my reverse proxy wait forever for a response? And I like the setting to be global, so that I do not have to set it for each proxy.
社区高分解答
原帖链接 · Vasantha Ganesh · CC BY-SA 4.0
It is possible to increase the timeout for nginx, to add to @k0pernikus 's answer, the following can be added to your location block:
location /xyz {
proxy_read_timeout 1800;
proxy_connect_timeout 1800;
proxy_send_timeout 1800;
send_timeout 1800;
}
Here 1800 is in seconds.
After changing the config, verify the syntax with:
nginx -t -c /some/path/nginx.conf
Then reload nginx with:
nginx -s reload
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
