diff --git a/nginx.conf.template b/nginx.conf.template index eaa4008..1f4218f 100644 --- a/nginx.conf.template +++ b/nginx.conf.template @@ -1,17 +1,30 @@ -events {} +worker_processes 1; + +events { + worker_connections 1024; +} http { - upstream backend { + include /etc/nginx/mime.types; + + upstream django_servers { ${BACKEND_SERVERS} } server { - listen 80; - + listen ${LISTEN_PORT:-8080}; + + # Proxy requests to Django backend location / { - proxy_pass http://backend; + proxy_pass http://django_servers; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + # Handle timeouts + proxy_connect_timeout 60; + proxy_read_timeout 60; } } } \ No newline at end of file