AWS EC2 Django Deployment — Getting 504 Gateway Timeout (Gunicorn worker timeout & SIGKILL) #180606
Replies: 3 comments
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Why are you starting this discussion?
Question
What GitHub Actions topic or product is this about?
Workflow Deployment
Discussion Details
🚨 AWS EC2 Django Deployment — Getting 504 Gateway Timeout (Gunicorn worker timeout & SIGKILL)
Hi everyone,
I deployed my Django application on AWS EC2 (t3.micro) using Nginx + Gunicorn.
The deployment completes successfully, but when I open my website, I get:
504 Gateway Timeout
I checked my server logs and found these repeated errors:
Gunicorn worker timeouts
Workers getting SIGKILL
“worker failed to boot” messages
Requests taking too long (60s, 120s, even more)
Nginx logs showing unreadable / binary request garbage (likely bot traffic)
From logs, it looks like:
Gunicorn workers are timing out
Or system is running out of memory (1GB RAM on t3.micro)
After timeout, workers crash → Load Balancer gets no response → 504
My Setup:
AWS EC2 t3.micro
Ubuntu 22.04
Django + Gunicorn + Nginx
Postgres RDS
No Redis / Celery yet
Gunicorn is running via systemd
What I need help with:
How to properly configure Gunicorn for a t3.micro instance?
How to avoid worker timeout / SIGKILL?
Should I reduce workers or increase timeout?
Should I upgrade the instance or add SWAP?
Any recommended production config for low-memory servers?
Any guidance or working configs will be very helpful.
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions