keepalive ignored for some upstreams

fguerraz nginx-forum at
Mon Dec 5 19:40:02 UTC 2016


I use an nginix server with multiple servers each with a matching upstream.
They are all in individual files in sites-enabled (ubuntu server).

Here is an example of such a config file:
upstream {
        keepalive 65;

server {
        listen 12908;

        resolver x.y.z.a x.y.z.b;


        access_log /var/log/nginx/transparent_proxy-access.log combined;
        error_log /var/log/nginx/transparent_proxy-error.log;

        location = /health {
                return 200;
                access_log off;

        location / {
                proxy_pass http://$http_host$request_uri;
                proxy_pass_request_headers      on;
                proxy_read_timeout 65;
                proxy_connect_timeout 65;
                proxy_http_version 1.1;
                proxy_set_header Connection "";

for this particular "server", if I set debug in the error_log, I never see
"init keepalive peer" or anything of sort indicating that keepalive is being
taken into account and I *do* see that on other "servers". The other
configuration files for different servers only differ by server_name, server
and upstream names and by which port they use, the config files are
auto-generated so I am confident that this is the only difference.
I have used tcpdump to check what nginx was doing and it's closing the
connection after each response from the upstream server.

Do you see any reason why keepalive would be ignored for this configuration?
The only difference with the others that work being that it uses a non
standard port.

nginx version: nginx/1.10.0 (Ubuntu), I also tried the latest development

Best regards,


Posted at Nginx Forum:,271359,271359#msg-271359

More information about the nginx mailing list