Compression

Zstandard Static

Like brotli-static, but for zstd. Pre-compress once, serve forever.

nginx-module-zstd-static

Install

You'll need nginx from nginx.org configured first. These packages won't load on the distro nginx.

Add the Blendbyte repository if you haven't already:

Add Blendbyte repository
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:

Install nginx-module-zstd-static
$ sudo apt install nginx-module-zstd-static

Most modules auto-enable on install. If yours didn't:

Enable module manually (if needed)
$ sudo ln -s /etc/nginx/modules-available/50-mod-zstd-static.conf \
  /etc/nginx/modules-enabled/
$ sudo nginx -t && sudo systemctl reload nginx

What it does

Zstd static works with the dynamic Zstandard module to serve pre-compressed files. When a request comes in with Accept-Encoding: zstd, nginx looks for a .zst version of the file on disk. If it finds one, that gets served. Zero CPU on compression. Good for assets that rarely change: JS bundles, CSS, fonts, JSON manifests. Compress them once in your build pipeline (zstd CLI or any zstd-aware bundler plugin) and deploy alongside the originals. The dynamic zstd module covers anything that has no pre-compressed version.

When to use it

  • Take compression CPU cost to zero for static assets that rarely change
  • High-traffic endpoints where every saved millisecond matters
  • Pair with the dynamic zstd module so everything is covered
  • Generate .zst files in CI and ship them alongside originals

Configuration

A starting point. Adjust to taste.

nginx.conf example
location /static/ {
  root /var/www/html;
  zstd_static on;
  brotli_static on;
  gzip_static   on;  # gzip fallback for older clients
}

Upstream project

We package this from the upstream open-source project. If it's a bug in the module itself (not in our packaging), report it upstream.

https://github.com/tokers/zstd-nginx-module ↗

Related modules

← All modules