How To Enable Text Compression Using gzip And Nginx To Improve Website Performance

I was checking my website performance on Google PageSpeed Insights when I noticed a recommendation to enable text compression. 

What made this looks great was the potential saving of 3.3 seconds from the page load time.

To enable text compression, it's a fairly easy step.

Simply open the Nginx configuration file in the Nano editor:

sudo nano /etc/nginx/nginx.conf

Mine had already the configurations by default, but they were commented out:

I simply uncommented these settings and saved the file using CTRL+o then CTRL+X.

Finally, I restarted Nginx using the following command:

sudo systemctl restart nginx

After running the speed text again on the same page, the results fascinated me!

That is it :) Enjoy your new website's speed :)

About The Author
Author Avatar
Mohamed AbdelGawad

IT Automation Specialist

Hi and welcome to my blog where I like to record and document the technical issues I tackle and the solutions I apply. Hopefully, it will make someone's life easier.

I'd love to hear your thoughts...

Get in Touch.

Whether you have a question or just want to say hi, I’ll try my best to get back to you as soon as possible.