The directive gzip_static does not follow the rules in gzip_types
gzip on;
gzip_static on;
gzip_http_version 1.0;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_comp_level 5;
gzip_min_length 1000;
gzip_vary on;
gzip_buffers 64 16k;
gzip_types text/plain application/xml text/css
application/javascript application/x-javascript text/javascript;
#strace
open(“/var/www/forum/images/smilies/attention.gif.gz”,
O_RDONLY|O_NONBLOCK) = -1 ENOENT (No such file or directory)
open(“/var/www/forum/images/smilies/lookoutbelow.gif”,
O_RDONLY|O_NONBLOCK) = 319
open(“/var/www/forum/images/smilies/lookoutbelow.gif.gz”,
O_RDONLY|O_NONBLOCK) = -1 ENOENT (No such file or directory)
open(“/var/www/forum/images/smilies/heresyoursign.gif”,
O_RDONLY|O_NONBLOCK) = 320
open(“/var/www/forum/images/smilies/heresyoursign.gif.gz”,
O_RDONLY|O_NONBLOCK) = -1 ENOENT (No such file or directory)
open(“/var/www/forum/images/smilies/woohooo.gif”, O_RDONLY|O_NONBLOCK) =
321
open(“/var/www/forum/images/smilies/woohooo.gif.gz”,
O_RDONLY|O_NONBLOCK) = -1 ENOENT (No such file or directory)
open(“/var/www/forum/images/smilies/ohno.gif”, O_RDONLY|O_NONBLOCK) =
322
open(“/var/www/forum/images/smilies/ohno.gif.gz”, O_RDONLY|O_NONBLOCK) =
-1 ENOENT (No such file or directory)
As you can see, it is looking for .gz images even though the gzip_types
excludes images.
Posted at Nginx Forum:
Hello!
On Tue, Apr 24, 2012 at 02:13:54AM -0400, ctrlbrk wrote:
The directive gzip_static does not follow the rules in gzip_types
Yes, and it’s documented behaviour, actually:
http://nginx.org/en/docs/http/ngx_http_gzip_static_module.html#gzip_static
: The following directives are also taken into account:
: gzip_http_version, gzip_proxied, gzip_disable, and gzip_vary.
Maxim D.
Thanks for the quick reply. It would be nice if there was a simple top
level directive added to make it follow the gzip_types rule. The
default behavior of trying to compress images is pretty futile. Even if
I had my bash script compress images to serve up, the extra
decompression time on the client would cause the page to be slower, and
bandwidth savings of probably less than 1% at expense of much, much more
than 1% increased client CPU.
Posted at Nginx Forum:
On Tue, Apr 24, 2012 at 02:36:07AM -0400, ctrlbrk wrote:
Thanks for the quick reply. It would be nice if there was a simple top
level directive added to make it follow the gzip_types rule. The
default behavior of trying to compress images is pretty futile. Even if
I had my bash script compress images to serve up, the extra
decompression time on the client would cause the page to be slower, and
bandwidth savings of probably less than 1% at expense of much, much more
than 1% increased client CPU.
location /images/ {
gzip_static off;
…
}
–
Igor S.
Hello!
On Tue, Apr 24, 2012 at 02:36:07AM -0400, ctrlbrk wrote:
Thanks for the quick reply. It would be nice if there was a simple top
level directive added to make it follow the gzip_types rule. The
default behavior of trying to compress images is pretty futile. Even if
I had my bash script compress images to serve up, the extra
decompression time on the client would cause the page to be slower, and
bandwidth savings of probably less than 1% at expense of much, much more
than 1% increased client CPU.
It doesn’t try to compress anything, it’s up to you to compress
files you think is ok to compress. The gzip_static just checks if
a ‘.gz’ file present, and returns it to client if it’s present
(and client supports gzip).
If you want to avoid file lookup, you may (and probably should)
disable gzip_static for locations you don’t want lookup to happen.
Maxim D.