From 3156b97f3a70d164384c248d265a67cd796982a8 Mon Sep 17 00:00:00 2001 From: Patrick Date: Wed, 13 Sep 2017 12:37:06 +0200 Subject: [PATCH] Fallback if container has no IP Sometimes containers will not be assigned an IP (after reboot or due to misconfiguration). This leads to an incorrect "server down;" line in default.conf and crashes nginx. @therealgambo provided a fix for this: https://github.com/jwilder/nginx-proxy/issues/845 --- nginx.tmpl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nginx.tmpl b/nginx.tmpl index 3c26a9c0c..ad9295c4b 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -13,8 +13,13 @@ {{ end }} {{ else if .Network }} # {{ .Container.Name }} - server {{ .Network.IP }} down; + {{ if .Network.IP }} + server {{ .Network.IP }} down; + {{ else }} + server 127.0.0.1 down; + {{ end }} {{ end }} + {{ end }} # If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the