Use variables for proxy_pass

Use variables for proxy_pass directive in order to prevent startup failure if the upstream host is down.
This commit is contained in:
Charles Wilkinson 2023-03-19 19:26:26 +00:00
parent 82d9452001
commit 7eff7a5436

View File

@ -3,6 +3,8 @@
# ------------------------------------------------------------
{% if enabled %}
set $forwarding_host {{ forwarding_host }};
set $forwarding_port {{ forwarding_port }};
{% if tcp_forwarding == 1 or tcp_forwarding == true -%}
server {
listen {{ incoming_port }};
@ -12,7 +14,7 @@ server {
#listen [::]:{{ incoming_port }};
{% endif %}
proxy_pass {{ forwarding_host }}:{{ forwarding_port }};
proxy_pass $forwarding_host:$forwarding_port;
# Custom
include /data/nginx/custom/server_stream[.]conf;
@ -27,7 +29,7 @@ server {
{% else -%}
#listen [::]:{{ incoming_port }} udp;
{% endif %}
proxy_pass {{ forwarding_host }}:{{ forwarding_port }};
proxy_pass $forwarding_host:$forwarding_port;
# Custom
include /data/nginx/custom/server_stream[.]conf;