> Here is the situation posted in DO community.
> https://www.digitalocean.com/community/questions/enabling-gzip-compression-guidance-needed
> 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
Content-Type: text/html
Content-Length: 194
Location: https://radha.org.br/test.jpg

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):

gzip_min_length 256;


At last while the content type of particular request is text/html if there was 
an actual jpg image returned then because of the:

gzip_types text/plain text/css application/json application/x-javascript 
text/xml application/xml application/xml+rss text/javascript 
application/vnd.ms-fontob$fontobject application/x-font-ttf font/opentype 
image/svg+xml image/x-icon;


.. 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.

rr



_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to