From 5e6e6389101ff938cf601543f55637fa83067f5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Barnouin?= Date: Fri, 18 Oct 2024 14:15:03 +0200 Subject: [PATCH] Redirect le43.eu to authentik hompage --- services/nginx/default.nix | 116 ++++++++++++++++++++----------------- 1 file changed, 63 insertions(+), 53 deletions(-) diff --git a/services/nginx/default.nix b/services/nginx/default.nix index d6b3bc6..5f95d55 100644 --- a/services/nginx/default.nix +++ b/services/nginx/default.nix @@ -10,6 +10,9 @@ in security.acme = { acceptTerms = true; defaults.email = "theo.barnouin@le43.eu"; + certs."authentik.le43.eu".extraDomainNames = [ + "le43.eu" + ]; }; services = { fail2ban = { @@ -74,65 +77,72 @@ in commonHttpConfig = '' access_log syslog:server=unix:/dev/log; ''; - virtualHosts."logs.le43.eu" = { - forceSSL = true; - enableACME = true; - locations."/" = { - proxyPass = "http://192.168.1.20:3000"; - proxyWebsockets = true; - recommendedProxySettings = true; + virtualHosts = { + "le43.eu" = { + forceSSL = true; + enableACME = true; + globalRedirect = "authentik.le43.eu"; }; - }; - virtualHosts."play.le43.eu" = { - forceSSL = true; - enableACME = true; - locations."/" = { - proxyPass = "http://192.168.1.42:8096"; - recommendedProxySettings = true; + "logs.le43.eu" = { + forceSSL = true; + enableACME = true; + locations."/" = { + proxyPass = "http://192.168.1.20:3000"; + proxyWebsockets = true; + recommendedProxySettings = true; + }; }; - }; - virtualHosts."cloud.le43.eu" = { - forceSSL = true; - enableACME = true; - locations."/" = { - proxyPass = "http://192.168.1.44"; - proxyWebsockets = true; - recommendedProxySettings = true; + "play.le43.eu" = { + forceSSL = true; + enableACME = true; + locations."/" = { + proxyPass = "http://192.168.1.42:8096"; + recommendedProxySettings = true; + }; }; - }; - virtualHosts."collabora.le43.eu" = { - forceSSL = true; - enableACME = true; - locations."/" = { - proxyPass = "http://192.168.1.46:9980"; - proxyWebsockets = true; - recommendedProxySettings = true; + "cloud.le43.eu" = { + forceSSL = true; + enableACME = true; + locations."/" = { + proxyPass = "http://192.168.1.44"; + proxyWebsockets = true; + recommendedProxySettings = true; + }; }; - }; - virtualHosts."git.le43.eu" = { - forceSSL = true; - enableACME = true; - locations."/" = { - proxyPass = "http://192.168.1.14:3000"; - recommendedProxySettings = true; + "collabora.le43.eu" = { + forceSSL = true; + enableACME = true; + locations."/" = { + proxyPass = "http://192.168.1.46:9980"; + proxyWebsockets = true; + recommendedProxySettings = true; + }; }; - }; - virtualHosts."authentik.le43.eu" = { - forceSSL = true; - enableACME = true; - locations."/" = { - proxyPass = "http://192.168.1.125:9000"; - recommendedProxySettings = true; - proxyWebsockets = true; + "git.le43.eu" = { + forceSSL = true; + enableACME = true; + locations."/" = { + proxyPass = "http://192.168.1.14:3000"; + recommendedProxySettings = true; + }; }; - }; - virtualHosts."netbox.le43.eu" = { - forceSSL = true; - enableACME = true; - locations."/" = { - proxyPass = "http://192.168.1.45"; - recommendedProxySettings = true; - proxyWebsockets = true; + "authentik.le43.eu" = { + forceSSL = true; + enableACME = true; + locations."/" = { + proxyPass = "http://192.168.1.125:9000"; + recommendedProxySettings = true; + proxyWebsockets = true; + }; + }; + "netbox.le43.eu" = { + forceSSL = true; + enableACME = true; + locations."/" = { + proxyPass = "http://192.168.1.45"; + recommendedProxySettings = true; + proxyWebsockets = true; + }; }; }; };