fix: nas wake up on traffic

This commit is contained in:
Dominik Polakovics Polakovics 2026-04-14 10:46:15 +02:00
parent 227fc49cb8
commit 358f2296ce
2 changed files with 96 additions and 0 deletions

View file

@ -1,4 +1,16 @@
{ config, lib, ... }: {
# Catch-all default server: drop connections from bots/scanners hitting
# by IP or unknown Host header. Without this, the alphabetically first
# vhost (audiobooks) becomes the implicit default — and its @nas_wake
# error handler wakes the NAS on every random internet probe.
services.nginx.virtualHosts."_" = {
default = true;
rejectSSL = true;
extraConfig = ''
return 444;
'';
};
services.nginx.virtualHosts."git.cloonar.com" = {
forceSSL = true;
enableACME = true;
@ -45,12 +57,17 @@
allow ${config.networkPrefix}.97.0/24;
allow ${config.networkPrefix}.98.0/24;
deny all;
proxy_connect_timeout 3s;
error_page 502 504 = @nas_wake;
'';
locations."/" = {
proxyPass = "http://${config.networkPrefix}.97.11:8000";
proxyWebsockets = true;
};
locations."@nas_wake" = {
proxyPass = "http://${config.networkPrefix}.97.1:9800";
};
};
services.nginx.virtualHosts."jellyfin.cloonar.com" = {
@ -58,6 +75,11 @@
enableACME = true;
acmeRoot = null;
extraConfig = ''
proxy_connect_timeout 3s;
error_page 502 504 = @nas_wake;
'';
locations."/" = {
proxyPass = "http://${config.networkPrefix}.97.11:8096";
proxyWebsockets = true;
@ -73,6 +95,9 @@
proxy_buffering off;
'';
};
locations."@nas_wake" = {
proxyPass = "http://${config.networkPrefix}.97.1:9800";
};
};
services.nginx.virtualHosts."audiobooks.cloonar.com" = {
@ -80,6 +105,11 @@
enableACME = true;
acmeRoot = null;
extraConfig = ''
proxy_connect_timeout 3s;
error_page 502 504 = @nas_wake;
'';
locations."/" = {
proxyPass = "http://${config.networkPrefix}.97.11:13378";
proxyWebsockets = true;
@ -94,6 +124,9 @@
proxy_buffering off;
'';
};
locations."@nas_wake" = {
proxyPass = "http://${config.networkPrefix}.97.1:9800";
};
};
services.nginx.virtualHosts."moltbot.cloonar.com" = {