diff options
author | Paweł Dybiec <pawel.to.malpa@gmail.com> | 2019-05-25 14:43:15 +0200 |
---|---|---|
committer | Paweł Dybiec <pawel.to.malpa@gmail.com> | 2019-05-25 14:44:50 +0200 |
commit | 5f7875d5b4f6d82d8692c52194727e2f2c0745b7 (patch) | |
tree | 83aee15f86bff23f6a8185a184053930a4b63d52 /templates/nginx.conf.j2 | |
parent | Enable http2 (diff) |
Added suport for proxy caching
Diffstat (limited to 'templates/nginx.conf.j2')
-rw-r--r-- | templates/nginx.conf.j2 | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/templates/nginx.conf.j2 b/templates/nginx.conf.j2 index 73ce07c..7220a38 100644 --- a/templates/nginx.conf.j2 +++ b/templates/nginx.conf.j2 @@ -6,6 +6,9 @@ server { } {% endif %} +{% if server.proxy is defined and server.proxy.cache is defined and server.proxy.cache %} + proxy_cache_path /usr/share/nginx/cache levels=1:2 keys_zone=cache_{{ short_name }}:10m max_size=100m inactive=60m use_temp_path=off; +{% endif %} server { {% if server.http_redirect is not defined or not server.http_redirect %} @@ -34,7 +37,17 @@ server { proxy_set_header Connection "Upgrade"; {% endif %} -{% if server.client_body_size is defined%} +{% if server.proxy is defined %} +{% if server.proxy.cache is defined and server.proxy.cache %} + proxy_cache cache_{{ short_name }}; + proxy_cache_revalidate on; +{% endif %} +{% if server.proxy.cache_when_origin_down is defined and server.proxy.cache_when_origin_down %} + proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504; +{% endif %} +{% endif %} + +{% if server.client_body_size is defined %} client_max_body_size {{ server.client_body_size }}; {% endif %} {% endif %} |