Enable gzip compression

You can use a site like gtmetrix.com to check if your site has gzip compression enabled properly.

You can use these tools:

check for gzip compression on HTML output of pages.

You can enable gzip compression for CSS and JavaScript files also. Apart from that any text data, e.g. XML files will also benefit from gzip compression. However, never turn on gzip compression on images or any kind of binary data.

Enable Gzip Compression

Most likely gzip is enabled on your server. If not, you can following codes in /etc/nginx/nginx.conf

	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_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

Most important lines are gzip on and gzip_types

gzip on turns on gzip compression. Later on, you can add gzip off under a server{..} block or location{..} to turn off gzip compression for one or more sites/regions.

gzip_typesis list of MIME-types for which you want to turn on compression. text/html is implied and cannot be turned off (unless you set gzip off). text/css and application/x-javascript enables gzip compression for CSS and javascript files respectively.

Reference: gzip documentation