From b0fd7d3b7fe33c7cb6124d18f22c6d0ec57fb479 Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Thu, 4 Sep 2025 16:21:53 +0100 Subject: [PATCH] fix: got www.outinul.ie working --- applications/skynet_users.nix | 96 +++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 44 deletions(-) diff --git a/applications/skynet_users.nix b/applications/skynet_users.nix index 2812bcc..88347a2 100644 --- a/applications/skynet_users.nix +++ b/applications/skynet_users.nix @@ -9,6 +9,23 @@ with lib; let name = "website_users"; cfg = config.services.skynet."${name}"; php_pool = name; + + custom = domain: user: { + "${domain}" = { + forceSSL = true; + enableACME = true; + locations = { + "/" = { + alias = "/home/${user}/public_html/"; + index = "index.html"; + extraConfig = '' + autoindex on; + ''; + tryFiles = "$uri$args $uri$args/ /index.html"; + }; + }; + }; + }; in { imports = [ ]; @@ -84,55 +101,46 @@ in { phpEnv."PATH" = lib.makeBinPath [pkgs.php]; }; - services.nginx.virtualHosts = { - "outinul.ie" = { - forceSSL = true; - enableACME = true; - locations = { - "/" = { - alias = "/home/outinul/public_html/"; - index = "index.html"; - extraConfig = '' - autoindex on; - ''; - tryFiles = "$uri$args $uri$args/ /index.html"; - }; - }; - }; + services.nginx.virtualHosts = lib.mkMerge [ # main site - "*.users.skynet.ie" = { - forceSSL = true; - useACMEHost = "skynet"; - serverName = "~^(?.+)\.users\.skynet\.ie"; + { + "*.users.skynet.ie" = { + forceSSL = true; + useACMEHost = "skynet"; + serverName = "~^(?.+)\.users\.skynet\.ie"; - # username.users.skynet.ie/ - # user goes: - # chmod 711 ~ - # chmod -R 755 ~/public_html + # username.users.skynet.ie/ + # user goes: + # chmod 711 ~ + # chmod -R 755 ~/public_html - locations = { - "/" = { - alias = "/home/$user/public_html/"; - index = "index.html"; - extraConfig = '' - autoindex on; - ''; - tryFiles = "$uri$args $uri$args/ /index.html"; - }; + locations = { + "/" = { + alias = "/home/$user/public_html/"; + index = "index.html"; + extraConfig = '' + autoindex on; + ''; + tryFiles = "$uri$args $uri$args/ /index.html"; + }; - "~ ^(.+\\.php)(.*)$" = { - root = "/home/$user/public_html/"; - index = "index.php"; - extraConfig = '' - autoindex on; - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass unix:${config.services.phpfpm.pools.${php_pool}.socket}; - include ${pkgs.nginx}/conf/fastcgi.conf; - ''; - tryFiles = "$uri$args $uri$args/ /index.php"; + "~ ^(.+\\.php)(.*)$" = { + root = "/home/$user/public_html/"; + index = "index.php"; + extraConfig = '' + autoindex on; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass unix:${config.services.phpfpm.pools.${php_pool}.socket}; + include ${pkgs.nginx}/conf/fastcgi.conf; + ''; + tryFiles = "$uri$args $uri$args/ /index.php"; + }; }; }; - }; - }; + } + + (custom "outinul.ie" "outinul") + (custom "www.outinul.ie" "outinul") + ]; }; }