Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk10 min

How to Enable Brotli Compression on Your Linux VPS

Enable Brotli correctly on a Linux VPS with NGINX or Apache: install the right module, configure text MIME types, validate and reload, serve pre-compressed assets, verify Content-Encoding, and assess security and CPU trade-offs.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Enable Brotli in the web server that terminates HTTP: install a compatible NGINX Brotli module or Apache’s mod_brotli, restrict compression to text responses, validate the configuration, reload the service, and verify that clients receive Content-Encoding: br. Brotli is not a VPS-wide switch; it is a server-module configuration, and runtime compression uses CPU.

What Brotli compression does on a VPS

Brotli is a lossless compression format for HTTP responses. The web server compresses eligible content before sending it, while the browser advertises support with the Accept-Encoding request header. When negotiation succeeds, the response should include Content-Encoding: br. A client that does not advertise Brotli must receive an uncompressed response or another encoding the server supports.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Compression is generally appropriate for text-like payloads such as HTML, CSS, JavaScript, JSON, XML, SVG and plain text. JPEG, PNG, GIF, WebP, video, ZIP and other already-compressed formats normally gain little and consume CPU when compressed again. Brotli therefore needs an explicit server configuration rather than a blanket “compress everything” setting.

The exact steps depend on whether the VPS runs NGINX or Apache HTTP Server:

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
Server Required component Configuration model Reload check
NGINX A Brotli filter module; a static module is optional for pre-compressed files load_module in the main context, then brotli directives in http, server or location nginx -t, then nginx -s reload
Apache HTTP Server mod_brotli (available in Apache 2.4.26 and later) AddOutputFilterByType BROTLI_COMPRESS for selected MIME types, or broader SetOutputFilter scope with exclusions Use the platform’s Apache configuration test and graceful reload procedure

Before changing production settings, identify the distribution, web server, and configuration layout, and make sure you can restore the previous file. Package names and module paths vary between distributions and between vendor builds.

Enable Brotli in NGINX

1. Install a module that matches your NGINX build

Stock distribution repositories do not all ship the same Brotli package. Install a module compiled for the NGINX version and ABI on the VPS; do not copy a shared object from an unrelated server. F5’s NGINX Plus documentation uses the package name nginx-plus-module-brotli and shows this Debian/Ubuntu command:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo apt update
sudo apt install nginx-plus-module-brotli

RHEL-family systems use the corresponding yum or dnf package workflow. The package must provide the HTTP Brotli filter module. If you also intend to serve files that were compressed during a build, install the package’s static-module component as well, when supplied separately.

After installation, locate the module files and confirm that their paths match the directives you will add. A module built for another NGINX release can prevent the service from starting, so treat an “incompatible version” or “module is not binary compatible” message as a packaging problem rather than a syntax problem.

2. Load the filter and optional static modules

Put dynamic-module directives in the main context of nginx.conf, before the http block. The documented module names are:

load_module modules/ngx_http_brotli_filter_module.so;
load_module modules/ngx_http_brotli_static_module.so;

The filter module performs compression at request time. The static module is only needed when NGINX should serve a matching pre-compressed file, such as app.js.br, instead of recompressing the original file.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Some packages install modules in a distribution-specific directory. In that case, use the absolute or package-provided path rather than the example relative path. Do not add a load_module line if your vendor build already compiles Brotli into NGINX or loads it from an included module file; duplicate loading causes an error.

3. Turn on compression and select MIME types

Inside the http, server or location context, add:

brotli on;
brotli_types text/plain text/css application/javascript application/json application/xml image/svg+xml;

The Google ngx_brotli documentation states that text/html is always compressed and that brotli_types adds MIME types. The list above therefore extends compression to common text formats; it does not mean every response will be compressed. The response’s actual Content-Type, the client’s Accept-Encoding header, cache behavior and other server rules still determine the result.

Keep the list deliberately narrow at first. Add a type only when it is genuinely text-based and you have checked that the application does not already encode or stream it in a way that makes compression unsuitable. Do not add image, archive or video MIME types merely because they are common files.

4. Decide whether to serve pre-compressed files

If the deployment process creates files such as main.css.br and main.js.br alongside their originals, enable the static module and add:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
brotli_static on;

Use this only when the matching .br files are reliably generated, deployed and kept in sync with the originals. A missing or stale sidecar file can produce an unexpected result. If assets are not pre-compressed, leave brotli_static off and let the filter module compress eligible responses dynamically.

5. Test the configuration and reload NGINX

Run the syntax test before touching live workers:

nginx -t

Proceed only when the command reports a successful configuration test. Then perform a graceful reload:

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
nginx -s reload

Watch the service and error logs immediately afterward. Module-load failures, an incorrect shared-object path, duplicate loading and directives placed in the wrong context are common reasons for a failed reload. If the test fails, restore the previous configuration, correct the reported line or module package, and test again before reloading.

Enable Brotli in Apache HTTP Server

1. Confirm the Apache version and module

Apache HTTP Server 2.4.26 and later provide mod_brotli. The Apache Software Foundation describes it as the module that supplies the BROTLI_COMPRESS output filter, allowing server output to be compressed in Brotli before it is sent over the network.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Enable the module using the mechanism supplied by the VPS distribution or Apache build, and confirm that the running service has loaded it. Package names and module-loading files differ by operating system, so use the module package and include structure shipped for that installation rather than copying a directive from a different layout.

2. Compress selected text responses

For Apache 2.4.26 and newer, the documented MIME-type approach is:

AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/xml text/css text/javascript application/javascript application/json

This keeps the filter attached to the listed text-oriented content types. Add other text formats only after checking the application response headers. The directive can be placed in the server or virtual-host configuration, and in contexts permitted by the installation’s override policy.

3. Use broad filtering only with exclusions

Apache also documents a broad form:

SetOutputFilter BROTLI_COMPRESS
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-brotli

SetOutputFilter applies the filter more widely, so exclusions become your responsibility. The example excludes common raster images, but a production policy should also avoid archives, video and any other formats that are already compressed or are unsuitable for on-the-fly processing. Restricting the filter by MIME type is usually easier to audit than applying it globally and maintaining an ever-growing exclusion list.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

4. Reload safely

Run the Apache configuration test supplied by your distribution, correct every error it reports, and then perform a graceful reload through the service manager or Apache’s supported reload command. Check the error log for module-load failures and verify the virtual host that actually serves the test URL; editing an unused configuration file will not change the response.

Dynamic compression versus pre-compressed assets

Dynamic compression is convenient: the server receives the original response, compresses it and sends it when a client requests it. That work is repeated for subsequent requests unless another cache layer stores the encoded representation. Apache’s documentation warns that mod_brotli recompresses content each time a request is made, so pre-compressing content can provide a performance benefit by avoiding repeated compression work.

Pre-compression moves the CPU cost to the build or deployment stage. It is a strong fit for versioned, immutable CSS, JavaScript, SVG and other static assets. The server must select the .br representation only for clients that advertise Brotli and must preserve the correct response metadata:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Content-Encoding: br identifies the representation sent on the wire.
  • Vary: Accept-Encoding tells shared caches that the response differs according to the client’s encoding support.
  • The uncompressed original or another supported encoding remains available for clients that do not send Accept-Encoding: br.

Apache’s pre-compression example explicitly appends Vary Accept-Encoding. Apply the same cache principle when implementing an equivalent NGINX or CDN rule. Purge or invalidate stale representations when an asset is replaced, especially if the URL is not content-hashed.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Verify that the VPS returns Brotli

Test a known text response, not an image or archive. The following request asks for headers while advertising Brotli support:

curl -I -H 'Accept-Encoding: br' https://example.com/asset.css

For a compressible response, look for:

  • Content-Encoding: br.
  • Vary: Accept-Encoding when a shared cache can store the response.
  • A text-oriented Content-Type, such as text/css or application/javascript.

A successful response without Content-Encoding: br is not automatically a fault. The URL may return a type you did not enable, the request may have been handled by a different virtual host, a CDN may have supplied a cached variant, or the module may not be loaded.

Run a control request without Brotli support:

curl -I https://example.com/asset.css

The server should return an uncompressed representation or a fallback encoding that the client requested. If it still returns Content-Encoding: br, inspect an intermediary cache and the request headers; a shared cache that ignores Vary can deliver the wrong representation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

After testing, review NGINX or Apache logs for syntax, module-load, permission and upstream errors. Test both a static asset and a dynamic HTML or JSON endpoint if your policy covers both, because separate locations and virtual hosts can have different directives.

Troubleshoot the common failure modes

The configuration test says the Brotli directive is unknown

  • Verify that the filter module package is installed for the running NGINX build, or that Apache’s mod_brotli is enabled.
  • For NGINX, check that the load_module line is in the main context and points to an existing, ABI-compatible shared object.
  • Confirm that you edited the configuration file actually included by the service.

The module loads, but the response is not Brotli-encoded

  • Check the response’s Content-Type against brotli_types or Apache’s AddOutputFilterByType list.
  • Confirm the client sent Accept-Encoding: br.
  • Check for a more specific location, virtual-host rule, proxy response or CDN cache that bypasses the compression setting.
  • Make sure the reload completed successfully and that the worker processes use the new configuration.

Pre-compressed files are ignored or served incorrectly

  • On NGINX, verify that the static module is loaded and brotli_static on; is in the scope handling the asset.
  • Confirm the sidecar filename matches the requested original exactly and is present on the active server.
  • Ensure the response sends Content-Encoding: br and that caches vary on Accept-Encoding.
  • Remove stale sidecars during deployment so an old compressed file cannot outlive its source.

CPU use rises after enabling compression

Runtime compression consumes CPU, and the cost depends on response size, request rate, compression settings and the VPS’s available cores. Start with static text assets and ordinary responses, measure CPU and latency in your own workload, and move high-traffic immutable assets to build-time pre-compression where practical. No universal compression-ratio or latency percentage applies to every VPS.

Security: account for BREACH-style exposure

Apache’s documentation warns that some web applications are vulnerable to information-disclosure attacks when a TLS connection carries compressed data. This class of issue is commonly associated with BREACH-style attacks: an attacker observes compressed response sizes while influencing reflected input and may infer a secret embedded in the response.

Do not treat Brotli as harmless merely because it is newer than another compression format. Review pages that combine compression, TLS, attacker-controlled input and secrets such as CSRF tokens, session identifiers or other sensitive values. A cautious rollout starts with static assets and ordinary text responses, then expands only after the application’s sensitive endpoints have been assessed. Possible mitigations include excluding those responses from compression, avoiding reflection of secrets and separating secret-bearing content from attacker-controlled text; select controls appropriate to the application rather than disabling Brotli indiscriminately.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

NGINX or Apache: which setup fits your VPS?

Decision point NGINX Apache
Module availability Install a distribution- and build-compatible Brotli filter module; NGINX Plus documents nginx-plus-module-brotli. Use mod_brotli with Apache 2.4.26 or later.
Dynamic compression brotli on; with MIME additions through brotli_types. AddOutputFilterByType BROTLI_COMPRESS for selected types.
Pre-compressed files Load the static module and set brotli_static on;. Use a pre-compression arrangement that supplies Content-Encoding: br and varies caches on Accept-Encoding.
Scope control Choose http, server or location scope and keep the MIME list explicit. Prefer MIME-type filtering; broad SetOutputFilter requires exclusions.
Operational check nginx -t, then nginx -s reload. Run the installed Apache configuration test, then a graceful reload.
Security consideration Both can expose sensitive TLS responses to compression side-channel risk; review secret-bearing endpoints before enabling broad coverage.

A practical rollout checklist

  1. Identify the active web server, distribution and virtual host serving the target URL.
  2. Install a module built for that server version and confirm its load path.
  3. Start with HTML and a small set of text MIME types; exclude already-compressed media and archives.
  4. Choose dynamic compression for changing responses or pre-compression for immutable build artifacts.
  5. For pre-compressed assets, provide matching .br files, send Content-Encoding: br and configure cache variation on Accept-Encoding.
  6. Run the server’s configuration test before reloading.
  7. Reload gracefully and inspect logs for module or syntax errors.
  8. Verify a text asset with curl -I -H 'Accept-Encoding: br', then test a client without Brotli support.
  9. Measure CPU and response behavior under normal traffic.
  10. Review TLS endpoints that reflect user input or contain secrets before expanding the compression scope.

Bottom line

On NGINX, install and load the compatible Brotli filter module, enable brotli on, add only suitable MIME types, and optionally use brotli_static for build-generated files. On Apache 2.4.26 or later, enable mod_brotli and attach BROTLI_COMPRESS to selected text responses. Validate and reload before testing, confirm Content-Encoding: br and cache variation with curl, and keep CPU cost and BREACH-style exposure in scope as you expand beyond static assets.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.