worker_processes auto; events { worker_connections 4096; } http { access_log off; sendfile on; tcp_nopush on; upstream backend { server api:8080 max_fails=2 fail_timeout=10s; ${KEEPALIVE_DIRECTIVE} } server { listen 80; server_name _; proxy_connect_timeout 5s; proxy_send_timeout 30s; proxy_read_timeout 30s; proxy_next_upstream error timeout http_502 http_503 http_504; proxy_next_upstream_tries 2; proxy_next_upstream_timeout 10s; location / { proxy_pass http://backend; 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; ${PROXY_HTTP_VERSION_DIRECTIVE} ${PROXY_CONNECTION_DIRECTIVE} } } }