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