gzip not working for some files using nginx

shakalandy asked:

Some files are not gzipped on their way to the user browser in our setup.

for example




can not be zipped.

my current configuration:

        location ~* \.(js|css|png|jpg|jpeg|gif|ico)\.*+$ {
            if ($args ~ [0-9]\.*+) {
               expires max;
            expires max;
            log_not_found off;
             gzip  on;

What needs to be adjusted to make gzip fly?
I already tried several other options but don’t want to continue with try&error on this.

Thank you very much.

Some more info:
maybe there is another problem.
Firebug and pingdom tools show me the compressed size whereas Chrome Developer Bar and Google PageSpeed Insights says “no compression active”

To make things easier, the link to the site is http://diginights.com

My answer:

That’s because your configuration seems to be telling it not to do so for any file with a digit 0-9 in the name.

Delete this entire section; it’s mostly redundant anyway, and almost certainly isn’t doing anything that you might want.

        if ($args ~ [0-9]\.*+) {
           expires max;

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.