|
| 1 | +# ---------------------------------------------------------------------- |
| 2 | +# | Compression | |
| 3 | +# ---------------------------------------------------------------------- |
| 4 | + |
| 5 | +# Brotli |
| 6 | +# https://github.com/google/ngx_brotli?tab=readme-ov-file#configuration-directives |
| 7 | +# brotli on; |
| 8 | + |
| 9 | +# Compression level (1-11). |
| 10 | +# We do not change the default compression level, which is 6. |
| 11 | +# Default: 6 |
| 12 | +# brotli_comp_level 6; |
| 13 | + |
| 14 | +# Don't compress anything that's already small and unlikely to shrink much if at |
| 15 | +# all. |
| 16 | +# Default: 20 |
| 17 | +# brotli_min_length 256; |
| 18 | + |
| 19 | +# Compress all output labeled with one of the following MIME-types. |
| 20 | +# `text/html` is always compressed by gzip module. |
| 21 | +# Default: text/html |
| 22 | +# brotli_types |
| 23 | +# application/atom+xml |
| 24 | +# application/geo+json |
| 25 | +# application/javascript |
| 26 | +# application/x-javascript |
| 27 | +# application/json |
| 28 | +# application/ld+json |
| 29 | +# application/manifest+json |
| 30 | +# application/rdf+xml |
| 31 | +# application/rss+xml |
| 32 | +# application/vnd.ms-fontobject |
| 33 | +# application/wasm |
| 34 | +# application/x-web-app-manifest+json |
| 35 | +# application/xhtml+xml |
| 36 | +# application/xml |
| 37 | +# font/eot |
| 38 | +# font/otf |
| 39 | +# font/ttf |
| 40 | +# image/bmp |
| 41 | +# image/svg+xml |
| 42 | +# image/vnd.microsoft.icon |
| 43 | +# image/x-icon |
| 44 | +# text/cache-manifest |
| 45 | +# text/calendar |
| 46 | +# text/css |
| 47 | +# text/javascript |
| 48 | +# text/markdown |
| 49 | +# text/plain |
| 50 | +# text/xml |
| 51 | +# text/vcard |
| 52 | +# text/vnd.rim.location.xloc |
| 53 | +# text/vtt |
| 54 | +# text/x-component |
| 55 | +# text/x-cross-domain-policy; |
| 56 | + |
| 57 | +# gzip |
| 58 | +# https://docs.nginx.com/nginx/admin-guide/dynamic-modules/brotli/ |
| 59 | + |
| 60 | +# Enable gzip compression. |
| 61 | +# Default: off |
| 62 | +gzip on; |
| 63 | + |
| 64 | +# Compression level (1-9). |
| 65 | +# 5 is a perfect compromise between size and CPU usage, offering about 75% |
| 66 | +# reduction for most ASCII files (almost identical to level 9). |
| 67 | +# Default: 1 |
| 68 | +gzip_comp_level 5; |
| 69 | + |
| 70 | +# Don't compress anything that's already small and unlikely to shrink much if at |
| 71 | +# all (the default is 20 bytes, which is bad as that usually leads to larger |
| 72 | +# files after gzipping). |
| 73 | +# Default: 20 |
| 74 | +gzip_min_length 256; |
| 75 | + |
| 76 | +# Compress data even for clients that are connecting to us via proxies, |
| 77 | +# identified by the "Via" header (required for CloudFront). |
| 78 | +# Default: off |
| 79 | +gzip_proxied any; |
| 80 | + |
| 81 | +# Tell proxies to cache both the gzipped and regular version of a resource |
| 82 | +# whenever the client's Accept-Encoding capabilities header varies; |
| 83 | +# Avoids the issue where a non-gzip capable client (which is extremely rare |
| 84 | +# today) would display gibberish if their proxy gave them the gzipped version. |
| 85 | +# Default: off |
| 86 | +gzip_vary on; |
| 87 | + |
| 88 | +# Compress all output labeled with one of the following MIME-types. |
| 89 | +# `text/html` is always compressed by gzip module. |
| 90 | +# Default: text/html |
| 91 | +gzip_types |
| 92 | + application/atom+xml |
| 93 | + application/geo+json |
| 94 | + application/javascript |
| 95 | + application/x-javascript |
| 96 | + application/json |
| 97 | + application/ld+json |
| 98 | + application/manifest+json |
| 99 | + application/rdf+xml |
| 100 | + application/rss+xml |
| 101 | + application/vnd.ms-fontobject |
| 102 | + application/wasm |
| 103 | + application/x-web-app-manifest+json |
| 104 | + application/xhtml+xml |
| 105 | + application/xml |
| 106 | + font/eot |
| 107 | + font/otf |
| 108 | + font/ttf |
| 109 | + image/bmp |
| 110 | + image/svg+xml |
| 111 | + image/vnd.microsoft.icon |
| 112 | + image/x-icon |
| 113 | + text/cache-manifest |
| 114 | + text/calendar |
| 115 | + text/css |
| 116 | + text/javascript |
| 117 | + text/markdown |
| 118 | + text/plain |
| 119 | + text/xml |
| 120 | + text/vcard |
| 121 | + text/vnd.rim.location.xloc |
| 122 | + text/vtt |
| 123 | + text/x-component |
| 124 | + text/x-cross-domain-policy; |
0 commit comments