Enable GZIP for CSS and JS files on NGINX server for Magento

后端 未结 5 1855
醉话见心
醉话见心 2021-01-30 00:08

I need to enable gzip compression on nginx server. As I have observed from firfox firebug NET tools, I have found that html file are gzip compressed. But Not the javascript fil

5条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-30 00:52

    You can find example configuration from the html5 boilerplate code.

    
      # Enable Gzip
      gzip  on;
      gzip_http_version 1.0;
      gzip_comp_level 2;
      gzip_min_length 1100;
      gzip_buffers     4 8k;
      gzip_proxied any;
      gzip_types
        # text/html is always compressed by HttpGzipModule
        text/css
        text/javascript
        text/xml
        text/plain
        text/x-component
        application/javascript
        application/json
        application/xml
        application/rss+xml
        font/truetype
        font/opentype
        application/vnd.ms-fontobject
        image/svg+xml;
    
      gzip_static on;
    
      gzip_proxied        expired no-cache no-store private auth;
      gzip_disable        "MSIE [1-6]\.";
      gzip_vary           on;
    
    

提交回复
热议问题