← Back to Blog
Docker + Nginx + Django: Production Deployment in 2024
# Docker + Nginx + Django: Production Deployment in 2024
I deploy every client Django project with this exact stack. It's battle-tested across 20+ production apps.
## Docker Compose Stack
```yaml
services:
web:
build: .
command: gunicorn config.wsgi:application --bind 0.0.0.0:8000 --workers 4
depends_on:
- db
- redis
nginx:
image: nginx:alpine
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
```
## Nginx Config
```nginx
upstream django {
server web:8000;
}
server {
listen 80;
server_name example.com;
location /static/ { alias /app/staticfiles/; }
location /media/ { alias /app/media/; }
location / {
proxy_pass http://django;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
```
This setup handles 10,000+ concurrent users on a $20/month VPS.