about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPaweł Dybiec <pawel.to.malpa@gmail.com>2019-06-10 23:01:46 +0200
committerPaweł Dybiec <pawel.to.malpa@gmail.com>2019-06-10 23:01:46 +0200
commit0d4f884c46a2e8219ed08173989b7cb9bbca7b41 (patch)
treeb5a41c53a084564b3c83cdb454316053ade35b93
parentAdd error page (diff)
Add parameters for proxy keepalive and timeouts
-rw-r--r--domains.yml4
-rw-r--r--templates/nginx.conf.j26
2 files changed, 10 insertions, 0 deletions
diff --git a/domains.yml b/domains.yml
index 0d4c928..ad12623 100644
--- a/domains.yml
+++ b/domains.yml
@@ -30,6 +30,8 @@ domains:
     client_body_size: 200M
     proxy:
       host: "10.10.1.4"
+      keepalive: true
+      timeout: 10s
   octoprint2:
     name: "octoprint2.dybiec.info"
     http_redirect: true
@@ -37,3 +39,5 @@ domains:
     client_body_size: 200M
     proxy:
       host: "10.10.1.5"
+      keepalive: true
+      timeout: 10s
diff --git a/templates/nginx.conf.j2 b/templates/nginx.conf.j2
index b8896b7..9261fa0 100644
--- a/templates/nginx.conf.j2
+++ b/templates/nginx.conf.j2
@@ -38,6 +38,12 @@ server {
 {% endif %}
 
 {% if server.proxy is defined %}
+{% if server.proxy.keepalive is defined and server.proxy.keepalive %}
+    proxy_socket_keepalive on;
+{% endif %}
+{% if server.proxy.timeout is defined %}
+    proxy_connect_timeout {{ server.proxy.timeout }};
+{% endif %}
 {% if server.proxy.cache is defined and server.proxy.cache %}
    proxy_cache cache_{{ short_name }};
    proxy_cache_revalidate on;