From 326c28899d9c321899de163c45e0a93a59d4eefe Mon Sep 17 00:00:00 2001 From: Marc Carmier Date: Sat, 13 Feb 2016 23:15:41 +0100 Subject: [PATCH] Limit the list page to the URL from INDEX_HOST variable --- nginx.tmpl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/nginx.tmpl b/nginx.tmpl index 08a947d..87df405 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -55,17 +55,37 @@ server { server_name _; # This is just an invalid value which will never trigger on a real hostname. listen 80; access_log /var/log/nginx/access.log vhost; + return 503; +} + +{{ if $.Env.INDEX_HOST }} +server { + server_name {{$.Env.INDEX_HOST}}; # The local site + listen 80; + access_log /var/log/nginx/access.log vhost; location / { root /usr/share/nginx/html; index index.html index.htm; } } +{{ end }} {{ if (and (exists "/etc/nginx/certs/default.crt") (exists "/etc/nginx/certs/default.key")) }} server { server_name _; # This is just an invalid value which will never trigger on a real hostname. listen 443 ssl http2; access_log /var/log/nginx/access.log vhost; + return 503; + + ssl_certificate /etc/nginx/certs/default.crt; + ssl_certificate_key /etc/nginx/certs/default.key; +} + +{{ if $.Env.INDEX_HOST }} +server { + server_name {{$.Env.INDEX_HOST}}; # The local site + listen 443 ssl http2; + access_log /var/log/nginx/access.log vhost; location / { root /usr/share/nginx/html; index index.html index.htm; @@ -75,6 +95,7 @@ server { ssl_certificate_key /etc/nginx/certs/default.key; } {{ end }} +{{ end }} {{ range $host, $containers := groupByMulti $ "Env.VIRTUAL_HOST" "," }}