Welcome! Log In Create A New Profile

Advanced

How to tell gzip_static not to look for gzipped image files?

Posted by Milan Babuskov 
Milan Babuskov
How to tell gzip_static not to look for gzipped image files?
October 20, 2010 05:34AM
I have nginx installed with gzip_static activated. It works fine for
CSS and JavaScript files, but it also looks for gzipped versions of
image files like .png and .gif, although these are not in the list of
files to be compressed:

# strace -p 25044 2>&1 | grep gz
open("/var/www/css/ymax.css.gz", O_RDONLY|O_NONBLOCK) = 438
open("/var/www/images/tools.png.gz", O_RDONLY|O_NONBLOCK) = -1 ENOENT
(No such file or directory)
open("/var/www/images/ads/bs.gif.gz", O_RDONLY|O_NONBLOCK) = -1 ENOENT
(No such file or directory)
open("/var/www/images/gfxborder/border_right.gif.gz", O_RDONLY|
O_NONBLOCK) = -1 ENOENT (No such file or directory)
open("/var/www/images/ads/hocuto03.gif.gz", O_RDONLY|O_NONBLOCK) = -1
ENOENT (No such file or directory)

Here's my nginx configuration:

gzip on;
gzip_disable "msie6";
gzip_min_length 1000;
gzip_types text/plain text/css application/x-javascript text/
javascript;
gzip_static on;

I don't know whether calling open() that fails for 60% of requests
affects performance, but is there a way to prevent this?

Thanks,
Milan.
Re: How to tell gzip_static not to look for gzipped image files?
October 20, 2010 05:36AM
wrong list really - you'd want the nginx list, but if this is normal
behavior then yes i agree, limiting what gzip_static does would be a
lot cleaner than trying to hit .gz of things that shouldn't be gzipped
normally...

On Wed, Oct 20, 2010 at 2:26 AM, Milan Babuskov
<milan.babuskov@gmail.com> wrote:
> I have nginx installed with gzip_static activated. It works fine for
> CSS and JavaScript files, but it also looks for gzipped versions of
> image files like .png and .gif, although these are not in the list of
> files to be compressed:
>
> # strace -p 25044 2>&1 | grep gz
> open("/var/www/css/ymax.css.gz", O_RDONLY|O_NONBLOCK) = 438
> open("/var/www/images/tools.png.gz", O_RDONLY|O_NONBLOCK) = -1 ENOENT
> (No such file or directory)
> open("/var/www/images/ads/bs.gif.gz", O_RDONLY|O_NONBLOCK) = -1 ENOENT
> (No such file or directory)
> open("/var/www/images/gfxborder/border_right.gif.gz", O_RDONLY|
> O_NONBLOCK) = -1 ENOENT (No such file or directory)
> open("/var/www/images/ads/hocuto03.gif.gz", O_RDONLY|O_NONBLOCK) = -1
> ENOENT (No such file or directory)
>
> Here's my nginx configuration:
>
> gzip  on;
> gzip_disable     "msie6";
> gzip_min_length 1000;
> gzip_types text/plain text/css application/x-javascript text/
> javascript;
> gzip_static on;
>
> I don't know whether calling open() that fails for 60% of requests
> affects performance, but is there a way to prevent this?
>
> Thanks,
> Milan.
>
On Oct 20, 11:33 am, Michael Shadle <mike...@gmail.com> wrote:
> wrong list really - you'd want the nginx list, but if this is normal
> behavior then yes i agree, limiting what gzip_static does would be a
> lot cleaner than trying to hit .gz of things that shouldn't be gzipped
> normally...

I though I was configuring something improperly, and hoped that
someone here has experience with that. I'll go ask on nginx mailing
list.

Thanks,
Milan.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 188
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready