-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathearthtools.ca.nix
89 lines (82 loc) · 2.9 KB
/
earthtools.ca.nix
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
89
{
services.lighttpd = {
enable = false;
port = 80;
enableModules = [ "mod_proxy" ];
extraConfig = ''
#server.bind = "[::1]"
server.bind = "0.0.0.0"
$SERVER["socket"] == "[::]:80" { }
server.use-ipv6 = "enable"
# proxy.server = ( "" => ( ( "host" => "192.168.2.62", "port" => 80 ) ) )
$HTTP["host"] == "gallery.earthtools.ca" {
proxy.server = ( "" => ( ( "host" => "192.168.2.61", "port" => 82 ) ) )
}
$HTTP["host"] == "hydra.earthtools.ca" {
proxy.server = ( "" => ( ( "host" => "127.0.0.1", "port" => 3000 ) ) )
}
$HTTP["host"] =~ "^(nixcache.earthtools.ca|reven.angeldsis.com)$" {
proxy.server = ( "" => ( ( "host" => "192.168.2.61" ) ) )
}
$HTTP["host"] == "cache.earthtools.ca" {
proxy.server = ( "" => ( ( "host" => "127.0.0.1", "port" => 5000 ) ) )
}
$HTTP["url"] =~ "^/(export|videos|docs|nixos|docroot|hoogle|cacti)" {
proxy.server = ( "" => (("host" => "192.168.2.61" )))
}
$HTTP["host"] =~ "^(fuspr.net|hydra.taktoa.me|hydra.fuspr.net|hydra.angeldsis.com)$" {
proxy.server = ( "" => (("host" => "192.168.2.11" )))
}
$HTTP["host"] == "werewolf.earthtools.ca" {
proxy.server = ( "" => (("host" => "192.168.2.32", "port" => 8080 ) ) )
}
'';
};
services.nginx = let
mkProxy = target: {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = target;
extraConfig = ''
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
'';
};
};
nasProxy = mkProxy "http://192.168.2.11";
in {
enable = true;
virtualHosts = {
#"fuspr.net" = nasProxy;
#"hydra.taktoa.me" = nasProxy;
#"hydra.fuspr.net" = nasProxy;
"monitoring.earthtools.ca" = nasProxy;
"hydra.angeldsis.com" = nasProxy;
"plex.earthtools.ca" = mkProxy "http://192.168.2.11:32400";
"nixcache.earthtools.ca" = mkProxy "http://192.168.2.61";
"reven.angeldsis.com" = mkProxy "http://192.168.2.61";
"gallery.earthtools.ca" = mkProxy "http://192.168.2.61:82";
"hydra.earthtools.ca" = {
globalRedirect = "hydra.angeldsis.com";
enableACME = true;
};
"cache.earthtools.ca" = mkProxy "http://127.0.0.1:5000";
"ext.earthtools.ca" = {
enableACME = true;
#enableSSL = false;
forceSSL = true;
locations = {
#"/export".proxyPass = "http://192.168.2.61";
"/videos".proxyPass = "http://192.168.2.61";
"/icons".proxyPass = "http://192.168.2.61";
"/docs".proxyPass = "http://192.168.2.61";
"/nixos".proxyPass = "http://192.168.2.61";
"/docroot".proxyPass = "http://192.168.2.61";
"/hoogle".proxyPass = "http://192.168.2.61";
"/cacti".proxyPass = "http://192.168.2.61";
};
};
};
};
}