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).
- 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
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.