Jayadevan
Jayadevan

Reputation: 1342

nginx avoid zipping images

I have set up nginx to serve gzipped versions of files (gzipped with a script). I do not want images (png and others) to be gzipped. So I have used

gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

Still nginx is looking for ziped versions as seen in strace.

open("<path>/static/assets/<path>/up.png.gz", O_RDONLY|O_NONBLOCK) = -1 ENOENT (No such file or directory). 

Is something wrong wit my use of gzip_types?

Upvotes: 2

Views: 1153

Answers (1)

troseman
troseman

Reputation: 1878

the gzip_static module tells nginx to look for a precompressed file (.gz) for any file it would normally serve.

http://nginx.org/en/docs/http/ngx_http_gzip_static_module.html

This module is independent of the gzip module

http://nginx.org/en/docs/http/ngx_http_gzip_module.html

so the gzip_types doesn't apply to it. I don't see a way to selectively turn it off.

Upvotes: 1

Related Questions