From 0ccbedc352900cf51d769a95238f55a868886d42 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sat, 22 Jun 2024 16:40:42 +0200 Subject: [PATCH] nginx-matrix: add maintenance page --- modules/nginx-matrix/default.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/nginx-matrix/default.nix b/modules/nginx-matrix/default.nix index 0e236dc..8d4da10 100644 --- a/modules/nginx-matrix/default.nix +++ b/modules/nginx-matrix/default.nix @@ -141,16 +141,22 @@ in ssl = true; } ]; - root = "/dev/null"; + root = "/srv/nginx"; extraConfig = '' server_tokens off; gzip on; gzip_types text/plain application/json; ''; + locations."/maintenance.html" = { + }; locations."/" = { - proxyPass = "http://127.0.0.1:8008"; extraConfig = '' + if (-f $document_root/maintenance.html) { + return 503; + } + error_page 503 /maintenance.html; + proxy_pass http://127.0.0.1:8008; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;