Move nginx to https

This commit is contained in:
Natsu Kagami 2025-04-11 23:34:51 +02:00
parent db427c28ea
commit ac483e1d9d
Signed by: nki
GPG key ID: 55A032EB38B49ADB
6 changed files with 106 additions and 5 deletions

View file

@ -485,5 +485,8 @@ in
EDITOR = "kak";
VISUAL = "kak";
};
# Trust my own cert
security.pki.certificateFiles = [ ../../../nki-home/cert.pem ];
};
}

View file

@ -41,11 +41,19 @@ in
type = types.path;
description = "Path to the private key .pem file";
};
sslCertificate = mkOption {
type = types.path;
description = "Path to the private key .pem file";
};
sslCertificateKey = mkOption {
type = types.path;
description = "Path to the private key .pem file";
};
};
config = {
nix.settings = mkIf cfg.enableClient {
substituters = lib.mkAfter [ "http://${cfg.host}" ];
substituters = lib.mkAfter [ "https://${cfg.host}" ];
trusted-public-keys = [ cfg.publicKey ];
};
@ -64,6 +72,9 @@ in
virtualHosts = {
# ... existing hosts config etc. ...
"${cfg.host}" = {
forceSSL = true;
sslCertificate = cfg.sslCertificate;
sslCertificateKey = cfg.sslCertificateKey;
locations."/".proxyPass = "http://${bindAddr}";
};
};