set max size for nginx

This commit is contained in:
Joakim Repomaa
2025-02-10 03:07:00 +02:00
parent 0f8491a18e
commit dbe1b3109c

View File

@@ -6,7 +6,7 @@ let
MiB = 1024 * KiB; MiB = 1024 * KiB;
GiB = 1024 * MiB; GiB = 1024 * MiB;
hastebinConfig = (pkgs.formats.yaml { }).generate "hastebin.yml" { settings = {
port = cfg.port; port = cfg.port;
max_size = 1 * GiB; max_size = 1 * GiB;
default_extension = "txt"; default_extension = "txt";
@@ -30,6 +30,7 @@ let
auth_tokens_file = "/var/secrets/hastebin-tokens"; auth_tokens_file = "/var/secrets/hastebin-tokens";
}; };
hastebinConfig = (pkgs.formats.yaml { }).generate "hastebin.yml" settings;
hastebin = inputs.hastebin.packages.${pkgs.system}.default; hastebin = inputs.hastebin.packages.${pkgs.system}.default;
in in
{ {
@@ -67,7 +68,15 @@ in
modules.services.webserver = { modules.services.webserver = {
enable = lib.mkDefault true; enable = lib.mkDefault true;
vHosts.${fqdn}.locations."/".proxyPort = cfg.port; vHosts.${fqdn}.locations."/" = {
proxyPort = cfg.port;
extraConfig = ''
client_max_body_size ${settings.max_size / MiB}m;
proxy_send_timeout 300;
proxy_read_timeout 300;
send_timeout 300;
'';
};
}; };
}; };
} }