2023-07-17 00:17:50 +02:00
|
|
|
{ secret, ... }:
|
2023-04-09 00:37:43 +02:00
|
|
|
|
|
|
|
{
|
|
|
|
services.nginx.streamConfig = ''
|
2023-04-09 00:43:37 +02:00
|
|
|
resolver 1.1.1.1 ipv6=off;
|
|
|
|
|
2023-06-07 20:40:27 +02:00
|
|
|
upstream video {
|
|
|
|
server ${secret.nginx.upstream.video.hostname}:${builtins.toString secret.nginx.upstream.video.upstreamPort};
|
2023-04-09 02:11:14 +02:00
|
|
|
}
|
|
|
|
|
2023-04-09 00:37:43 +02:00
|
|
|
server {
|
2023-09-04 12:45:06 +02:00
|
|
|
listen *:${builtins.toString secret.nginx.upstream.video.externalPort} fastopen=63 backlog=1023;
|
|
|
|
listen [::]:${builtins.toString secret.nginx.upstream.video.externalPort} fastopen=63 backlog=1023;
|
2023-06-17 17:40:05 +02:00
|
|
|
|
2023-04-09 02:11:14 +02:00
|
|
|
proxy_protocol on;
|
2023-06-07 20:40:27 +02:00
|
|
|
proxy_pass video;
|
2023-04-09 00:37:43 +02:00
|
|
|
}
|
|
|
|
'';
|
|
|
|
|
2023-06-07 20:40:27 +02:00
|
|
|
services.nginx = {
|
|
|
|
commonHttpConfig = ''
|
|
|
|
resolver 1.1.1.1;
|
|
|
|
'';
|
|
|
|
|
|
|
|
upstreams.dns = {
|
|
|
|
servers = {
|
2023-06-10 20:48:07 +02:00
|
|
|
"${secret.nginx.upstream.dns.primary.hostname}:${builtins.toString secret.nginx.upstream.dns.primary.upstreamPort}" = {
|
2023-09-25 21:03:39 +02:00
|
|
|
fail_timeout = "2s";
|
2023-06-10 20:48:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
"${secret.nginx.upstream.dns.secondary.hostname}:${builtins.toString secret.nginx.upstream.dns.secondary.upstreamPort}" = {
|
|
|
|
backup = true;
|
|
|
|
};
|
2023-06-07 20:40:27 +02:00
|
|
|
};
|
2023-06-10 20:48:07 +02:00
|
|
|
|
|
|
|
extraConfig = ''
|
|
|
|
keepalive 8;
|
|
|
|
'';
|
2023-06-07 20:40:27 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
virtualHosts."${secret.nginx.upstream.dns.fqdn}" = {
|
|
|
|
quic = true;
|
|
|
|
http3 = true;
|
|
|
|
|
|
|
|
onlySSL = true;
|
2023-06-21 14:21:40 +02:00
|
|
|
useACMEHost = "daniel.sx";
|
2023-06-07 20:40:27 +02:00
|
|
|
|
|
|
|
locations."/${secret.adguardhome.auth}/dns-query" = {
|
|
|
|
recommendedProxySettings = true;
|
|
|
|
proxyPass = "https://dns";
|
|
|
|
|
|
|
|
extraConfig = ''
|
|
|
|
rewrite ^/${secret.adguardhome.auth}(.*)$ $1 break;
|
|
|
|
|
|
|
|
proxy_hide_header alt-svc;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-06-21 14:21:40 +02:00
|
|
|
networking.firewall.interfaces."enp41s0".allowedTCPPorts = [
|
2023-06-07 20:40:27 +02:00
|
|
|
secret.nginx.upstream.video.externalPort
|
|
|
|
];
|
2023-04-09 00:37:43 +02:00
|
|
|
}
|