Reputation: 3219
I have a Django app running on a python instance with Nginx as the webserver.
I'm getting a 60 second timeout for one of my operations. According to the docs, you want to increase the load balancer's idle timeout above the default 60 seconds (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/application-load-balancers.html)
It also says:
we recommend that you enable the HTTP keep-alive option for your EC2 instances. You can enable HTTP keep-alive in the web server settings for your EC2 instances
Well I'm not sure how to do this or where that setting is. Can anyone point me to where the keep-alive
option is?
Upvotes: 12
Views: 17912
Reputation: 21
If you're using load balancer, check if the keep-alive timeout setting on your EC2 instances is greater than the idle timeout setting of the load balancer.
Upvotes: 1
Reputation: 768
I have had the same problem several times for months: “504 Gateway Timeout: The gateway did not receive a timely response from the upstream server or application.” Yeah, ideally maybe no request should take more than 60 seconds but sometimes we need it. Here are what I did:
The previous answers gave me clues for finding the answer and here is my solution:
Upvotes: 2
Reputation: 11
for apache2 cd /etc/apache2/ vi apache2.conf find out keep alive option there
Upvotes: 1
Reputation: 11
sendfile on;
tcp_nopush on;
tcp_nodelay on;
**keepalive_timeout 65;**
types_hash_max_size 2048;
Upvotes: 1
Reputation: 307
I'm running into the same issue now and have come to the conclusion that it's just a poorly worded bit of docco and as Mark B suggests in his comment, it's referring to setting the Keep-Alive header from your nginx/apache webserver config rather than on the ec2 instance itself.
Upvotes: 5