Install Brotli on Apache 2.4 on cPanel

[root@server /]# yum install brotli
Loaded plugins: fastestmirror, getpagespeed, universal-hooks
Loading mirror speeds from cached hostfile
epel/x86_64/metalink | 8.6 kB 00:00:00

  • EA4:
  • cpanel-addons-production-feed:
  • cpanel-plugins:
  • base:
  • epel:
  • extras:
  • updates:
    Resolving Dependencies
    –> Running transaction check
    —> Package brotli.x86_64 0:1.0.7-5.el7 will be installed
    –> Finished Dependency Resolution

Dependencies Resolved


Package Arch Version Repository Size

brotli x86_64 1.0.7-5.el7 epel 318 k

Transaction Summary

Install 1 Package

Total download size: 318 k
Installed size: 1.5 M
Is this ok [y/d/N]: y
Downloading packages:
brotli-1.0.7-5.el7.x86_64.rpm | 318 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : brotli-1.0.7-5.el7.x86_64 1/1
Verifying : brotli-1.0.7-5.el7.x86_64 1/1

brotli.x86_64 0:1.0.7-5.el7


Now go to Home »Service Configuration »Apache Configuration >> Include Editor >> Pre main include

Add below entries and save a

<IfModule mod_brotli.c>
    AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/xml text/css text/javascript application/x-javascript application/javascript application/json application/x-font-ttf application/ image/x-icon

Check using below command to find encoding. It should show br

[root@server /]# curl -I -H ‘Accept-Encoding: br’
HTTP/1.1 200 OK
Date: Wed, 28 Oct 2020 14:31:36 GMT
Server: Apache
Link:; rel=””
Vary: Accept-Encoding
Content-Encoding: br
Content-Length: 1
Content-Type: text/html; charset=UTF-8

[root@server /]#