puter/hosts/abacus/nginx.nix
2024-08-21 18:59:24 +02:00

44 lines
759 B
Nix

{
config,
...
}: {
services.nginx = {
enable = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
commonHttpConfig = ''
error_log stderr;
access_log /var/log/nginx/access.log;
'';
virtualHosts = let
inherit (config.networking) domain;
in {
"~.*" = {
default = true;
rejectSSL = true;
globalRedirect = domain;
};
${domain} = {
enableACME = true;
forceSSL = true;
root = "/var/www/${domain}";
};
"log.${domain}" = {
enableACME = true;
forceSSL = true;
root = "/var/www/log.${domain}";
};
};
};
}