From 29b14ef74e0a59a834cd6d95f12ea9712b784073 Mon Sep 17 00:00:00 2001 From: Grimmauld Date: Fri, 29 Dec 2023 09:41:25 +0000 Subject: [PATCH] redirect browsers to main page if connecting to mail server vhost --- email.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/email.nix b/email.nix index 3392f70..252425f 100644 --- a/email.nix +++ b/email.nix @@ -26,4 +26,16 @@ in { certificateFile = "/var/lib/acme/${root_host}/fullchain.pem"; keyFile = "/var/lib/acme/${root_host}/key.pem"; }; + + services.nginx = { + enable = true; + virtualHosts."${mail_host}" = { # you should NOT be here from a browser :P + serverName = mail_host; + forceSSL = true; + useACMEHost = root_host; + locations."/" = { + return = "307 https://${root_host}"; + }; + }; + }; }