feat: added default error pages to apache httpd configuration

This commit is contained in:
Ceferino Patino 2025-10-22 11:43:53 -05:00
commit 302605b8c6
Signed by: c4patino
SSH key fingerprint: SHA256:Wu+cU1t+7zVT9wzew/4meNmeulo66NzMqc22MdDBgXI
4 changed files with 39 additions and 8 deletions

6
flake.lock generated
View file

@ -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": {

@ -1 +1 @@
Subproject commit d833a91512d9d7708f85f95e4115c2b17f5e3a60
Subproject commit 0aff829c0ff6e7ae7530fc4dbcbca8a0a6ba849c

View file

@ -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"}"
];
};
}

View file

@ -27,6 +27,9 @@ in {
hardware.nvidia = enabled;
services = {
networking = {
httpd = enabled;
};
storage = {
nfs.mounts = {
"slurm" = "chibi";