infra: add nginx

This commit is contained in:
Johannes Jöns 2024-07-10 19:08:04 +02:00
parent 0f2280005f
commit d3fcc67c26
2 changed files with 36 additions and 0 deletions

View file

@ -15,6 +15,7 @@
./system.nix
./disk.nix
./backend.nix
./nginx.nix
./users
];

35
nix/infra/nginx.nix Normal file
View file

@ -0,0 +1,35 @@
{
...
}:
{
services.nginx = {
enable = true;
recommendedTlsSettings = true;
recommendedOptimisation = true;
recommendedGzipSettings = true;
recommendedProxySettings = true;
virtualHosts = {
"clan-war.net" = {
enableACME = true;
forceSSL = true;
};
"api.clan-war.net" = {
forceSSL = true;
enableACME = true;
locations."/".proxyPass = "http://localhost:8080";
};
};
};
security.acme = {
acceptTerms = true;
defaults.email = "security@clan-war.net";
};
networking.firewall = {
enable = true;
allowedTCPPorts = [ 80 ];
allowedUDPPorts = [ 80 ];
};
}