PageSpeed Insights not seeing the Gzip compression

前端 未结 6 536
轮回少年
轮回少年 2021-02-05 11:01

I\'m trying to speed up my website. Google insights (https://developers.google.com/speed/pagespeed/insights) tells me that a critical problem is to enable GZip compression.

6条回答
  •  隐瞒了意图╮
    2021-02-05 11:38

    First, check if gzip is enable in your server. You can use this tool: http://checkgzipcompression.com/

    If it's ok, then, check that the compression is working FOR ALL your files. If Google Page Speed Test found on single file without GZIP compression from your server, the website with fail the test.

    You can use Google Chrome for this:

    1. Inspect your code; in the image you can see there is Content Encoding GZIP for the html file.

    2. Clic on every file and find which doesn't have the GZIP encode; maybe the CSS type o JS type.

    3. When you find it, add the file type to your gzip.conf

    This is the simple configuration for gzip.conf

    gzip on;
    gzip_disable "MSIE [1-6]\\.(?!.*SV1)";
    gzip_proxied any;
    gzip_types text/plain text/css text/javascript text/xml application/javascript application/x-javascript application/xml application/xml+rss image/x-icon image/svg+xml image/jpeg image/jpg image/png
    gzip_vary on;
    

    Good Luck!

提交回复
热议问题