Alex Rivera | Logout

How can I check that the nginx gzip_static module is working?

Asked 2010-03-17T08:51:53.857
55

How can I check that nginx is serving the .gz version of static files, if they exist?

I compiled nginx with the gzip static module, but I don't see any mention of the .gz version being served in my logs. (I have minified global.js and global.css files with .gz versions of them in the same directory).

The relevant part of nginx.conf looks like this:

gzip  on;
gzip_static on;
gzip_http_version 1.0;
gzip_disable "MSIE [1-6]\.";
gzip_vary on;

gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;

Any pointers would be appreciated.

Edit
Report

1 Answer

19

I would disable automatic compression and log gzip_ratio:

http {
   gzip off;
   gzip_static on;

   log_format log_with_ratio "... $gzip_ratio ...";

   server {
      access_log /var/log/nginx/file.log log_with_ratio;
   }
}

Note, that you may override gzip, gzip_static and access_log per server and location levels.

answered 2010-03-19T12:04:36.080

Your Answer