微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

NGINX 502中的Http请求超时2分钟Node应用程序中的坏的网关

在这个超时问题上一直在挠头,希望能得到一些帮助。 我有一个可能需要2.5分钟才能返回响应的http请求。 我有3分钟的Angular超时处理,3分钟的NodeJS。 我的Nginx设置有200秒超时,我的Elastic Load Balancing Connection Timeout设置为4分钟。 但是,我一直在2分钟内看到502坏的网关Nginx 1.4.6(Ubuntu)的错误。 有没有我想念的部分有更长的超时时间?

我的Nginx设置:

server { listen 80; server_name; access_log /var/log/Nginx/access.log; error_log /var/log/Nginx/error.log debug; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-Nginx-Proxy true; proxy_set_header Connection ""; proxy_http_version 1.1; proxy_pass http://localhost:8060; proxy_redirect off; proxy_connect_timeout 200s; proxy_send_timeout 200s; proxy_read_timeout 200s; send_timeout 200s; } #Handle protected assets using 'internal' directive documented here: https://www.Nginx.com/resources/wiki/start/topics/examples/x-accel/ location /protected { internal; expires -1; } }

我的NodeJS设置正在使用连接超时

var timeout = require('connect-timeout'); app.use(timeout(300000));

Gunicorn工作者超时

超时或closures时,处理完成

如何设置程序超时?

Gitlab超时/初始页面加载缓慢

SSH在短时间后超时? ClientAlive&ConnectTimeout似乎没有做我需要他们做的事情

如何禁用或更改在Linux下的GPU的超时限制?

在cloudflare上运行一个长的PHP脚本给了我一个超时(使用Nginx

如果Nginx发送了499错误,请求是否“丢失”?

如何增加页面超时以防止504错误

AWS上的504(网关超时)

我刚刚遇到了这个,可能找到了答案 – 节点的http模块中有120秒的硬编码超时。 我不得不在给定的请求处理程序中设置套接字超时:

yourHandler(req,res) { req.socket.setTimeout(3600e3); // 1 hour // ... do the real work res.json(...); }

您也可以将此限制设置为0以禁用此超时。

https://nodejs.org/api/net.html#net_socket_settimeout_timeout_callback

最初找到答案在这里: https : //forum.Nginx.org/read.PHP?2,214230,214239#msg-214239

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐