Enable GZIP Compression on nginx Servers

Enabling GZIP compression on Nginx servers is easy and it improves application performance as well as saves bandwidth transfer.

By following below steps you can enable GZIP on your virtual private server with simple configuration changes.

First step is edit nginx.conf file, that could be located /etc/nginx/nginx.conf or /usr/local/nginx/conf/nginx.conf, in most distributions.

Open nginx.conf file with your favorite editor. You can see that there’s already a block of settings regarding Gzip; you could always just modify those and un-comment out the lines as shown below –

Once your done with above config changes, restart or reload your server and you will now be serving site assets with gzip compression.

Apart from above benefits, Google takes site speed into account when ranking and placing your sites in their search engine.

To test if gzip is enabled, run:

You should see content-encoding: gzip

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

I am Arjun from Hyderabad (India). I have been working as a software engineer from last 7+ years, and its my passion to learn new things and implement them as a practice. Aside from work, I likes gardening and spending time with pets.
DMCA.com Protection Status