2021-09-18 00:04:05 -05:00
|
|
|
{% for server in ingress_servers %}
|
|
|
|
server {
|
|
|
|
{% if loop.index == 1 %}
|
|
|
|
listen {{ ingress_listen_args }} default_server;
|
|
|
|
{% else %}
|
2021-09-18 07:46:00 -05:00
|
|
|
listen {{ ingress_listen_args }};
|
2021-09-18 00:04:05 -05:00
|
|
|
{% endif %}
|
|
|
|
server_name {{ server.name }};
|
|
|
|
|
2022-01-13 13:19:06 -06:00
|
|
|
{% if ingress_directives is defined %}
|
|
|
|
{% for directive in ingress_directives %}
|
|
|
|
{{ directive }};
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
|
2021-09-18 07:13:33 -05:00
|
|
|
{% if ingress_listen_tls %}
|
2021-09-18 00:04:05 -05:00
|
|
|
# TLS configuration
|
|
|
|
ssl_certificate /etc/letsencrypt/live/{{ ingress_servers[0].name }}/fullchain.pem;
|
|
|
|
ssl_certificate_key /etc/letsencrypt/live/{{ ingress_servers[0].name }}/privkey.pem;
|
|
|
|
ssl_trusted_certificate /etc/letsencrypt/live/{{ ingress_servers[0].name }}/chain.pem;
|
|
|
|
ssl_dhparam /etc/letsencrypt/dhparams/dhparam.pem;
|
2021-09-18 07:43:45 -05:00
|
|
|
ssl_stapling on;
|
|
|
|
ssl_stapling_verify on;
|
|
|
|
ssl_protocols {{ ingress_tls_protocols }};
|
|
|
|
ssl_ciphers {{ ingress_tls_ciphers }};
|
|
|
|
ssl_prefer_server_ciphers {{ ingress_tls_prefer_server_ciphers }};
|
2021-09-18 07:13:33 -05:00
|
|
|
{% endif %}
|
2021-09-18 00:04:05 -05:00
|
|
|
|
|
|
|
{% if server.directives is defined %}
|
|
|
|
# Extra directives
|
|
|
|
{% for directive in server.directives %}
|
|
|
|
{{ directive }};
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
|
2022-08-30 16:11:52 -05:00
|
|
|
{% if server.locations is defined %}
|
|
|
|
# Extra manually-defined locations
|
|
|
|
{% for location in server.locations %}
|
|
|
|
location {{ location.location }} {
|
|
|
|
{{ location.contents }}
|
|
|
|
}
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
|
2021-09-18 07:19:26 -05:00
|
|
|
{% if server.proxy_pass is defined %}
|
|
|
|
# Singular proxy_pass
|
|
|
|
location / {
|
2022-09-03 17:53:54 -05:00
|
|
|
proxy_buffer_size 128k;
|
|
|
|
proxy_buffers 4 256k;
|
|
|
|
proxy_busy_buffers_size 256k;
|
2021-09-18 07:19:26 -05:00
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
2022-09-03 17:27:35 -05:00
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
2021-09-18 07:19:26 -05:00
|
|
|
proxy_pass {{ server.proxy_pass }};
|
|
|
|
}
|
|
|
|
{% elif server.proxies is defined %}
|
2021-09-18 00:04:05 -05:00
|
|
|
# Proxy locations
|
|
|
|
{% for proxy in server.proxies %}
|
|
|
|
location {{ proxy.location }} {
|
2022-09-03 17:53:54 -05:00
|
|
|
proxy_buffer_size 128k;
|
|
|
|
proxy_buffers 4 256k;
|
|
|
|
proxy_busy_buffers_size 256k;
|
2021-09-18 00:04:05 -05:00
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
2022-09-03 17:27:35 -05:00
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
2021-09-18 00:04:05 -05:00
|
|
|
proxy_pass {{ proxy.pass }};
|
|
|
|
}
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
|
2021-09-18 07:43:45 -05:00
|
|
|
resolver {{ ingress_resolver }};
|
2021-09-18 00:04:05 -05:00
|
|
|
}
|
|
|
|
{% endfor %}
|