From f4bbbf7a641cf2f0f5cb3b9663e272f0f9f15230 Mon Sep 17 00:00:00 2001 From: "Ricardo (XenGi) Band" Date: Wed, 14 Oct 2026 11:45:52 +0200 Subject: [PATCH] alias also without trailing slash --- hosts/www/nginx.nix | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/hosts/www/nginx.nix b/hosts/www/nginx.nix index e22f2e6..c5efd3e 100644 --- a/hosts/www/nginx.nix +++ b/hosts/www/nginx.nix @@ -2,6 +2,12 @@ let # TODO: mkVHost + aliasDir = url: path: { + "${url}" = { + return = "301 ${url}/"; + }; + "${url}/".alias = "${path}/"; + }; in { imports = [ @@ -42,14 +48,6 @@ in index = "index.html"; tryFiles = "$uri $uri/ $uri.html =404"; }; - "/twentyyears/".alias = "/srv/http/twentyyears/"; - "/thirtytwoyears/".alias = "/srv/http/thirtytwoyears/"; - "/kik/".alias = "/srv/http/kik/"; - # RFC8805 - "/noc/".alias = "/srv/http/noc/"; - "/static/".alias = "/srv/http/static/"; - # RFC8805 new location - "/.well-known/loc/".alias = "/srv/http/noc/"; "= /.well-known/security.txt" = { alias = "/srv/http/security.txt"; extraConfig = '' @@ -91,7 +89,15 @@ in default_type text/calendar; ''; }; - }; + } + // aliasDir "/twentyyears" "/srv/http/twentyyears" + // aliasDir "/thirtytwoyears" "/srv/http/thirtytwoyears" + // aliasDir "/kik" "/srv/http/kik" + # RFC8805 + // aliasDir "/noc" "/srv/http/noc" + // aliasDir "/static" "/srv/http/static" + # RFC8805 new location + // aliasDir "/.well-known/loc" "/srv/http/noc"; }; "staging.${config.networking.domain}" = { quic = true;