add support for defining multiple upstream servers for proxy sites
This commit is contained in:
parent
11e4a82a35
commit
b533542b57
1 changed files with 11 additions and 1 deletions
|
@ -1,4 +1,10 @@
|
||||||
|
{% if proxy is defined and proxy is not string %}
|
||||||
|
upstream upstream_{{ site }} {
|
||||||
|
{% for item in proxy %}
|
||||||
|
server {{ item }}:443;
|
||||||
|
{% endfor %}
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
server {
|
server {
|
||||||
listen 443 ssl;
|
listen 443 ssl;
|
||||||
listen [::]:443 ssl;
|
listen [::]:443 ssl;
|
||||||
|
@ -11,7 +17,11 @@ server {
|
||||||
return 301 {{ redirect }};
|
return 301 {{ redirect }};
|
||||||
{% elif proxy is defined %}
|
{% elif proxy is defined %}
|
||||||
location / {
|
location / {
|
||||||
|
{% if proxy is not string %}
|
||||||
|
proxy_pass https://upstream_{{ site }};
|
||||||
|
{% else %}
|
||||||
proxy_pass {{ proxy }};
|
proxy_pass {{ proxy }};
|
||||||
|
{% endif %}
|
||||||
proxy_ssl_certificate {{ tls_certs }}/{{ inventory_hostname }}.crt;
|
proxy_ssl_certificate {{ tls_certs }}/{{ inventory_hostname }}.crt;
|
||||||
proxy_ssl_certificate_key {{ tls_private }}/{{ inventory_hostname }}.key;
|
proxy_ssl_certificate_key {{ tls_private }}/{{ inventory_hostname }}.key;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue