Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my nginx conf I have which enabled gzip:

gzip on;
gzip_proxied any;
gzip_types text/plain text/css text/javascript;
gzip_comp_level 9;
gzip_vary on;

However this also gzips my jpeg's which actually increases size. How can I, ideally with out using location, disable gzipping of images?

share|improve this question
up vote 5 down vote accepted

If you didn't set gzip_types image/jpeg anywhere then nginx will never compress your jpegs, unless they have different content-type (like text/plain) in headers.

This may be due to one of the following reasons:

  • You have gzip_types image/jpeg in configuration;
  • Images returned with incorrect content-type header;
  • They compressed by something outside of nginx;
  • A tool that you're using for check is broken.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.