From c35ac601667b6d9feca854a3ecb4e5200e84dcb6 Mon Sep 17 00:00:00 2001 From: Ryan Faircloth Date: Mon, 15 Jan 2018 13:50:35 +0000 Subject: [PATCH] Fixes #141 adding template support and readme example --- README.md | 9 +++++++++ templates/vhost.j2 | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/README.md b/README.md index 04223bf..2394608 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,15 @@ A list of vhost definitions (server blocks) for Nginx virtual hosts. Each entry state: "present" template: "{{ nginx_vhost_template }}" filename: "example.com.conf" + location: + - name: /proxyme + extra_parameters: | + proxy_pass_request_headers on; + proxy_set_header x-real-IP $remote_addr; + proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; + proxy_set_header host $host; + proxy_pass https://127.0.0.1:8000; + extra_parameters: | location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; diff --git a/templates/vhost.j2 b/templates/vhost.j2 index 0feb602..c4650fb 100644 --- a/templates/vhost.j2 +++ b/templates/vhost.j2 @@ -24,6 +24,17 @@ server { index {{ item.index | default('index.html index.htm') }}; +{% if item.location is defined %} + {% for loc in item.location -%} + location {{ loc.name }} { + {{ loc.extra_parameters|indent(8) }} + } + + {%- endfor %} +{% endif %} + + + {% if item.error_page is defined %} error_page {{ item.error_page }}; {% endif %}