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

后端 未结 5 1867
醉话见心
醉话见心 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:32

    If some of your files are compressed and some are not, then your gzip is working but you might have missed definition in gzip_types. For example, javascript files may return in headers any of following type:

    • application/javascript
    • application/x-javascript
    • text/javascript

    To compress all javascript files, all three definitions should be included in gzip_types.

    You need to check in response headers what content-type is returned for such an uncompressed file and then make sure it is also defined in gzip_types.

提交回复
热议问题