From b62307bf39fcb476bad015bd7ec34e7e2c04e9e4 Mon Sep 17 00:00:00 2001 From: Ethel Morgan Date: Sat, 11 Jul 2020 13:52:04 +0100 Subject: add try_files to sites.static --- nixos/sites/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nixos/sites/default.nix b/nixos/sites/default.nix index 95d8055..032803e 100644 --- a/nixos/sites/default.nix +++ b/nixos/sites/default.nix @@ -12,6 +12,15 @@ locations = { "/" = { root = root; + extraConfig = '' + if ($request_uri ~ ^/(.*)\.html$) { + return 302 /$1; + } + if ($request_uri ~ ^/(.*)/$) { + return 302 /$1; + } + try_files $uri $uri.$extension $uri/ =404; + ''; }; }; }; -- cgit v1.2.3