diff --git a/flake.lock b/flake.lock index bf59770..520c341 100755 --- a/flake.lock +++ b/flake.lock @@ -179,11 +179,11 @@ "dotfiles": { "flake": false, "locked": { - "lastModified": 1760302953, - "narHash": "sha256-I6Fwz8j/HIfRO4sVuke2gEeP3QcIfMHWe0nIpnvkbcE=", + "lastModified": 1761185022, + "narHash": "sha256-SABEm3rOGNy8IXuccUAV/xzJfGaDhuwDk0KNK9WCZE4=", "owner": "c4patino", "repo": "dotfiles", - "rev": "d833a91512d9d7708f85f95e4115c2b17f5e3a60", + "rev": "0aff829c0ff6e7ae7530fc4dbcbca8a0a6ba849c", "type": "github" }, "original": { diff --git a/inputs/dotfiles b/inputs/dotfiles index d833a91..0aff829 160000 --- a/inputs/dotfiles +++ b/inputs/dotfiles @@ -1 +1 @@ -Subproject commit d833a91512d9d7708f85f95e4115c2b17f5e3a60 +Subproject commit 0aff829c0ff6e7ae7530fc4dbcbca8a0a6ba849c diff --git a/modules/nixos/services/networking/httpd/default.nix b/modules/nixos/services/networking/httpd/default.nix index 4cbddcc..99e08e6 100644 --- a/modules/nixos/services/networking/httpd/default.nix +++ b/modules/nixos/services/networking/httpd/default.nix @@ -76,14 +76,31 @@ in { extraModules = ["proxy" "proxy_http" "rewrite"]; + extraConfig = '' + ErrorDocument 400 /400.html + ErrorDocument 401 /401.html + ErrorDocument 403 /403.html + ErrorDocument 404 /404.html + ErrorDocument 500 /500.html + ''; + virtualHosts = mkMerge [ { "_default_" = { acmeRoot = null; documentRoot = "/var/empty"; + + servedDirs = [ + { + dir = "/var/www/error"; + urlPath = "/"; + } + ]; + extraConfig = '' RewriteEngine On - RewriteRule ^ - [R=404,L] + RewriteCond %{REQUEST_URI} !^/(400|401|403|404|500)\.html$ + RewriteRule ^ - [L,R=404] ''; }; } @@ -98,12 +115,21 @@ in { acmeRoot = null; serverAliases = ["*.localhost"]; documentRoot = "/var/empty"; + + servedDirs = [ + { + dir = "/var/www/error"; + urlPath = "/"; + } + ]; + extraConfig = '' UseCanonicalName Off + RewriteEngine On ${localhostProxyConfig} - - RewriteRule ^ - [R=404,L] + RewriteCond %{REQUEST_URI} !^/(400|401|403|404|500)\.html$ + RewriteRule ^ - [L,R=404] ''; }; } @@ -141,6 +167,8 @@ in { networking.firewall.allowedTCPPorts = [80 443]; - ${namespace}.services.storage.impermanence.folders = ["/var/www"]; + systemd.tmpfiles.rules = [ + "L+ /var/www 555 root root - ${inputs.dotfiles + "/httpd"}" + ]; }; } diff --git a/systems/x86_64-linux/arisu/default.nix b/systems/x86_64-linux/arisu/default.nix index dc6cc2c..dc6b1e7 100644 --- a/systems/x86_64-linux/arisu/default.nix +++ b/systems/x86_64-linux/arisu/default.nix @@ -27,6 +27,9 @@ in { hardware.nvidia = enabled; services = { + networking = { + httpd = enabled; + }; storage = { nfs.mounts = { "slurm" = "chibi";