2

x configuration file /etc/nginx/ngnix.conf and not found any issue. still not able to see the css and javascript Gzip Compression. My NGINX.conf entries are as below-

    gzip on;
    gzip_disable "msie6";

    gzip_comp_level 6;
    gzip_min_length 1100;
    gzip_buffers 16 8k;
    gzip_proxied any;
    gzip_types text/plain text/css text/js text/xml text/javascript application/javascript application/x-javascript application/json application/xml application/xml+rss;

1 Answer 1

12

I think you are missing gzip_vary on;, this is what enables gzip compression for listed gzip_types

gzip on;
gzip_vary on;
gzip_proxied any;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
Sign up to request clarification or add additional context in comments.

4 Comments

I added gzip_vary on as well. Still it not compressing. It is not compressing any css or js file included on my server. The external jquery and css font is getting compressed. Is there anything that am doing wrong? Do I have to change anything in some other setting file as well?
Is there any order which has to be maintained or anything. I dont now much in detail what every line does here.
@dreamer I added configuration that I am using. You have gzip_min_length set, so it won't compress small files, maybe that's what you are seeing.
@dreamer Did you ever figure out why your files were not being compressed?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.