diff --git a/templates/etc/nginx/sites-available/vhost.j2 b/templates/etc/nginx/sites-available/vhost.j2 index 67b288f..0089a57 100644 --- a/templates/etc/nginx/sites-available/vhost.j2 +++ b/templates/etc/nginx/sites-available/vhost.j2 @@ -7,9 +7,9 @@ upstream {{ item.upstream.name }} { server {{ upserver }}; {% endfor %} } - {% endif %} {% for server in item.servers %} + server { listen {{ server.port }}{{ ' ssl' if server.tls is defined and server.tls else '' }}; server_name {{ server.server_name }}; @@ -36,14 +36,15 @@ server { {% endif %} {% if location.index is defined and location.index %} index {{ location.index }}; + {% endif %} {% if location.proxy_pass is defined and location.proxy_pass %} - - proxy_pass {{ location.proxy_pass }} + proxy_pass {{ location.proxy_pass }}; {% if location.proxy_http_version is defined and location.proxy_http_version %} proxy_http_version {{ location.proxy_http_version }}; {% endif %} {% for pheader in location.proxy_headers | default([]) %} + proxy_set_header {{ pheader }}; {% endfor %} {% endif %} @@ -57,5 +58,4 @@ server { } {% endif %} } - {% endfor %}