Question

How to enable GZIP compression on a droplet with Openlitespeed WordPress installation?

I am a noob! So, I need some help. I installed Openlitespeed WordPress from the Marketplace on a droplet with Ubuntu. I never had any idea that LSCache doesn’t have the option of GZIP compression. I want to enable it without using an additional plugin. Can anyone guide me? As I said, I am a noob. Some help with a simple explanation or a step-by-step guide will be really helpful.

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

HI @shivaranjanibaidya ,

You can ignore the compression alert from Pingdom since they don’t support brotli from the first beginning. If you test on GTMetrix, all shows score A (98%). I also didn’t see any issue on Pagespeed Insights.

Currently your static files are served by cloudflare, so if you see “Serve static assets” again, you might want to look into your CDN settings.

Best, Eric

@eleu, The url is https://www.listmos.com/. Can you please go through it once? Not all resources. I guess a few of them.

Hi @shivaranjanibaidya ,

I just want to provide some information here for OpenLiteSpeed gzip question.

The OpenLiteSpeed comes with both Gzip/Brotli compression enabled, so you don’t need to do anything. That’s why LSCache Plugin has no such feature.

FYI, Browser cache is also enabled by default on server level.

Best, Eric

Hi @shivaranjanibaidya,

Gzip compression is enabled by default if I’m not mistaken. Having said that it’s usually hidden by the PHP settings. You’ll need to edit the following line in your PHP.ini file

;zlib.output_compression_level = -1

You’ll need to enable it like so

zlib.output_compression_level = 1

After you do, you can restart apache/nginx and everything should be working.

As for the Gzip compression, as far as I know, OpenLiteSpeed supports .htaccess so you should be able to add the following in your .htaccess file for your website :

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"
</IfModule>
 
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

Regrads, KFSys