GZip not compressing everything

Posted April 8, 2015 17.3k views


One of our client sites is reporting that 3 files aren’t being compressed.

GZip is enabled on our server and we get a grade D for compression through YSlow so clearly some things are being compressed. I’m just stumped as to why these 3 files specifically aren’t being.

Our nginx.conf contains this:

# Gzip Settings

gzip on;
gzip_disable "msie6";
gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css;

Has anyone else experienced this?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
3 answers

if I download the file and compress it it compresses fine with nginx

here is my config

        gzip on;
        gzip_disable "MSIE [1-6]\.(?!.*SV1)";
        gzip_min_length  500;
        gzip_buffers  4 32k;
        gzip_types    text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml image/svg;
        gzip_vary on;

its basically the same as yours but we get different results.

My Server Result on Your File all.css

Yours all.css

it could be caused by the file size not meeting your requirements (default gzip reqs.)

  • Thanks for looking at this.

    I’ve just used your exact settings and get the same results my end. I’m really stumped with this.

    Don’t think it’s file size as the all.css file is only 145Kb.

Have you restarted nginx after making the changes to the configuration file?

sudo service nginx restart

OK. Rebooting my droplet fixed the issue. Magic…