events { worker_connections 1024; } http { access_log off; error_log /dev/null crit; upstream backend_pool { least_conn; server api1:9999; server api2:9999; server api3:9999; keepalive 32; } server { listen 9999 default_server; location / { proxy_pass http://backend_pool; proxy_http_version 1.1; proxy_set_header Connection ""; proxy_buffering off; proxy_cache off; proxy_store off; proxy_connect_timeout 1s; proxy_send_timeout 5s; proxy_read_timeout 5s; proxy_next_upstream error timeout invalid_header http_500 http_502 http_503; } } }