nixos-configs/nixosConfigurations/hetzner-vpn2/nginx.nix

69 lines
1.7 KiB
Nix
Raw Normal View History

2026-05-27 20:33:03 +02:00
{ pkgs, hyperhive-website, ... }:
2025-09-06 20:34:58 +02:00
let
blog-domain-socket = "/run/nginx/blog.sock";
2025-12-08 21:17:58 +01:00
anubis-domain-socket = "/run/anubis/anubis-main/anubis.sock";
anubis-metrics-socket = "/run/anubis/anubis-main/anubis-metrics.sock";
2025-09-06 20:34:58 +02:00
in
2024-12-01 12:06:11 +01:00
{
security.acme = {
acceptTerms = true;
defaults.email = "acme@zerforschen.plus";
};
2025-09-06 20:34:58 +02:00
systemd.services = {
2025-09-15 20:28:15 +02:00
nginx.serviceConfig.SupplementaryGroups = [ "anubis" ];
anubis-main.serviceConfig.SupplementaryGroups = [ "nginx" ];
2024-12-01 12:06:11 +01:00
};
2025-09-06 20:43:21 +02:00
services = {
nginx = {
enable = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
2024-12-01 12:06:11 +01:00
2025-09-15 20:28:15 +02:00
virtualHosts = {
"zerforschen.plus" = {
addSSL = true;
enableACME = true;
2025-12-08 21:01:59 +01:00
locations = {
2025-12-08 21:37:57 +01:00
"/_metrics".proxyPass = "http://unix:" + anubis-metrics-socket + ":/metrics";
2025-12-08 21:01:59 +01:00
"/".proxyPass = "http://unix:" + anubis-domain-socket;
2025-09-06 20:34:58 +02:00
};
2025-09-15 20:28:15 +02:00
};
2025-09-06 20:34:58 +02:00
2025-09-15 20:28:15 +02:00
"blog-in-anubis" = {
root = pkgs.zerforschen-plus-content;
listen = [
{
addr = "unix:" + blog-domain-socket;
}
];
2025-04-07 19:52:23 +02:00
};
2026-05-27 20:33:03 +02:00
"hyperhive.darkest.space" = {
addSSL = true;
enableACME = true;
root = hyperhive-website.packages.${pkgs.stdenv.hostPlatform.system}.default;
};
2025-09-15 20:28:15 +02:00
};
2025-09-06 20:43:21 +02:00
};
2024-12-01 12:06:11 +01:00
2025-12-08 21:17:58 +01:00
anubis.instances.main = {
2025-09-13 15:10:42 +02:00
enable = true;
settings = {
BIND = anubis-domain-socket;
TARGET = "unix://" + blog-domain-socket;
2025-12-08 21:01:59 +01:00
METRICS_BIND = anubis-metrics-socket;
2025-09-06 20:34:58 +02:00
};
};
};
2025-09-06 20:43:21 +02:00
networking.firewall.allowedTCPPorts = [
80
443
5201
];
2024-12-01 12:06:11 +01:00
}