Alisa/nix/infra/nginx.nix

44 lines
1,002 B
Nix
Raw Normal View History

2024-07-10 19:08:04 +02:00
{
2024-07-11 14:10:10 +02:00
self,
config,
2024-07-10 19:08:04 +02:00
...
}:
{
services.nginx = {
enable = true;
recommendedTlsSettings = true;
recommendedOptimisation = true;
recommendedGzipSettings = true;
recommendedProxySettings = true;
virtualHosts = {
"clan-war.net" = {
enableACME = true;
forceSSL = true;
2024-07-11 14:17:23 +02:00
locations."/".root = "${self.legacyPackages.${config.nixpkgs.hostPlatform.system}.web.override { withBackendUrl = "https://api.clan-war.net/api/v1";}}/";
2024-07-10 19:08:04 +02:00
};
"api.clan-war.net" = {
forceSSL = true;
enableACME = true;
2024-07-11 14:24:15 +02:00
locations."/" = {
proxyPass = "http://localhost:8080";
extraConfig = ''
proxy_set_header Access-Control-Allow-Origin https://clan-war.net;
'';
};
2024-07-10 19:08:04 +02:00
};
};
};
security.acme = {
acceptTerms = true;
defaults.email = "security@clan-war.net";
};
networking.firewall = {
enable = true;
allowedTCPPorts = [ 80 ];
allowedUDPPorts = [ 80 ];
};
}