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

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

    Are your gzip entries within the nginx configuration "scope" that js,css,etc. assets are being served? I ask because if you're using some sort of a framework, sometimes there are different location {...} blocks that handle html requests vs assets.

    Also when you're testing in a browser, make sure you do a hard refresh to force the server to give you a "fresh copy" of whatever you're looking at.

    Finally, you can use gzip_types * to allow anything to be gzipped. Perhaps someone else can chime in if this is a good practice or not.

提交回复
热议问题