The best way to send static pre-compressed gzipped files to Nginx is to use http_gzip_static_module. More specifically, in the configuration you will want:
gzip_static always;
http://nginx.org/en/docs/http/ngx_http_gzip_static_module.html
To serve the unpacked version of the file, that is, you only have a .gz file on your server to save to IO, you will want to use http_gunzip_module. In your configuration, it looks like this:
gunzip on;
http://nginx.org/en/docs/http/ngx_http_gunzip_module.html
You may also be interested in the links at the bottom of the gunzip_module page.
PS When pre-compressing the files that I propose using the Google Zopfli compression algorithm, it will increase the build time (not the decompression time), but reduce the file size by about 5%. https://code.google.com/p/zopfli/
source share