diff --git a/Production/docker-compose.btc-ltc-clightning.yml b/Production/docker-compose.btc-ltc-clightning.yml index 7ca69b4..c971aa7 100644 --- a/Production/docker-compose.btc-ltc-clightning.yml +++ b/Production/docker-compose.btc-ltc-clightning.yml @@ -61,6 +61,7 @@ services: VIRTUAL_NETWORK: nginx-proxy VIRTUAL_PORT: 49392 VIRTUAL_HOST: ${BTCPAY_HOST} + VIRTUAL_HOST_NAME: "btcpay" SSL_POLICY: Mozilla-Modern LETSENCRYPT_HOST: ${BTCPAY_HOST} LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL:-} diff --git a/Production/docker-compose.btc-ltc.yml b/Production/docker-compose.btc-ltc.yml index 6adaa2d..4f9f64a 100644 --- a/Production/docker-compose.btc-ltc.yml +++ b/Production/docker-compose.btc-ltc.yml @@ -61,6 +61,7 @@ services: VIRTUAL_NETWORK: nginx-proxy VIRTUAL_PORT: 49392 VIRTUAL_HOST: ${BTCPAY_HOST} + VIRTUAL_HOST_NAME: "btcpay" SSL_POLICY: Mozilla-Modern LETSENCRYPT_HOST: ${BTCPAY_HOST} LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL:-} diff --git a/Production/docker-compose.btc.yml b/Production/docker-compose.btc.yml index 3d569ac..051d25d 100644 --- a/Production/docker-compose.btc.yml +++ b/Production/docker-compose.btc.yml @@ -60,6 +60,7 @@ services: VIRTUAL_NETWORK: nginx-proxy VIRTUAL_PORT: 49392 VIRTUAL_HOST: ${BTCPAY_HOST} + VIRTUAL_HOST_NAME: "btcpay" SSL_POLICY: Mozilla-Modern LETSENCRYPT_HOST: ${BTCPAY_HOST} LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL:-} diff --git a/Production/nginx.tmpl b/Production/nginx.tmpl index 01ba8f0..7b7d88a 100644 --- a/Production/nginx.tmpl +++ b/Production/nginx.tmpl @@ -183,13 +183,11 @@ server { } {{ end }} -{{ range $host, $containers := groupByMulti $ "Env.VIRTUAL_HOST" "," }} +{{ range $host_name, $containers := groupByMulti $ "Env.VIRTUAL_HOST_NAME" "," }} -{{ $host := trim $host }} -{{ $is_regexp := hasPrefix "~" $host }} -{{ $upstream_name := when $is_regexp (sha1 $host) $host }} +{{ $host_name := trim $host_name }} +{{ $upstream_name := $host_name }} -# {{ $host }} upstream {{ $upstream_name }} { {{ range $container := $containers }} @@ -218,15 +216,14 @@ upstream {{ $upstream_name }} { {{ end }} {{ end }} } - +{{ range $host, $containers := groupByMulti $containers "Env.VIRTUAL_HOST" "," }} +{{ $host := trim $host }} {{ $default_host := or ($.Env.DEFAULT_HOST) "" }} {{ $default_server := index (dict $host "" $default_host "default_server") $host }} {{/* Get the VIRTUAL_PROTO defined by containers w/ the same vhost, falling back to "http" */}} {{ $proto := trim (or (first (groupByKeys $containers "Env.VIRTUAL_PROTO")) "http") }} -{{ $host_name := trim (or (first (groupByKeys $containers "Env.VIRTUAL_HOST_NAME")) "") }} - {{/* Get the NETWORK_ACCESS defined by containers w/ the same vhost, falling back to "external" */}} {{ $network_tag := or (first (groupByKeys $containers "Env.NETWORK_ACCESS")) "external" }} @@ -430,3 +427,4 @@ server { {{ end }} {{ end }} +{{ end }} \ No newline at end of file