diff --git a/config/hosts/web02/configuration.nix b/config/hosts/web02/configuration.nix index 424f2a0..c79e5cb 100644 --- a/config/hosts/web02/configuration.nix +++ b/config/hosts/web02/configuration.nix @@ -8,34 +8,12 @@ let add_header X-Frame-Options "SAMEORIGIN" always; add_header Referrer-Policy "same-origin" always; ''; - virtHostCfg = { - forceSSL = true; - http3 = true; - quic = true; - }; autoIndex = '' autoindex on; autoindex_exact_size off; autoindex_format html; autoindex_localtime on; ''; - createHost = builtins.mapAttrs (vhostName: vhostCfg: - with lib; let - mkRedirect = if builtins.hasAttr "redirectTo" vhostCfg - then { - useACMEHost = vhostCfg.redirectTo; - globalRedirect = vhostCfg.redirectTo; - } else ( - optionalAttrs (!(builtins.hasAttr "useACMEHost" vhostCfg)) { - enableACME = true; - }); - extraCfg = if builtins.hasAttr "extraConfig" vhostCfg - then { extraConfig = ''${vhostCfg.extraConfig} ${extraConfig}''; } - else { inherit extraConfig; }; - in - virtHostCfg // mkRedirect // extraCfg // - (builtins.removeAttrs vhostCfg [ "redirectTo" "extraConfig" ]) - ); in { networking = { hostName = "web02"; @@ -89,7 +67,7 @@ in { ${extraConfig} ''; - virtualHosts = createHost { + createHost = { "miau.zip" = { root = "/var/www/kyouma.net"; }; "www.miau.zip" = { redirectTo = "miau.zip"; }; "www.kyouma.net" = { redirectTo = "kyouma.net"; }; diff --git a/modules/vhost/default.nix b/modules/vhost/default.nix index 11e62b8..1fda4b7 100644 --- a/modules/vhost/default.nix +++ b/modules/vhost/default.nix @@ -15,12 +15,6 @@ with lib; let http3 = true; quic = true; }; - autoIndex = '' - autoindex on; - autoindex_exact_size off; - autoindex_format html; - autoindex_localtime on; - ''; createHostFunc = builtins.mapAttrs (vhostName: vhostCfg: with lib; let mkRedirect = if builtins.hasAttr "redirectTo" vhostCfg