Friday, September 17, 2021

Enabling brotli compression

httpd -v

apt-get install brotli

apt-get install build-essential

apt-get install apache2-dev

sudo apt-get install libtool m4 automake


git clone --depth=1 --recursive https://github.com/kjdev/apache-mod-brotli.git

cd apache-mod-brotli

./autogen.sh

 ./configure

 make

 install -D .libs/mod_brotli.so /usr/lib/apache2/modules/mod_brotli.so -m 644

 

//Now copy the built build to the module folder

cp mod_brotli.so /opt/lampstack-7.4.7-0/apache2/modules/mod_brotli.so

sudo chmod 755 apache2/modules/mod_brotli.so

 

Add the following line in httpd.conf

LoadFile modules/mod_brotli.so

LoadModule brotli_module modules/mod_brotli.so


Check whether the module is loaded

apachectl -M


Make sure that the specific file to use brotli compression inside the httpd.conf file

<Location/>

BrotliCompressionLevel 4

    AddOutputFilterByType BROTLI text/html text/plain text/xml text/x-js text/css text/javascript application/javascript font/ttf font/woff

</Location>


<IfModule brotli_module>

 BrotliCompressionLevel 4

 AddOutputFilterByType BROTLI text/html text/plain text/css text/xml

 AddOutputFilterByType BROTLI text/css

 AddOutputFilterByType BROTLI application/x-javascript application/javascript

 AddOutputFilterByType BROTLI application/rss+xml

 AddOutputFilterByType BROTLI application/xml

 AddOutputFilterByType BROTLI application/json

</IfModule>


//Restart the server

./ctlscript.sh restart


//Testing

curl -I -H 'Accept-Encoding: gzip,deflate,br' https://casino.9fun.live

HTTP/1.1 200 OK

Date: Sat, 18 Sep 2021 06:50:45 GMT

Content-Type: text/html; charset=UTF-8

Connection: keep-alive

x-frame-options: SAMEORIGIN

x-powered-by: PHP/7.4.7

cache-control: no-cache, private

set-cookie: XSRF-TOKEN=eyJpdiI6InRFQVFQOWJ6cnV3SS9hTUpKSnc3RUE9PSIsInZhbHVlIjoiSEF6VzZqYUxySlRRK1E5K0ZHdVd0MUFtOEV1akpSNURoTmVuMFJRaWREaDE3Rk5JL1h0TFBjc1k1c0Y2OExCb3VFSVl2enZhbGFXODJMUHluMEVNbFJSeXgvbXJoTFVSSFhjRCtmM04zSGlTZ2xjM0cxVEdXUWxOOGZOOU1iV2giLCJtYWMiOiIzZGUzYTk5NTMzNDcyYzM5NzM2YmE2ZTA1ZmUyZmM4MWU2MjVlYzZkNWY4NWY2ZWVlZmI1NzZhYTIwYzViODZiIn0%3D; expires=Sat, 18-Sep-2021 08:50:45 GMT; Max-Age=7200; path=/; samesite=lax

CF-Cache-Status: DYNAMIC

set-cookie: laravel_session=eyJpdiI6Iitua2J6YTBhYkRTVDNwbkluWDRmdHc9PSIsInZhbHVlIjoiNG9TOTdFOWc5b3BwTG1Pcmx0MnQrZForWjBJRE1TcW9XQ3FOUnhEWGJ4N1JjL2hDZ2FIblk4YTlWcUdSYytFbWRMWnpoaXpvczc5N1YxMWxGWEk4RVVXQ01KSFdMRVBLZk0xc2x6cjYyK1ZlOFpGbzRST1BzcWg5UWxRVVBLRE8iLCJtYWMiOiIyNjEyOWEzYzFjMDE3ZjgzNTdmOTg0MDM5ZjAxNTA1ZTc4ZDZkMTMxYzkzNDhmN2M1NDczYWY3YTlhNjZkNTdlIn0%3D; expires=Sat, 18-Sep-2021 08:50:45 GMT; Max-Age=7200; path=/; httponly; samesite=lax

Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"

Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=pQZwuzVHNQv7yypPcMlhM1ndMFypycv5HPeQMB53IjoK%2Bot2cl7aDywhOBnY%2F%2FAOA0rVz4BuLt0THWhP2syuv09Kd5by2mooF3ufiCWzK1cw57qqXGt2bsKBDNQr%2B9Vt8bgC"}],"group":"cf-nel","max_age":604800}

NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}

Server: cloudflare

CF-RAY: 6908a454ccf84a5f-SIN

Content-Encoding: br

alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400, h3-28=":443"; ma=86400, h3-27=":443"; ma=86400