Files
athq-vm-management/templates/nginx_stream_block.conf.j2

45 lines
1.3 KiB
Django/Jinja

server {
# {{ comment }}
{% if port_interfaces %}
{% if "ipv4-all" in port_interfaces %}
listen {{ portstring }} {% if udp %} udp {% endif %}{% if ssl %} ssl {% endif %};
{% endif %}
{% if "ipv6-all" in port_interfaces %}
listen [::]:{{ portstring }} {% if udp %} udp {% endif %}{% if ssl %} ssl {% endif %};
{% endif %}
{% for pi in port_interfaces %}
{% if not pi.startswith("ipv") %}
listen {{ pi }}:{{ portstring }} {% if udp %} udp {% endif %}{% if ssl %} ssl {% endif %};
{% endif %}
{% endfor %}
{% else %}
listen {{ portstring }} {% if udp %} udp {% endif %}{% if ssl %} ssl {% endif %};
listen [::]:{{ portstring }} {% if udp %} udp {% endif %}{% if ssl %} ssl {% endif %};
{% endif %}
{% if not extra_content or not "proxy_timeout" in extra_content %}
proxy_timeout {{ proxy_timeout }};
proxy_responses 1;
{% endif %}
{% if targetportoverwrite %}
proxy_pass {{ targetip }}:{{ targetportoverwrite }};
{% else %}
proxy_pass {{ targetip }}:$server_port;
{% endif %}
{% if extra_content %}
{{ extra_content }}
{% endif %}
{% if transparent %}
proxy_bind $remote_addr:{% if targetportoverwrite %}{{ targetportoverwrite }}{% else %}$remote_port{% endif %} transparent;
{% endif %}
}