Configure keep-alive for EC2 instance

Viewed 10378

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?

2 Answers

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.

sendfile            on;
tcp_nopush          on;
tcp_nodelay         on;
**keepalive_timeout   65;**
types_hash_max_size 2048;
Related