---
title: "Enhance Your Clarive Server Performance with Brotli and Gzip Compression | Clarive"
description: "We’re always looking for ways to help you squeeze every bit of performance out of your Clarive instance. That’s why we now recommend enabling both Brotli and Gzip compression in your NGINX configuration. With these two working in tandem, your web ass..."
url: "https://clarive.com/blog/enhance-your-clarive-server-performance-with-brotli-and-gzip-compression"
published: "2025-06-20"
author: "Ricardo Martinez"
---

# Enhance Your Clarive Server Performance with Brotli and Gzip Compression

We’re always looking for ways to help you squeeze every bit of performance out of your Clarive instance. That’s why we now **recommend** enabling both Brotli and Gzip compression in your NGINX configuration. With these two working in tandem, your web assets will be delivered faster, using less bandwidth—and your users will thank you for the speed boost!

## Why Enable Both Brotli and Gzip?

- **Brotli** often achieves better compression ratios than Gzip, especially on text-based assets like CSS, JavaScript, and HTML.
- **Gzip** has universal support across all browsers and proxies.
- By enabling both, you get the best of **both** worlds: modern browsers will pick Brotli, and older clients will fall back to Gzip.

## Step-by-Step: Update Your `nginx.conf`

- **SSH** into your Clarive server.
- **Backup** your existing configuration:

`cp /opt/clarive/config/nginx/nginx.conf /opt/clarive/config/nginx/nginx.conf.bak `

- **Open** the file in your favorite editor:

```text
`vi /opt/clarive/config/nginx/nginx.conf
`
```

- **Locate** the `http { … }` block near the top of the file.
- **Paste** the following lines **inside** the `http {` section, just below any existing `include` or `log_format` directives:

```text
`http {

# -------------------------------------------------------------------
# Clarive: Enable Brotli & Gzip Compression
# -------------------------------------------------------------------

brotli              on;
brotli_static       off;   # 'on' only if you have pre-compressed files
brotli_comp_level   4;
brotli_types        text/plain text/css text/javascript text/js
text/xml application/json application/javascript
application/x-javascript application/xml
application/xml+rss application/x-font-ttf
image/svg+xml font/opentype
font/woff font/woff2 font/woff3
application/x-font-woff;

gzip               on;
gzip_min_length    8000;              # only compress responses ≥8KB
gzip_comp_level    5;                 # compression level (1–9)
gzip_proxied       any;               # compress even when via a proxy
gzip_types         text/plain
text/css
application/json
application/javascript
application/xml
text/xml
image/svg+xml;      # MIME types to compress
gzip_vary          on;                 # add “Vary: Accept-Encoding”
gzip_buffers       16 8k;

# ... the rest of your http section ...
}
`
```

- **Save** the file and **exit** your editor.
- **Test** the new configuration and **reload** NGINX:

```text
`nginx -t && systemctl reload nginx
`
```

- Or use the Clarive nginx server restart if Nginx runs from Clarive itself

```text
`cla nginx-restart -c YOURCONFIG
`
```

## Enable HTTP2

Now, Brotli will only work if `http2` is enabled in your Nginx, and the browser on the other side also supports it (all modern browsers should).

Check your nginx configuration, add the `http2` attribute to any port you need it to listen to (if it's not there yet):

```text
`server {
listen 443 ssl http2;  # <----- http2 should be here to be enabled
...
}
`
```

## Verify Your Compression

After reloading, you can quickly check that Brotli and Gzip are working:

```text
`# Brotli test (modern browsers)
curl -H "Accept-Encoding: br" -I https://your-clarive-domain.com \
| grep -i content-encoding

# Gzip test (fallback)
curl -H "Accept-Encoding: gzip" -I https://your-clarive-domain.com \
| grep -i content-encoding
`
```

You should see `content-encoding: br` for Brotli and `content-encoding: gzip` for Gzip.

## Need Help?

If you hit any snags—or just want to chat about other optimizations—our support team is here for you. Drop us a line at [support@clarive.com](mailto:support@clarive.com) or open a ticket via the Clarive portal.

Happy compressing! ?
