Gzip not working for JS and CSS.

My website performance is very bad and one of the main issues is to Enable gzip compression. I have enabled it and code is in the .htaccess file but still, it is not working for JS and CSS file.

https://monosnap.com/file/54uvcRvYnKN63eKrxsLnaMdOGPzUTj

Please check and help to fix it and improve the score.

  • Patrick Freitas
    • Staff

    Hi Rohit

    Hope you are doing well.

    This issue is being caused because the server uses the Apache and Nginx as the reverse, so the CSS and the JS will be served by Nginx.

    We will need to add the Nginx rules on Plesk as well.

    # Enable Gzip compression
    gzip          on;
    
    # Compression level (1-9)
    gzip_comp_level     5;
    
    # Don't compress anything under 256 bytes
    gzip_min_length     256;
    
    # Compress output of these MIME-types
    gzip_types
        application/atom+xml
        application/javascript
        application/json
        application/rss+xml
        application/vnd.ms-fontobject
        application/x-font-ttf
        application/x-font-opentype
        application/x-font-truetype
        application/x-javascript
        application/x-web-app-manifest+json
        application/xhtml+xml
        application/xml
        font/eot
        font/opentype
        font/otf
        image/svg+xml
        image/x-icon
        image/vnd.microsoft.icon
        text/css
        text/plain
        text/javascript
        text/x-component;
    
    # Disable gzip for bad browsers
    gzip_disable  "MSIE [1-6]\.(?!.*SV1)";

    It on most of the times is under the Menu Option > Apache & Nginx Settings But I don't see the option on your Plesk, please, check if your account has the full access, or contact your sysadmin to add those rules, once done go to Hummingbird > Gzip > Recheck Status

    I also had a look at your GTMetrix report.

    I see the main problem on the Gzip and Leverage browser caching are external filed.

    Unfortunately the external files we can't compress or control the caching time, so even activating the Gzip those files will still be reported, you will need to find the plugin/theme that it is coming from and check if you can replace for an internal file or a different plugin/theme that doesn't load too many external links inside your site.

    Let us know if you need any further help on this
    Best Regards,
    Patrick Freitas

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.