From e8033618bd57eca214f564d13e6d1f65bd71535a Mon Sep 17 00:00:00 2001 From: Stefan Ellmauthaler Date: Fri, 20 Sep 2024 12:09:58 +0200 Subject: [PATCH] Add www.ellmauthaler.net redirect to website Signed-off-by: Stefan Ellmauthaler --- modules/server/nginx.nix | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/modules/server/nginx.nix b/modules/server/nginx.nix index a64ec1f..97470cd 100644 --- a/modules/server/nginx.nix +++ b/modules/server/nginx.nix @@ -17,16 +17,25 @@ with lib; { recommendedTlsSettings = true; }; networking.firewall.allowedTCPPorts = [80 443]; - services.nginx.virtualHosts."localhost" = { - addSSL = false; - enableACME = false; - root = "/var/www/localhost"; - default = true; - }; - services.nginx.virtualHosts."ellmauthaler.net" = { - addSSL = true; - enableACME = true; - root = "/var/www/localhost"; + services.nginx.virtualHosts = { + "localhost" = { + addSSL = false; + enableACME = false; + root = "/var/www/localhost"; + default = true; + }; + + "ellmauthaler.net" = { + addSSL = true; + enableACME = true; + root = "/var/www/localhost"; + }; + + "www.ellmauthaler.net" = { + enableACME = true; + forceSSL = true; + globalRedirect = "stefan.ellmauthaler.net"; + }; }; }; }