Author Topic: nginx and brotli  (Read 447 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
nginx and brotli
« on: July 11, 2024, 08:42:46 PM »
Hi everyone,
I recently installed CWP7pro (and I must say that I really like it) in my centOS 8 and I'm new to the Forum.
Congratulations for the forum, it's really full of useful information :)
From my CWP I chose to use the "Nginx & Varnish & Apache" webserver. The Nginx version installed is 1.14.1; I have a desire to install and activate the "brotli" compression modules.
I'm trying with online tutorials, but when I succeed, Nginx goes into error because the version in use is older than the one required by the "brotli" modules.
So I think I have two possibilities:
1. find an installation guide to install the "brotli" for Nginx version 1.14.1;
2. find a guide for updating Nginx to the latest version available and then install "brotli".
Has anyone already faced and solved this problem?
Thanks in advance for any suggestions.
Regards,
Renato

Offline
*
Re: nginx and brotli
« Reply #1 on: July 15, 2024, 02:08:55 PM »
Hi everyone,
I've made some progress, so I'll update you.
The Nginx 1.14.1 version installed by CWP is probably not recent enough for Brotli.
So first I updated Nginx to version 1.27.0 following this video: https://www.youtube.com/watch?v=jdb1xNFno-0&t=268s
Once this was done I installed Brotli following this tutorial: https://www.howtoforge.com/how-to-enable-brotli-compression-in-nginx-on-centos-8/

Now when I load a wordpress page, the page header says "Content-Encoding: br" which should mean that Brotli is running.
I have one last problem to solve to be satisfied.
The plugin I use for cache management is called "W3 Total Cache". To allow me to activate Brotli Compression, it requires loading the extension in the php.ini;
Reading online, it seems that all you need to do is enter the following: extension=brotli.so
I did it, unfortunately phpinfo(); it doesn't show me the extension among those loaded. I don't know what else to do.

I noticed something.
In the "PHP PECL extensions" section, in "Packages Availables", there is the possibility of installing the Brotli extension directly from the Administration Panel, but only if the default PHP version is 5.6, which however is not compatible with Brotli .
So I entered the default PHP version 8u.3.8, but the "Channels" and "Packages Availables" lists are empty.
I do not know what to do. At this point I'm stuck.

Offline
*
Re: nginx and brotli [SOLVED]
« Reply #2 on: July 15, 2024, 05:39:52 PM »
I finally solved the problem.
For each activated php version (7.0+), you need to copy brotli.so into the modules folder and in each php.ini you need to add "extension=brotli.so".
It was hard, but I finally did it :-)