Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

So I installed and configured Nginx 0.7.62 on a new Slicehost Ubuntu 9.10 slice.

All seems to work fine with the server, except that gzip isn't working for one reason or another. I made sure that it's setting were correct in /etc/nginx/nginx.conf:

user www-data;
worker_processes 3;
error_log /var/log/nginx/error.log;
pid /var/run/;

events {
    worker_connections 1024;
    # multi_accept on;

http {
    include /etc/nginx/mime.types;
    access_log /var/log/nginx/access.log;

    sendfile on;
    #tcp_nopush on;

    keepalive_timeout 2;
    tcp_nodelay on;

    gzip on;
    gzip_comp_level 2;
    gzip_proxied any;
    gzip_types text/plain text/css application/x-javascript;
    gzip_disable "MSIE [1-6]\.";

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;

This normally wouldn't be a big deal, but gzip support could save considerable bandwidth for my site. Does anyone have any ideas of what to check, or has anyone else run into this problem?

share|improve this question
How were you testing that the compression was working? If you are using one of the many public checkers it could be that their checker pretends to be IE6-pre-SP2 so your gzip_disable directives were firing and turning the feature off when the checker made requests. – David Spillett May 27 '10 at 11:44

6 Answers 6

Thanks for everyone's help. I managed to figure it out... (bizarre, still not sure why)

In Ubuntu 9.10, Nginx 0.7.62:

  1. I first tried using gzip_disable "MSIE [1-6]."; #still broken
  2. I then switched it to gzip_disable "msie6"; #still broken
  3. I commented out the gzip_disabled line altogether #fixes the problem

Hope this saves someone else some time.

share|improve this answer
removing gzip_disabled indeed solved my problem. Thanks. – Tiago Mar 26 '11 at 21:19
This worked for me too. What's odd is that it was actually working for some resources with gzip_disable. But when I commented out that line, it started working for application/x-javascript resources. – mahemoff Aug 22 '11 at 17:23

Passenger now compiles the gzip module upon installing nginx. It's much easier to go this route nowadays

share|improve this answer

Try putting this into nginx.conf:

gzip on;
gzip_vary on;
gzip_min_length  1100;
gzip_comp_level 1;
gzip_http_version 1.0;
gzip_proxied any;
gzip_disable "msie6";
gzip_types  text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
share|improve this answer

at first here is the description to build nginx on linux

Can you verify that your build support gzip?


Or you didn't build with:

--without-http_gzip_module - Disable ngx_http_gzip_module. Requires zlib if enabled.

How can you see that the gzip is not working btw.?

share|improve this answer
When doing nginx -V: --with-http_gzip_static does exist. the http_gzip_module (on-the-fly gzip) isn't disabled. The package "zlib1g" is installed on the server. I can tell from looking at the Web Page analyzer tool @, and also by using – Matt Nov 13 '09 at 14:02

All the suggestions from l1x were checked off. Anyone have some ideas? The package was installed using apt-get (so it was pre-compiled)...

share|improve this answer

Very strange as I just removed the gzip_disable line to resolve my issue. Maybe this is a bug. Worked fine in a previous version of nginx that I was running...

share|improve this answer

Your Answer


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