Brotli Static
Pre-compressed. Because why compress the same file at request time, forever?
nginx-module-brotli-static Install
Make sure you have the official nginx.org repository configured first. These packages require nginx from nginx.org, not the distro-bundled version.
Add the Blendbyte repository if you haven't already:
sudo install -d -m 0755 /etc/apt/keyrings
curl -fsSL https://apt.blendbyte.net/nginx/blendbyte-archive-keyring.gpg \
| sudo tee /etc/apt/keyrings/blendbyte.gpg >/dev/null
echo "deb [signed-by=/etc/apt/keyrings/blendbyte.gpg] https://apt.blendbyte.net/nginx $(lsb_release -cs) main" \
| sudo tee /etc/apt/sources.list.d/blendbyte.list
sudo apt update Then install this module:
$ sudo apt install nginx-module-brotli-static Most modules auto-enable on install. If yours didn't, enable it manually:
$ sudo ln -s /etc/nginx/modules-available/50-mod-brotli-static.conf \
/etc/nginx/modules-enabled/
$ sudo nginx -t && sudo systemctl reload nginx What it does
Brotli static works alongside the dynamic Brotli module to serve pre-compressed files. When a request arrives with Accept-Encoding: br, nginx checks for a .br-suffixed version of the file on disk. If it finds one, it serves it directly. Zero CPU spent on compression at request time. Ideal for static assets that change infrequently: JS bundles, CSS, fonts, JSON manifests. Generate the .br files once in your build pipeline (brotli CLI, webpack plugin, Vite plugin) and deploy them alongside the originals. The dynamic brotli module covers anything without a pre-compressed version as a fallback.
When to use it
- Serve compressed JS bundles and CSS without runtime CPU overhead
- Reduce server resource usage on high-traffic static asset endpoints
- Combine with the dynamic brotli module for complete coverage
- Deploy pre-compressed files from CI/CD pipelines with no nginx config changes
Configuration
A starting-point configuration. Adjust to your setup.
location /static/ {
root /var/www/html;
brotli_static on;
gzip_static on; # gzip fallback for older clients
} Replacing a Sury package?
This module replaces libnginx-mod-http-brotli-static from the Sury nginx repository.
The package declares Replaces and Conflicts so apt handles
the swap automatically in one transaction.
# If you were using Sury, this upgrades in place:
sudo apt install nginx-module-brotli-static See the full migration guide for the complete Sury-to-Blendbyte migration steps.
Upstream project
This module is packaged from the upstream open-source project. Bug reports about module behaviour (not packaging) should go upstream.
https://github.com/google/ngx_brotli ↗