How to install mod_brotli on Directadmin CentOS 8

Just like gzip, Brotli is also a compression algorithm. It is developed by Google and serves best for text compression. The reason being, it uses a dictionary of common keywords and phrases on both client and server side and thus gives a better compression ratio. The advantage for Brotli over gzip is that it makes use of a dictionary and thus it only needs to send keys instead of full keywords. It is supported by all major browsers. Fewer bytes transferred not only leads to faster page load but also helps in reducing costs of Content Delivery Network (CDN).

Install Brotli

  • dnf install epel-release and enable the repo
  • Installed Brotli package on Centos 8 (dnf install brotli brotli-devel)
  • Added brotli module to apache for custombuild, following: https://help.directadmin.com/item.php?id=191 (–with-brotli)
  • Check if the brotli module is really active in Apache:
    httpd -t -D DUMP_MODULES

Brotli Compression Installed But Not Available In W3TC

https://wordpress.org/support/topic/brotli-compression-installed-but-not-available-in-w3tc/

https://github.com/kjdev/php-ext-brotli

Add Brotli extension to PHP 7.4

sudo touch /usr/local/php74/lib/php.conf.d/php-brotli.ini && echo extension=brotli.so > /usr/local/php74/lib/php.conf.d/php-brotli.ini
systemctl restart php-fpm74

W3 Total Cache

Enable Brotli Compression in W3 Total Cache > Browser Cache.

Disable Gzip Compression in W3 Total Cache > Browser Cache.

Test Brotli

https://tools.keycdn.com/brotli-test

https://www.brotli.pro/


Vincent Verloop

Ervaren ICT Professional met een bewezen geschiedenis van werken in de IT- en dienstensector. Bekwaam in OS X, Search Engine Optimization (SEO), PHP, WordPress en Domain Name System (DNS). Sterke media- en communicatieprofessional met een diploma MBO niveau 4 gericht op ICT-beheer / ICT-beheerder. Volg Vincent Verloop op Twitter.

Leave a Reply

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