How to enable gzip compression on an NGINX server

Background

Enabling compression on your web site will serve your website a lot faster. To check if you have compression enabled, use the tool in the references below. If the servers on which you are hosting is NGINX, then use check the following file for the compressions parameters:

cat /etc/nginx/nginx.conf

##
# Gzip Settings
##

gzip on;

# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

In the example above GZIP compression has been enabled, but not customized. In 99% of situations this should be sufficient.

Leave us a comment if you have any GZIP / NGINX compression tips.

See also

How to enable gzip compression on an Apache server

References

https://www.giftofspeed.com/gzip-test/

Share this article

Leave a Reply

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

Scroll to Top