Reinis Rozitis
September 07, 2019 10:10AM
> 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
Subject Author Posted

Gzip not compressing

Anand Arun September 07, 2019 09:30AM

RE: Gzip not compressing

Reinis Rozitis September 07, 2019 10:10AM

Re: RE: Gzip not compressing

arunkiji September 07, 2019 11:53AM

RE: RE: Gzip not compressing

Reinis Rozitis September 07, 2019 12:58PM

Re: RE: RE: Gzip not compressing

arunkiji September 07, 2019 04:20PM

Re: Gzip not compressing

arunkiji September 12, 2019 09:11AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 76
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready