Rapid nginx Compression Configuration

No Comments

Google came up pretty empty about this and I could not find anything in the documentation, so I thoguht I'd drop it here real quick: It looks like the gzip_types config directive supports globbing, so instead of keeping an enormous list of mime-types to be compressed, you can do something like gzip_types text/*; in order to deliver all textual content in compressed form.

A small c&p-ready snippet from my config:

gzip                on;
gzip_comp_level     6;
gzip_types          text/*
gzip_disable        "msie6";
gzip_vary           on;

This has been tested and verified to work with nginx 0.8 and 1.0. I think it is safe to assume later versions of nginx support this as well.

Be the first to write a comment!