mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-21 10:28:33 +00:00
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.
30 lines
886 B
Text
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;
|
|
}
|
|
}
|