Gzip not compressing
r at roze.lv
Sat Sep 7 14:09:47 UTC 2019
> Here is the situation posted in DO community.
> Thanks for any help.
Well you are testing in a wrong way. First of all:
curl -H "Accept-Encoding: gzip" -I http://localhost/test.jpg
HTTP/1.1 301 Moved Permanently
Server: nginx/1.10.3 (Ubuntu)
Date: Wed, 04 Sep 2019 18:12:38 GMT
You see that the request is actually redirect (301) and curl doesn't follow it (it's the same with your second attempt).
Also even the response wasn't a redirect it's less than the configured minimal object size for compression (there is generally no sense compressing small objects as you waste more cpu than save traffic. I would suggest increasing it to at least 1Kb):
At last while the content type of particular request is text/html if there was an actual jpg image returned then because of the:
.. directive nginx wouldn't compress the file (as there is no 'image/jpeg' included). Besides it doesn't make sense to gzip jpeg as the image format is already compressed.
Hope that helps.
More information about the nginx