services: use subdomain for ACME cert

Avoids conflicts now that I have multiple servers sharing the config
This commit is contained in:
Antoine Martin 2022-06-12 17:18:58 +02:00
parent baa239dc72
commit 990c035c3b
13 changed files with 72 additions and 18 deletions

View file

@ -13,7 +13,11 @@
cfg = config.my.services.lohr;
my = config.my;
domain = config.networking.domain;
hostname = config.networking.hostName;
fqdn = "${hostname}.${domain}";
secrets = config.my.secrets;
lohrPkg = let
flake = builtins.getFlake "github:alarsyo/lohr?rev=58503cc8b95c8b627f6ae7e56740609e91f323cd";
@ -73,12 +77,14 @@ in {
services.nginx.virtualHosts = {
"lohr.${domain}" = {
forceSSL = true;
useACMEHost = domain;
useACMEHost = fqdn;
locations."/" = {
proxyPass = "http://127.0.0.1:${toString cfg.port}";
};
};
};
security.acme.certs.${fqdn}.extraDomainNames = ["lohr.${domain}"];
};
}