diff --git a/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml
index 2ce4ce189cb4..527c7e50f3a3 100644
--- a/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml
+++ b/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml
@@ -680,6 +680,36 @@
here.
+
+
+ Updated recommended settings in
+ services.nginx.recommendedGzipSettings:
+
+
+
+
+ Enables gzip compression for only certain proxied
+ requests.
+
+
+
+
+ Allow checking and loading of precompressed files.
+
+
+
+
+ Updated gzip mime-types.
+
+
+
+
+ Increased the minimum length of a response that will be
+ gzipped.
+
+
+
+
Garage
diff --git a/nixos/doc/manual/release-notes/rl-2305.section.md b/nixos/doc/manual/release-notes/rl-2305.section.md
index 148b317ba283..295446137096 100644
--- a/nixos/doc/manual/release-notes/rl-2305.section.md
+++ b/nixos/doc/manual/release-notes/rl-2305.section.md
@@ -172,6 +172,12 @@ In addition to numerous new and upgraded packages, this release has the followin
- A new option `recommendedBrotliSettings` has been added to `services.nginx`. Learn more about compression in Brotli format [here](https://github.com/google/ngx_brotli/blob/master/README.md).
+- Updated recommended settings in `services.nginx.recommendedGzipSettings`:
+ - Enables gzip compression for only certain proxied requests.
+ - Allow checking and loading of precompressed files.
+ - Updated gzip mime-types.
+ - Increased the minimum length of a response that will be gzipped.
+
- [Garage](https://garagehq.deuxfleurs.fr/) version is based on [system.stateVersion](options.html#opt-system.stateVersion), existing installations will keep using version 0.7. New installations will use version 0.8. In order to upgrade a Garage cluster, please follow [upstream instructions](https://garagehq.deuxfleurs.fr/documentation/cookbook/upgrading/) and force [services.garage.package](options.html#opt-services.garage.package) or upgrade accordingly [system.stateVersion](options.html#opt-system.stateVersion).
- `hip` has been separated into `hip`, `hip-common` and `hipcc`.
diff --git a/nixos/modules/services/web-servers/nginx/default.nix b/nixos/modules/services/web-servers/nginx/default.nix
index c723b962c847..298c85108c3d 100644
--- a/nixos/modules/services/web-servers/nginx/default.nix
+++ b/nixos/modules/services/web-servers/nginx/default.nix
@@ -187,22 +187,15 @@ let
brotli_buffers 32 8k;
''}
+ # https://docs.nginx.com/nginx/admin-guide/web-server/compression/
${optionalString cfg.recommendedGzipSettings ''
gzip on;
- gzip_proxied any;
- gzip_comp_level 5;
- gzip_types
- application/atom+xml
- application/javascript
- application/json
- application/xml
- application/xml+rss
- image/svg+xml
- text/css
- text/javascript
- text/plain
- text/xml;
+ gzip_static on;
gzip_vary on;
+ gzip_comp_level 5;
+ gzip_min_length 256;
+ gzip_proxied expired no-cache no-store private auth;
+ gzip_types ${lib.concatStringsSep " " compressMimeTypes};
''}
${optionalString cfg.recommendedProxySettings ''