mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-16 09:03:42 +00:00
nixos/nginx: add recommendedZstdSettings
This commit is contained in:
parent
dd73b3e57b
commit
5e5a84b193
@ -186,8 +186,8 @@ let
|
|||||||
brotli_types ${lib.concatStringsSep " " compressMimeTypes};
|
brotli_types ${lib.concatStringsSep " " compressMimeTypes};
|
||||||
''}
|
''}
|
||||||
|
|
||||||
# https://docs.nginx.com/nginx/admin-guide/web-server/compression/
|
|
||||||
${optionalString cfg.recommendedGzipSettings ''
|
${optionalString cfg.recommendedGzipSettings ''
|
||||||
|
# https://docs.nginx.com/nginx/admin-guide/web-server/compression/
|
||||||
gzip on;
|
gzip on;
|
||||||
gzip_static on;
|
gzip_static on;
|
||||||
gzip_vary on;
|
gzip_vary on;
|
||||||
@ -197,6 +197,14 @@ let
|
|||||||
gzip_types ${lib.concatStringsSep " " compressMimeTypes};
|
gzip_types ${lib.concatStringsSep " " compressMimeTypes};
|
||||||
''}
|
''}
|
||||||
|
|
||||||
|
${optionalString cfg.recommendedZstdSettings ''
|
||||||
|
zstd on;
|
||||||
|
zstd_comp_level 9;
|
||||||
|
zstd_min_length 256;
|
||||||
|
zstd_static on;
|
||||||
|
zstd_types ${lib.concatStringsSep " " compressMimeTypes};
|
||||||
|
''}
|
||||||
|
|
||||||
${optionalString cfg.recommendedProxySettings ''
|
${optionalString cfg.recommendedProxySettings ''
|
||||||
proxy_redirect off;
|
proxy_redirect off;
|
||||||
proxy_connect_timeout ${cfg.proxyTimeout};
|
proxy_connect_timeout ${cfg.proxyTimeout};
|
||||||
@ -492,6 +500,16 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
recommendedZstdSettings = mkOption {
|
||||||
|
default = false;
|
||||||
|
type = types.bool;
|
||||||
|
description = lib.mdDoc ''
|
||||||
|
Enable recommended zstd settings. Learn more about compression in Zstd format [here](https://github.com/tokers/zstd-nginx-module).
|
||||||
|
|
||||||
|
This adds `pkgs.nginxModules.zstd` to `services.nginx.additionalModules`.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
proxyTimeout = mkOption {
|
proxyTimeout = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "60s";
|
default = "60s";
|
||||||
@ -1005,7 +1023,8 @@ in
|
|||||||
groups = config.users.groups;
|
groups = config.users.groups;
|
||||||
}) dependentCertNames;
|
}) dependentCertNames;
|
||||||
|
|
||||||
services.nginx.additionalModules = optional cfg.recommendedBrotliSettings pkgs.nginxModules.brotli;
|
services.nginx.additionalModules = optional cfg.recommendedBrotliSettings pkgs.nginxModules.brotli
|
||||||
|
++ lib.optional cfg.recommendedZstdSettings pkgs.nginxModules.zstd;
|
||||||
|
|
||||||
systemd.services.nginx = {
|
systemd.services.nginx = {
|
||||||
description = "Nginx Web Server";
|
description = "Nginx Web Server";
|
||||||
|
Loading…
Reference in New Issue
Block a user