本文介绍了AWS Elastic BeansTalk Nginx超时504错误的网关-Java Servlet AsyncContext的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功运行了Java servlet应用程序的测试,该应用程序在Amazon AWS Elastic BeansTalk提供的基本示例应用程序上运行.Java-Gradle-Jetty平台.现在,无论我做什么,都无法使servlet与客户端保持50秒以上的连接时间.我尝试过的东西.Nginx的proxy_read_timeout有效!proxy_send_timeout不起作用.负载均衡器空闲超时有效.keepalive_timeout不起作用.

I have successfully ran tests of a java servlet app that runs on the base sample app provided by Amazon AWS Elastic BeansTalk. Java-Gradle-Jetty Platform.Now I can't achieve to keep the servlet connected more than 50 seconds with the client no matter what I do.Things I tried.Nginxproxy_read_timeout works!proxy_send_timeout doesn't work.Load Balancer Idle Timeout Does work..keepalive_timeout doesn't work.

我已经尝试过这些设置和更多设置,所以我变得很熟悉,可以将超时限制或增加到50秒.通过,我收到504 Bad Gateway错误,这意味着连接已关闭.我还在Nginx服务器的error.log中得到此错误.{sometime} [错误] 23115#0:* 2上游超时(110:连接超时),同时从上游读取响应标头,客户端:{Some IP},服务器:,请求:"GET/{some path} HTTP/1.1",上游:" http://127.0.0.1:5000/publish ",主机:"{Some Load Balancer URL} .us-west-1.elb.amazonaws.com"

I have played around with these and a few more settings so I'm getting familiar and can restrict or bump the time outs but only to 50 seconds. Passed that I get a 504 Bad Gateway error which means connection was closed.I also get this error in the error.log for the nginx server.{sometime} [error] 23115#0: *2 upstream timed out (110: Connection timed out) while reading response header from upstream, client: {Some IP}, server: , request: "GET /{some path} HTTP/1.1", upstream: "http://127.0.0.1:5000/publish", host: "{Some Load Balancer URL}.us-west-1.elb.amazonaws.com"

我已经度过了几个不眠之夜,能为您提供任何帮助.

Any help will be appreciated I've spent a few sleepless nights now.

推荐答案

它最终是需要在位置部分下的nginx配置文件上传递的两个属性.

it ended up being two properties that needed to be passed on the nginx configuration file under the location section.

代理发送超时和proxy_read_timeout

proxy_send_timeoutandproxy_read_timeout

只需将它们设置为与ELB(负载平衡器)超时结合使用的所需时间(以秒为单位).

just set them to whatever time you wanna have in seconds in combination with the ELB (Load Balancer) timeout.

希望它对某人有用.

这篇关于AWS Elastic BeansTalk Nginx超时504错误的网关-Java Servlet AsyncContext的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-28 05:42