How to enable Nginx gzip compression

V Records 1,445 Views No comment

After the server is configured, you also need to enable gzip to compress the returned data to speed up the loading of the site.

Here’s how to enable gzip on Nginx (add it to the configuration file):

More detailed configuration reference: http://nginx.org/en/docs/http/ngx_http_gzip_static_module.html

how to set the gzip compression level?This will be more confusing.Someone did the test:

text/html – phpinfo():

application/x-javascript – jQuery 1.8.3 (Uncompressed):

It can be seen that when the compression level is greater than 1, the effect slowly declines. It is recommended to use compression level 2.

Some tools that can be used for testing:

https://developers.google.com/speed/pagespeed/insights/
https://varvy.com/tools/gzip/


This article was first published by V on 2018-10-06 and can be reprinted with permission, but please be sure to indicate the original link address of the article :http://www.nginxer.com/records/how-to-enable-nginx-gzip-compression/

Leave a Reply

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

Go