From e6c21af933779f261f02c6c2e96b3c1930ded590 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Wed, 13 Nov 2019 08:48:17 -0700 Subject: [PATCH] fix multiple server name issue --- ab-nginx.params.template | 2 +- ab-nginx.sh | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ab-nginx.params.template b/ab-nginx.params.template index 8933ffc..4e85b32 100644 --- a/ab-nginx.params.template +++ b/ab-nginx.params.template @@ -22,7 +22,7 @@ TZ=Area/Location # delimited and "enclosed in quotes". # This is NOT required if you are supplying your own server blocks via # 'SERVERS_DIR' -SERVER_NAMES="domain.tld www.domain.tld server.domain.tld alt.domain.tld" +HOSTNAMES="domain.tld www.domain.tld server.domain.tld alt.domain.tld" # Ports to expose on the HOST machine (container ALWAYS internally uses 80/443): # If you need to use ports other than HTTP=80 and HTTPS=443, remember to set up diff --git a/ab-nginx.sh b/ab-nginx.sh index d90fa6c..61ce45a 100755 --- a/ab-nginx.sh +++ b/ab-nginx.sh @@ -176,6 +176,7 @@ if [ -z "$SSL_CERT" ]; then printf "${cyan}\nRunning SHELL on %s...${norm}\n" "$container_name" docker run --rm -it --name ${container_name} \ --env-file ab-nginx.params \ + -e SERVER_NAMES="$HOSTNAMES" \ $vmount \ -p ${HTTP_PORT}:80 \ docker.asifbacchus.app/nginx/ab-nginx:latest /bin/sh @@ -184,6 +185,7 @@ if [ -z "$SSL_CERT" ]; then printf "${cyan}\nRunning NGINX on %s...${norm}\n" "$container_name" docker run -d --name ${container_name} \ --env-file ab-nginx.params \ + -e SERVER_NAMES="$HOSTNAMES" \ $vmount \ -p ${HTTP_PORT}:80 \ --restart unless-stopped \ @@ -196,6 +198,7 @@ elif [ "$SSL_CERT" ] && [ "$TLS13_ONLY" = FALSE ]; then printf "${cyan}\nRunning SHELL on %s (TLS 1.2)...${norm}\n" "$container_name" docker run --rm -it --name ${container_name} \ --env-file ab-nginx.params \ + -e SERVER_NAMES="$HOSTNAMES" \ $vmount \ -v "$SSL_CERT":/certs/fullchain.pem:ro \ -v "$SSL_KEY":/certs/privkey.pem:ro \ @@ -208,6 +211,7 @@ elif [ "$SSL_CERT" ] && [ "$TLS13_ONLY" = FALSE ]; then printf "${cyan}\nRunning NGINX on %s (TLS 1.2)...${norm}\n" "$container_name" docker run -d --name ${container_name} \ --env-file ab-nginx.params \ + -e SERVER_NAMES="$HOSTNAMES" \ $vmount \ -v "$SSL_CERT":/certs/fullchain.pem:ro \ -v "$SSL_KEY":/certs/privkey.pem:ro \ @@ -224,6 +228,7 @@ elif [ "$SSL_CERT" ] && [ "$TLS13_ONLY" = TRUE ]; then printf "${cyan}\nRunning SHELL on %s (TLS 1.3)...${norm}\n" "$container_name" docker run --rm -it --name ${container_name} \ --env-file ab-nginx.params \ + -e SERVER_NAMES="$HOSTNAMES" \ $vmount \ -v "$SSL_CERT":/certs/fullchain.pem:ro \ -v "$SSL_KEY":/certs/privkey.pem:ro \ @@ -235,6 +240,7 @@ elif [ "$SSL_CERT" ] && [ "$TLS13_ONLY" = TRUE ]; then printf "${cyan}\nRunning NGINX on %s (TLS 1.3)...${norm}\n" "$container_name" docker run -d --name ${container_name} \ --env-file ab-nginx.params \ + -e SERVER_NAMES="$HOSTNAMES" \ $vmount \ -v "$SSL_CERT":/certs/fullchain.pem:ro \ -v "$SSL_KEY":/certs/privkey.pem:ro \