nginx_site: Add load balance method config option

This commit is contained in:
Timo Makinen 2024-12-07 15:24:41 +00:00
parent 11ddc0397a
commit 6e72234b1d

View file

@ -1,13 +1,16 @@
{% if nginx_site_proxy is defined and nginx_site_proxy is not string %}
upstream {{ nginx_site_name }} {
{% for item in nginx_site_proxy %}
{% set item = item | regex_replace("^(https://)?([^/]*).*$", "\\2") %}
{% if item | regex_search(".*:[0-9]+$") %}
{% if nginx_site_load_balance_method is defined %}
{{ nginx_site_load_balance_method }};
{% endif %}
{% for item in nginx_site_proxy %}
{% set item = item | regex_replace("^(https://)?([^/]*).*$", "\\2") %}
{% if item | regex_search(".*:[0-9]+$") %}
server {{ item }};
{% else %}
{% else %}
server {{ item }}:443;
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
}
{% endif %}
server {