Apache Module: Brotli


Last modified: March 12, 2024

Overview

The mod_brotli Apache module provides compression for the Apache HTTP server.

Note:

For information about using Brotli with NGINX®, read our NGINX with Reverse Proxy documentation.

Usage

This module can increase the loading speed and security of your web pages.

Important:

If you install this module, it applies to all virtual hosts.

Requirements

This module requires EasyApache 4, a secure (https) connection, and Apache 2.4.

Compatibility

This module possesses no known compatibility issues.

Configuration

cPanel & WHM sets the following configuration settings for the mod_brotli Apache module by default:

1
2
3
AddOutputFilterByType BROTLI_COMPRESS text/plain text/css text/html application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript
SetOutputFilter BROTLI_COMPRESS
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-brotli

You can edit the mod_brotli Apache module’s .conf file in the /etc/apache2/conf.d/brotli.conf file. For more configuration information, read Apache’s mod_brotli documentation.

How to install or uninstall the module

In the interface

The easiest way to install or uninstall the mod_brotli Apache module is to use WHM’s EasyApache 4 interface (WHM » Home » Software » EasyApache 4).

On the command line

To install the mod_brotli Apache module in EasyApache 4, run the following command on the command line:

Operating SystemCommand
CentOS 7yum install ea-apache24-mod_brotli
AlmaLinux OS and Rocky Linux™dnf install ea-apache24-mod_brotli
Ubuntu®apt install --purge ea-apache24-mod-brotli

To uninstall the mod_brotli Apache module in EasyApache 4, run the following command on the command line:

Operating SystemCommand
CentOS 7yum uninstall ea-apache24-mod_brotli
AlmaLinux OS and Rocky Linux™dnf uninstall ea-apache24-mod_brotli
Ubuntu®apt purge ea-apache24-mod-brotli

Additional Documentation