nix-config/modules/nixos/website.nix
2026-03-27 07:19:52 +01:00

40 lines
849 B
Nix

{
systemd.tmpfiles.rules = [
"d /var/www/jankremer.de 755 jan users -"
];
services.caddy.virtualHosts = {
"jankremer.de".extraConfig = # caddyfile
''
handle {
root * /var/www/jankremer.de
file_server
@static {
path *.css *.js *.woff2 *.woff *.ttf *.png *.jpg *.jpeg *.svg *.ico *.webp
}
header @static Cache-Control "public, max-age=31536000, immutable"
@html {
path *.html
}
header @html Cache-Control "no-cache"
handle_errors {
rewrite * /404.html
file_server
}
}
'';
"jankremer.eu".extraConfig = # caddyfile
''
redir https://jankremer.de{uri} permanent
'';
};
networking.firewall.allowedTCPPorts = [
80
443
];
}