Nginx cache gzip file’s to temp directory

cachegzipnginx

Is the following possible through Nginx:

I now have gzip on; but the server needs to compress the popular files everytime, the files are xml files created through a database, but they are "static". I know I can set gzip_static on; but there are no .gz file ofcourse.

Is there a way I can let Nginx save the gzip file's it creates and save it to cache/temp directory for future use?

Best Answer

Have you heard of http://nginx.org/docs/http/ngx_http_gunzip_module.html?

Maybe the solution is to only have gzip files, and uncompress them for those clients that do not support gzip?

Or, depending on your application, maybe you can require that all clients support gzip?

Another option is to use something like varnish in front of nginx, which would cache the compressed gzipped files in virtual memory.