forked from emily/nixfiles
cleard clutter
This commit is contained in:
parent
19b0e9a5bb
commit
a84a1ce3dd
2 changed files with 1 additions and 29 deletions
|
@ -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"; };
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue