Gzip not compressing

Reinis Rozitis r at roze.lv
Sat Sep 7 16:57:02 UTC 2019


> I am trying to reduce transfer size in my website. Although i apparently have
> enabled Gzip compression, i does not show as enabled in GTmetrix testing.

For testing purposes just putting:

gzip  on;
gzip_types        text/html text/plain text/xml text/css application/javascript application/json;

in http {} block (and reloading nginx) should be enough to enable gzip (obviously add whatever other types you need like svg / fonts).

Other directives can be specified later for finetuning.


> i does not show as enabled in GTmetrix testing.

You should check which resources the testing tool expects to be compressed (maybe all of those come from external sites?).

Also not all of the recommendations are (very) important. 
For example the testing tool for one of my site complains - manifest.json could save 92B (32% reduction). While the 32% percentage looks reasonable the actual gain of 92 bytes doesn't make much sense to compress the file on server side / decompress on client side.

rr



More information about the nginx mailing list