os/hosts/0001/caddy.nix
Benjamin Bädorf f291e88d86
All checks were successful
continuous-integration/drone/push Build is passing
Initial proposal for momo infrastructure setup
2023-02-25 04:24:27 +01:00

56 lines
1.2 KiB
Nix

{
config,
lib,
pkgs,
self,
...
}: {
services.caddy = {
enable = lib.mkForce true;
group = "www-user";
email = "admins@pub.solar";
globalConfig = lib.mkForce "";
virtualHosts = {
"momo.koeln" = {
logFormat = lib.mkForce ''
output discard
'';
extraConfig = ''
# website
handle {
root * /srv/www/momo.koeln
try_files {path}.html {path}
file_server
}
# minimal error handling, respond with status code and text
handle_errors {
respond "{http.error.status_code} {http.error.status_text}"
}
'';
};
"www.momo.koeln" = {
logFormat = lib.mkForce ''
output discard
'';
extraConfig = ''
redir https://momo.koeln{uri}
'';
};
"list.momo.koeln" = {
logFormat = lib.mkForce ''
output discard
'';
extraConfig = ''
handle_path /static/* {
root * /var/lib/mailman/web
file_server
}
reverse_proxy :8000
'';
};
};
};
networking.firewall.allowedTCPPorts = [80 443];
}