One way to enhance a site performance is to deliver part of the content (html, css, javascript, xml) compressed. To do that on Apache, there is the mod_deflate. And how to do that on NGINX?

This page explains and shows which configurations are default for compression on NGINX. To work with what is written on it, we have to open /etc/nginx/nginx.conf:

With the code above, the content compression of specified types will be on, right after restarting NGINX (sudo /etc/init.d/nginx restart). But what now? How to test if the content is really being delivered compressed?

I’ll show two methods (there lots of methods):

1 – Access this page and type your domain to know if went right or not.

2 – With Google Chrome, open the Developer Tools, click on Network tab and refresh (F5) the page. Notice the Size tab that shows the size in black (compressed size) and the size in gray (real size), besides clicking on the file name and looking on HEADERS tab that GZIP is mentioned.

All set, you are delivering compressed content and getting better performance from the sites that are hosted on your NGINX server.

One thought on “GZIP compression on NGINX

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.