mailserver: add landing page

This commit is contained in:
ibizaman 2026-04-14 23:39:34 +02:00 committed by Pierre Penninckx
parent ce16f2c1d6
commit a237cdfc7b

View file

@ -477,6 +477,25 @@ in
'';
};
};
virtualHosts."${cfg.subdomain}.${cfg.domain}" =
let
landingPage = pkgs.writeTextDir "index.html" ''
<html><body>
<p>Configuration of the mailserver is done automatically thanks to
<a href="https://${cfg.domain}/.well-known/autoconfig/mail/config-v1.1.xml">${cfg.domain}/.well-known/autoconfig/mail/config-v1.1.xml</a>.</p>
</body></html>
'';
in
{
forceSSL = true; # Redirect HTTP → HTTPS
root = "/var/www"; # Dummy root
locations."/" = {
alias = "${landingPage}/";
extraConfig = ''
default_type application/html;
'';
};
};
};
})
(lib.mkIf (cfg.enable && cfg.adminUsername != null) {