From 45b749af83b6d11e96c05a02c1de804a29833849 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Mon, 8 Dec 2014 22:07:57 -0600 Subject: [PATCH] Issue #5: Add 'nginx_proxy_cache_path' configuration option. --- README.md | 4 ++++ defaults/main.yml | 1 + templates/nginx.conf.j2 | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/README.md b/README.md index 5ba9ece..97ccdd1 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,10 @@ This value determines the largest file upload possible, as uploads are passed th The keepalive timeout. Should be set higher (10s+) if you have more polling-style traffic (AJAX-powered sites especially), or lower (<10s) if you have a site where most users visit a few pages and don't send any further requests. + nginx_proxy_cache_path: "" + +Set as the `proxy_cache_path` directive in the `nginx.conf` file. By default, this will not be configured (if left as an empty string), but if you wish to use Nginx as a reverse proxy, you can set this to a valid value (e.g. `"/var/cache/nginx keys_zone=cache:32m"`) to use Nginx's cache (further proxy configuration can be done in individual server configurations). + ## Dependencies None. diff --git a/defaults/main.yml b/defaults/main.yml index 1b4b0bb..203357d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -6,3 +6,4 @@ nginx_client_max_body_size: "64m" nginx_keepalive_timeout: "65" nginx_remove_default_vhost: false nginx_default_vhost_path: /etc/nginx/sites-enabled/default +nginx_proxy_cache_path: "" diff --git a/templates/nginx.conf.j2 b/templates/nginx.conf.j2 index ae453fd..51407c9 100644 --- a/templates/nginx.conf.j2 +++ b/templates/nginx.conf.j2 @@ -30,5 +30,9 @@ http { #gzip on; +{% if nginx_proxy_cache_path %} + proxy_cache_path {{ nginx_proxy_cache_path }}; +{% endif %} + include /etc/nginx/conf.d/*.conf; }