---
title: "Installing mod_brotli"
source: "https://docs.nexcess.com/hosting/server-administration/linux/apache-web-server/installing-mod_brotli/"
description: "Install & configure `mod_brotli` on Apache. Learn to enable Brotli compression, verify it, and manage its preference over Gzip for faster sites."
vertical: "Hosting"
date: "2025-05-28"
last_modified: "2026-07-29"
---

# Installing mod_brotli

Improving your website’s loading speed is essential for a good user experience and better search engine rankings. One effective way to achieve this is through compression, which reduces the size of files sent from your server to visitors’ browsers. While Gzip compression is widely used, **Brotli** is a newer algorithm specifically designed for web content compression. mod\_brotli enables your Apache web server to utilize this technology.

#### **Installation**

This section covers the installation of mod\_brotli.

For systems using **EasyApache 4**, you can install mod\_brotli using your package manager.

yum install ea-apache24-mod\_brotli ea-brotli

For those using cPanel you can get the instructions for it here.

[https://docs.cpanel.net/ea4/apache/apache-modules/apache-module-brotli](https://docs.cpanel.net/ea4/apache/apache-modules/apache-module-brotli)

#### **Is it working?**

To check if mod\_brotli is working and the server is delivering content compressed with Brotli, you can use the curl command, specifying that you accept Brotli encoding.

```
curl -H "Accept-Encoding: br" -I http://www.domain.com/
```

If it’s working correctly, you should see a header in the output indicating Content-Encoding: br.

```
Content-Encoding: br
```

#### **Potential conflicts with mod\_deflate**

You might wonder if mod\_brotli conflicts with Mod\_Deflate (which provides Gzip compression). According to the sources, **no, this will not conflict**. mod\_brotli simply provides the server with **another method of compression** to offer to clients.

#### **Server preference: Brotli or Gzip?**

When both mod\_brotli and Mod\_Deflate are configured, how does the server decide which compression method to use? You can test which one the server is preferring by using curl and specifying that you accept both gzip and br encoding.

```
curl -H "Accept-Encoding: gzip br" -I http://www.domain.com/
```

The server will respond with the header indicating which encoding it chose. For example, if it prefers Gzip, you would see:

```
Content-Encoding: gzip
```

#### **Changing server preference**

The server’s preference is determined by the order of the configuration entries in the Apache configuration files. If the mod\_deflate entries appear *above* the mod\_brotli entries in the configuration, Gzip will be preferred. Conversely, if mod\_brotli entries are *above* mod\_deflate, Brotli will be preferred. To change the server’s preference, you simply need to **change the order of these configurations**.

#### **Browser compatibility**

**Most modern browsers support Brotli compression**. A list of compatible browsers can often be found [online](https://en.wikipedia.org/wiki/Brotli#Browsers_and_other_clients) . If you require support for **legacy browsers**, it is important to **ensure Mod\_Deflate is also configured**, keeping in mind the preference setting mentioned above. This allows the server to fall back to Gzip for browsers that do not support Brotli.
