Gzip javascript and css with NGinx

Posted by Andrew McCombe on Fri Jun 29, 2012

Nginx by default will only compress text/html content types. Heres how to gzip javascript and css with NGinx:

In your nginx.conf file:

Or in your sites-enabled site file:

Reload nginx and your css and javascript files should now be gzip compressed.

For more information on NGinx’s gzip module, look at http://wiki.nginx.org/NginxHttpGzipModule.