diff --git a/hosts/nixedo/modules/nginx/default.nix b/hosts/nixedo/modules/nginx/default.nix index b28403e0..c5b4da20 100644 --- a/hosts/nixedo/modules/nginx/default.nix +++ b/hosts/nixedo/modules/nginx/default.nix @@ -51,5 +51,8 @@ in users.users.${config.services.nginx.user}.extraGroups = [ "acme" ]; - imports = [ ./www.oliverdavies.uk ]; + imports = [ + ./ponthirtaekwondo.co.uk.nix + ./www.oliverdavies.uk + ]; } diff --git a/hosts/nixedo/modules/nginx/ponthirtaekwondo.co.uk.nix b/hosts/nixedo/modules/nginx/ponthirtaekwondo.co.uk.nix new file mode 100644 index 00000000..23e44c33 --- /dev/null +++ b/hosts/nixedo/modules/nginx/ponthirtaekwondo.co.uk.nix @@ -0,0 +1,51 @@ +{ config, ... }: + +let + name = "ponthirtaekwondo.co.uk"; + ports = config.homelab.ports; + port = ports.nginx-ponthir-taekwondo; +in +{ + security.acme.certs = { + "ponthirtaekwondo.co.uk" = { + domain = "ponthirtaekwondo.co.uk"; + dnsProvider = "cloudflare"; + email = "oliver@oliverdavies.uk"; + environmentFile = config.age.secrets.cloudflare.path; + webroot = null; + + extraDomainNames = [ + "www.ponthirtaekwondo.co.uk" + ]; + }; + }; + + services = { + nginx.virtualHosts = { + "www.${name}" = { + root = "/var/www/vhosts/${name}"; + + listen = [ + { + inherit port; + + addr = "localhost"; + } + ]; + + locations."/".tryFiles = "$uri $uri.html $uri/index.html =404"; + + extraConfig = '' + port_in_redirect off; + + # Remove trailing slashes. + rewrite ^/(.*)/$ /$1 permanent; + ''; + }; + }; + + cloudflared.tunnels."e1514105-327f-4984-974e-e2fbaca76466".ingress = { + "www.ponthirtaekwondo.co.uk" = "http://localhost:${toString port}"; + }; + }; +} diff --git a/hosts/nixedo/ports.nix b/hosts/nixedo/ports.nix index e3ceba08..05bda7ff 100644 --- a/hosts/nixedo/ports.nix +++ b/hosts/nixedo/ports.nix @@ -26,6 +26,7 @@ in nginx-florida-drupalcamp-tailwind-css = 8083; nginx-luke = 8094; nginx-phpsw-sculpin-demo = 8085; + nginx-ponthir-taekwondo = 9004; nginx-rebuilding-acquia = 8086; nginx-rebuilding-bartik = 8087; nginx-rebuilding-bristol-js = 8088;