From 804f07612da26e21ad7c8929431923a426ee7a6e Mon Sep 17 00:00:00 2001 From: Alireza David Date: Fri, 28 Oct 2016 12:53:17 +0330 Subject: [PATCH 1/3] add keepalive to upstream directive (hard code in template) --- nginx.tmpl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nginx.tmpl b/nginx.tmpl index 9eb9520..bf92ff0 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -47,7 +47,7 @@ proxy_http_version 1.1; proxy_buffering off; proxy_set_header Host $http_host; proxy_set_header Upgrade $http_upgrade; -proxy_set_header Connection $proxy_connection; +proxy_set_header Connection ""; 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 $proxy_x_forwarded_proto; @@ -101,6 +101,8 @@ upstream {{ $host }} { {{ end }} {{ end }} {{ end }} + + keepalive 10; } {{ $default_host := or ($.Env.DEFAULT_HOST) "" }} From d14f52c1724c966cdec927e5b6baeb0a3e90832f Mon Sep 17 00:00:00 2001 From: Alireza David Date: Fri, 28 Oct 2016 13:00:25 +0330 Subject: [PATCH 2/3] Add global upstream template support --- nginx.tmpl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nginx.tmpl b/nginx.tmpl index bf92ff0..38d3904 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -102,7 +102,9 @@ upstream {{ $host }} { {{ end }} {{ end }} - keepalive 10; + {{ if (exists "/etc/nginx/upstream/default") }} + include /etc/nginx/upstream/default; + {{ end }} } {{ $default_host := or ($.Env.DEFAULT_HOST) "" }} From 12242c61196e25161cd94a7d7d3659e043c05b3c Mon Sep 17 00:00:00 2001 From: Alireza David Date: Fri, 28 Oct 2016 14:40:55 +0330 Subject: [PATCH 3/3] update for connection header --- nginx.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx.tmpl b/nginx.tmpl index 38d3904..0bad994 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -47,7 +47,7 @@ proxy_http_version 1.1; proxy_buffering off; proxy_set_header Host $http_host; proxy_set_header Upgrade $http_upgrade; -proxy_set_header Connection ""; +proxy_set_header Connection $proxy_connection; 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 $proxy_x_forwarded_proto;