From a7dd167def51d9cf3eb53dadbaab36c6cfd58908 Mon Sep 17 00:00:00 2001 From: Kingsley Yung Date: Fri, 4 Oct 2024 12:20:37 +0800 Subject: [PATCH] fix: avoid nginx error when webdav is missing By default, nginx refuses to start if the upstream host is not found. Since the webdav upstream server is optional here, we want nginx to start even if the webdav upstream server is missing. The trick here is to put the upstream url in a variable first so that nginx will not check whether the upstream host exists on start and start anyway. --- nginx/default.conf.template | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nginx/default.conf.template b/nginx/default.conf.template index 966c73e91..b99539062 100644 --- a/nginx/default.conf.template +++ b/nginx/default.conf.template @@ -14,7 +14,11 @@ server { return 302 /webdav/; } location /webdav/ { - proxy_pass $WEBDAV_BACKEND/; + set $upstream $WEBDAV_BACKEND; + # note: put the upstream host in a variable first so that nginx can + # starts successfully even if the upstream hsot is not found. + + proxy_pass $upstream/; # note: the trailing slash here matters! }