docker-magento2-nginx icon indicating copy to clipboard operation
docker-magento2-nginx copied to clipboard

gzip is commented out

Open iandd0824 opened this issue 7 years ago • 4 comments

Hi,

Just curious why the gzip is commented out in nginx.conf.

Was that turned off for a reason?

iandd0824 avatar Mar 28 '17 17:03 iandd0824

it's off by default. if we enable, i want to make sure it's setup correctly. any suggestions?

markshust avatar Feb 05 '18 17:02 markshust

Here is the gzip setting I have tested.

I am not 100% sure it is the right gzip setting, but it does reduce the total page size from 4.x MB to 1.x MB once it is on.

BTW, I used https://gtmetrix.com to check the total page size.

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
   
    ........   

    gzip  on;
    gzip_types      text/plain text/html text/css text/js text/xml text/javascript application/javascript application/x-javascript application/json application/xml application/rss+xml image/svg+xml;
    gzip_proxied    no-cache no-store private expired auth;
    gzip_min_length 1000;
    gzip_buffers 16 8k;
    gzip_comp_level 2;
    gzip_disable "MSIE [1-6].(?!.*SV1)";
    gzip_vary on;

    include /etc/nginx/conf.d/*.conf;
}

iandd0824 avatar Feb 05 '18 17:02 iandd0824

thank you very much, that gives me something to go on. i don't think there is any reason to not enable it, correct?

markshust avatar Feb 05 '18 18:02 markshust

Basically, every browser nowadays supports gzip. It shouldn't be any problem if you turn it on. Just need to find the perfect settings for Magento.

iandd0824 avatar Feb 05 '18 18:02 iandd0824