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 %}