Client Area

 Client Area

Enabling Gzip compression and browser caching with Nginx on Plesk

Enabling Gzip Compression And Browser Caching With Nginx On Plesk

Sections

    To make your website loading faster and improve your pagespeed score, you have to enable Gzip compression and to allow browser caching for all static assets. For Plesk Onyx, you can add the following settings in the Additional nginx directives of your website or directly in your service plan settings.

    # Enable Gzip compression
    gzip on;
    gzip_disable "msie6";
     gzip_vary on;
     gzip_proxied any;
     gzip_comp_level 6;
     gzip_buffers 16 8k;
     gzip_http_version 1.1;
     gzip_types
     application/atom+xml
     application/javascript
     application/json
     application/rss+xml
     application/vnd.ms-fontobject
     application/x-font-ttf
     application/x-web-app-manifest+json
     application/xhtml+xml
     application/xml
     font/opentype
     image/svg+xml
     image/x-icon
     text/css
     text/plain
     text/x-component
     text/xml
     text/javascript;
     
    # Cache static files
    location ~* \.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|swf|webp)$ {
      add_header "Access-Control-Allow-Origin" "*";
      access_log off;
      log_not_found off;
      expires max;
    }

    in Plesk

    Feedback