super-productivity/nginx/default.conf.template
Kingsley Yung 78c2649387 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.
2024-10-09 18:15:10 +02:00

30 lines
886 B
Text

server {
listen 80;
server_name localhost;
# serve super-productivity as static files at the path /
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
# forward requests starting with "/webdav/" to $WEBDAV_BACKEND
# note: the prefix "/webdav" is removed during forwarding
location = /webdav {
return 302 /webdav/;
}
location /webdav/ {
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!
}
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}