
Text-based assets — HTML, CSS, JavaScript, JSON, XML — compress extremely well. A typical uncompressed 100 KB JavaScript file compresses to 25-35 KB with Gzip (65-75% reduction) and 20-28 KB with Brotli (72-80% reduction). For a WordPress page loading 400-500 KB of JS and CSS, compression routinely saves 250-350 KB per page view — reducing Time to First Byte and reducing bandwidth costs simultaneously.
Gzip is supported by every browser and every CDN. Brotli is supported by all modern browsers and achieves better compression ratios — particularly for HTML and JavaScript. The practical approach is to enable both: Nginx serves Brotli to browsers that support it (sent via the Accept-Encoding: br header) and falls back to Gzip for older clients.
Gzip is built into Nginx — no module installation needed. Add the following to the http block in /etc/nginx/nginx.conf. Setting gzip_comp_level 5 is the sweet spot — higher levels use significantly more CPU for minimal additional compression.
Brotli is not included in the default Nginx package. On Ubuntu 24.04, the libnginx-mod-http-brotli-filter and libnginx-mod-http-brotli-static packages are available in the repositories alongside Nginx.
The Brotli module packages are only available if you installed Nginx from Ubuntu's default repositories (not from nginx.org's PPA). If you installed from the official Nginx PPA, you will need to compile the Brotli module from source using ngx_brotli from Google's GitHub repository.
Once installed, enable Brotli in the same http block alongside your Gzip settings. Brotli levels run from 0-11; level 4 gives excellent compression with low CPU overhead. Level 11 achieves maximum compression but is too slow for on-the-fly dynamic content — use it only for static file pre-compression.
Test with curl by sending the Accept-Encoding header that browsers send. The response should include Content-Encoding: br for Brotli or Content-Encoding: gzip for Gzip.
When you provision a server through CloudStick, Nginx is configured with Gzip compression enabled from the start. The default config applies compression to all appropriate MIME types and uses the level 5 setting that balances CPU overhead against compression ratio. You do not need to manually configure these settings — they are part of CloudStick's baseline server configuration.
For Brotli, you can add the packages and configuration above to any CloudStick-managed server — the agent does not prevent manual Nginx config additions. Just ensure your additions go in the correct block context and validate with nginx -t before reloading.


We use cookies to improve your experience
CloudStick uses cookies to personalise content, analyse traffic and keep you signed in. Cookie Policy · Terms of Service