Reputation: 39859
I'm trying to increase the timeout on Amazon Elastic Beanstalk but I still get a 504 Gateway timeout.
Here's what I've done so far:
.ebextensions/timeouts.config:
option_settings:
- namespace: aws:elb:policies
option_name: ConnectionSettingIdleTimeout
value: 940
- namespace: aws:elbv2:loadbalancer
option_name: IdleTimeout
value: 940
files:
"/etc/nginx/conf.d/nginx.timeouts.conf":
mode: "644"
owner: "root"
group: "root"
content: |
client_header_timeout 5;
client_body_timeout 10;
send_timeout 940;
proxy_connect_timeout 2;
proxy_read_timeout 940;
proxy_send_timeout 10;
container_commands:
01_update_nginx:
command: "sudo sed -i 's/keepalive_timeout 65;/keepalive_timeout 940;/g' /etc/nginx/nginx.conf"
02_restart_nginx:
command: "sudo service nginx restart"
Procfile:
web: gunicorn --bind :8000 --workers 10 --timeout 935 --graceful-timeout 935 main:app
Despite this, I still get a "504 Gateway Time-out" after exactly 60.1 seconds.
What am I missing that should make it work?
Upvotes: 3
Views: 5175
Reputation: 49
Just to post something slightly more updated; https://stackoverflow.com/a/63772786's answer worked for me.
The big "aha!" was creating a .platform/nginx/conf.d/nginx.custom.conf
file with the contents. Laid out.
You can run nginx -T
to ensure the file contents were adopted by nginx.
I also kept an .ebextension file with:
option_settings:
- namespace: aws:elbv2:loadbalancer
option_name: IdleTimeout
value: 180
container_commands:
01_restart_nginx:
command: "sudo service nginx reload"
Upvotes: 0
Reputation: 238051
Your /etc/nginx/conf.d/nginx.timeouts.conf
does not work because this is a valid file for EB platforms based on Amazon Linux 1 (AL1). However, it as confirmed in the comments, you are using AL2.
For AL2, the nginx settings should be in .platform/nginx/conf.d/
, not in .ebextentions
as shown in the docs in the "Reverse proxy configuration" section.
Therefore, you could try creating the following .platform/nginx/conf.d/myconfig.conf
file with the content of:
client_header_timeout 5;
client_body_timeout 10;
send_timeout 940;
proxy_connect_timeout 2;
proxy_read_timeout 940;
proxy_send_timeout 10;
Upvotes: 8