blob: a829e5ad80693ded031ca51e04c0d0e5bcbaf1b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
# This module configures a reverse proxy for the various services that are
# exposed to the internet.
{
pkgs,
config,
lib,
...
}: let
baseDomain = "ulovlighacker.download";
wwwDomain = "www.${baseDomain}";
qbDomain = "qbittorrent.${baseDomain}";
jellyfinDomain = "jellyfin.${baseDomain}";
# The internal port where qBittorrents web UI will be served.
qbWebUiPort = 8082;
# Whether to use ACME/Letsencrypt to get free certificates.
useACME = true;
in {
services.qbittorrent = {
openFirewall = false;
port = qbWebUiPort;
settings = {
Preferences = {
# Used in conjunction with the --webui-port flag (via services.qbittorrent.port)
# We do NOT want qBittorrent to open the webui's port on the router,
# since all trafic will be going through the reverse proxy anyways.
"WebUI\\UseUPnP" = false;
};
};
};
services.jellyfin.openFirewall = false;
# Use NGINX as a reverse proxy.
services.nginx = {
virtualHosts."${baseDomain}" = {
enableACME = useACME;
forceSSL = useACME;
serverAliases = [wwwDomain];
locations."/" = {
index = "index.html";
root = pkgs.runCommand "${baseDomain}-portal" {inherit qbDomain jellyfinDomain;} ''
mkdir $out
${pkgs.xorg.lndir}/bin/lndir ${./portal} $out
rm $out/index.html
substituteAll ${./portal/index.html} $out/index.html
'';
};
};
virtualHosts.${qbDomain} = {
enableACME = useACME;
forceSSL = useACME;
locations."/" = {
proxyPass = "http://localhost:${toString qbWebUiPort}";
recommendedProxySettings = true;
};
};
virtualHosts.${jellyfinDomain} = {
enableACME = useACME;
forceSSL = useACME;
locations."/" = {
# This is the "static port" of the HTTP web interface.
#
# See: https://jellyfin.org/docs/general/networking/#port-bindings
proxyPass = "http://localhost:8096";
recommendedProxySettings = true;
};
};
};
# Register the domains with the DDNS client.
services.cloudflare-dyndns.domains = [
baseDomain
wwwDomain
qbDomain
jellyfinDomain
];
}
|