Enable gzip compression for Nginx per website

Enable gzip compression for Nginx per website

By default, Nginx doesn’t enable gzip compression for serving files. This is commonly used to reduce the filesize of CSS and Javascript files, if they haven’t been minified or pre-compressed. This guide will show you how to enable it per site for a Plesk 12.5 or Onyx based server.

Note: All philmorehost subscriptions (shared and VPS hosting) already have gzip enabled for all sites.

Instructions

  1. Login to your Plesk server.
  2. Select the domain you wish to enable gzip for from the left hand side.
  3. Click in Apache and nginx settings:

  1. Down the bottom, add the following to the “Additional nginx directives” field:gzip on; gzip_disable “MSIE [1-6]\.(?!.*SV1)”; gzip_proxied any; gzip_types text/plain text/css application/x-javascript application/javascript text/xml application/xml application/xml+rss text/javascript image/x-icon image/bmp image/svg+xml; gzip_vary on;
  2. Click OK to save.

You can verify that gzip is working by using your browser’s debug tools or a third party website such as GTMetrix.

PHILMOREHOST

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.