Enable GZIP compression in NGINX

Edit NGINX configuration file in /etc/nginx/nginx.conf

Search for gzip and you will find something looking like this:

##
# `gzip` Settings
#
#
gzip on;

(...)

And you should change the contents to:

##
# `gzip` Settings
#
#
gzip on;
gzip_disable "msie6";

gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;

Resources

Taken from: https://www.digitalocean.com/community/tutorials/how-to-add-the-gzip-module-to-nginx-on-ubuntu-14-04

Reference: NGINX Docs