elnudrop: nginx & proof of concept server outage handling

This commit is contained in:
Elnu 2023-08-03 19:13:21 -07:00
parent efa926d33f
commit 0efadb66eb
5 changed files with 273 additions and 3 deletions

View file

@ -1,5 +1,4 @@
{ lib, user, ... }:
let keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEQNlGt62dBMojVCX7EUIia+wfSDfLzV4YCPi8SZ2xrp elnu@elnu.com"
]; in
@ -9,6 +8,39 @@ let keys = [
# Remember to update for new instances
./networking.nix # generated at runtime by nixos-infect
];
networking.firewall = {
enable = true;
allowedTCPPorts = [ 80 443 ];
};
security.acme = {
acceptTerms = true;
defaults.email = "elnu@elnu.com";
};
services.nginx = {
enable = true;
virtualHosts = {
"default" = {
default = true;
serverName = null;
# https://stackoverflow.com/a/42802777
locations."/".return = "444";
};
"jichan.org" = {
extraConfig = ''
error_page 502 /502.html;
'';
locations = {
"/" = {
proxyPass = "http://127.0.0.1:8000";
proxyWebsockets = true;
};
"/502.html".root = "${./hosts/jichan.org}";
"/logo.svg".root = "${./hosts/jichan.org}";
"/missing.min.css".root = "${./hosts/jichan.org}";
};
};
};
};
services.do-agent.enable = true;
services.openssh.enable = true;
users.users.root.openssh.authorizedKeys.keys = keys;