Yes, I know that there are a lot of other questions that seem exactly like this out there. I think I must've looked all of them. Twice. In desparation, I'm adding another in case my specific configuration is the issue. Bear with me.

First, the question: What do I need to do to get gzip compression to work?

I have an Ubuntu 12.04 server installed running nginx 1.1.19. Nginx was installed with the following packages:

nginx
nginx-common
nginx-full

The http block of my nginx.conf looks like this:

http {
  include /etc/nginx/mime.types;

  access_log /var/log/nginx/access.log;

  sendfile on;

  keepalive_timeout  65;
  tcp_nodelay        on;

  gzip  on;
  gzip_disable "msie6";

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

Both PageSpeed and YSlow are reporting that I need to enable compression. I can see that the request headers indicate Accept-Encoding:gzip,deflate,sdch, but the response headers do not have the corollary Content-Encoding header.

I've tried various other config values (gzip_vary on, gzip_http_version 1.0, etc.), but no joy.

As far as I know, I can only assume that nginx was compiled with compression support, but if there's any way to verify that, I'd love to know.

If anyone sees anything I'm missing or can suggest further debugging, please let me know. I'm no sysadmin and I'm new to Nginx so I've exhausted everything I can think of or have read.

Thanks.


If nginx doesn't complaing about gzip on; being in your configuration file, then it's been compiled with the gzip module. By default, it only compresses text/html responses. You need to configure gzip_types if you want to compress anything else (css, js, etc).