config/machines/sif/nginx.nix

67 lines
1.4 KiB
Nix
Raw Normal View History

{ ... }:
2022-05-28 18:38:31 +02:00
let enableACME = false;
port = toString 3000;
in {
security.acme = {
acceptTerms = true;
2022-05-28 18:38:31 +02:00
defaults.email = "me@riley.lgbt";
};
services.nginx.enable = true;
services.nginx.virtualHosts = {
2022-05-28 18:38:31 +02:00
"192.168.2.22" = {
listen = [{
port = 80;
addr = "192.168.2.22";
}];
locations."/" = {
proxyPass = "http://localhost:${port}";
};
};
# Main domain that hosts my website
"riley.lgbt" = {
2022-05-28 18:38:31 +02:00
inherit enableACME;
listen = [{
2022-05-28 18:38:31 +02:00
port = if enableACME then 443 else 80;
addr = "77.169.117.112";
}];
2022-05-28 18:38:31 +02:00
locations."/" = {
2022-05-28 18:38:31 +02:00
proxyPass = "http://localhost:${port}";
extraConfig = ''
proxy_set_header Host $host;
proxy_buffering off;
'';
};
2022-05-28 18:38:31 +02:00
};
2022-05-28 18:38:31 +02:00
"rly.cx" = {
2022-05-28 18:38:31 +02:00
inherit enableACME;
listen = [{
2022-05-28 18:38:31 +02:00
port = if enableACME then 443 else 80;
addr = "77.169.117.112";
}];
2022-05-28 18:38:31 +02:00
locations."/" = {
2022-05-28 18:38:31 +02:00
proxyPass = "http://localhost:${port}";
extraConfig = ''
proxy_set_header Host $host;
proxy_buffering off;
'';
};
2022-05-28 18:38:31 +02:00
};
};
}