From 7d00d872ae1623bf23f92e2fe5ed58aaedfa79e1 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 16 Oct 2021 20:00:53 +0200 Subject: [PATCH] VEGAS: add websites --- hosts/VEGAS/services/websites/default.nix | 5 +++++ hosts/VEGAS/services/websites/websites.nix | 24 ++++++++++++++++++++++ hosts/VEGAS/system.nix | 1 + 3 files changed, 30 insertions(+) create mode 100644 hosts/VEGAS/services/websites/default.nix create mode 100644 hosts/VEGAS/services/websites/websites.nix diff --git a/hosts/VEGAS/services/websites/default.nix b/hosts/VEGAS/services/websites/default.nix new file mode 100644 index 0000000..2758578 --- /dev/null +++ b/hosts/VEGAS/services/websites/default.nix @@ -0,0 +1,5 @@ +{ config, lib, tools, ... }: + +{ + services.nginx.virtualHosts = tools.nginx.mappers.mapSubdomains (import ./websites.nix { tools = tools.nginx; }); +} diff --git a/hosts/VEGAS/services/websites/websites.nix b/hosts/VEGAS/services/websites/websites.nix new file mode 100644 index 0000000..b775cc8 --- /dev/null +++ b/hosts/VEGAS/services/websites/websites.nix @@ -0,0 +1,24 @@ +{ tools }: +with tools.vhosts; +let inherit (tools) domain; in +{ + # websites + ktp = static "/srv/storage/www/soda/ktp"; + legacy = static "/srv/storage/www/legacy"; + soda = static "/srv/storage/www/soda"; # TODO: add back custom error pages, wttr.in cache + www = simplePHP "/srv/storage/www/${domain}" // { default = true; }; + + "shadertool.dev" = proxy "http://test-generic.int.${domain}"; + "kokaido" = proxy "http://test-generic.int.${domain}:8080"; + + # content delivery + autoconfig = static "/srv/storage/www/autoconfig"; + rpm = static "/srv/storage/rpm"; + + "whoami".locations = { # no tls + "/".return = ''200 "$remote_addr\n"''; + "/online".return = ''200 "CONNECTED_GLOBAL\n"''; + }; + + top-level = redirect "https://www.${domain}$request_uri" // { serverName = domain; }; +} diff --git a/hosts/VEGAS/system.nix b/hosts/VEGAS/system.nix index b7597d9..5665464 100644 --- a/hosts/VEGAS/system.nix +++ b/hosts/VEGAS/system.nix @@ -27,6 +27,7 @@ ./services/nfs ./services/mail ./services/warehouse + ./services/websites ] # TODO: fix users # ++ (import ../../users "server").groups.admin