1. Home
  2. Servers
  3. How to Enable/Disable gzip compression in nginx on a Plesk Server

How to Enable/Disable gzip compression in nginx on a Plesk Server

Gzip compression is a crucial tool for optimizing web server performance. It reduces the size of data sent from your server to the user’s browser, resulting in faster loading times and improved website performance.

This article will guide you through the process of enabling and disabling Gzip compression in Nginx on a Plesk server, ensuring you have the flexibility to control this feature based on your website’s needs.

How to Enable

 

Step 1. Log into Plesk. 

Step 2. Go to Domains> Example.com> Hosting & DNS> Apache & nginx settings.

Step 3.  Add the following directories to the Additional nginx directories field: 

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

Note: This is an example. If needed, add other file types in the gzip_types section, E.g: application/javascript, application/js etc. The Full list of available types  can be found on a server in the files /etc/nginx/mime.types

Step 4. Apply the changes

How to Disable

Disabling gzip compression for a domain in Plesk

Step 1. Log in to Plesk. 

Step 2. Go to Domains> example.com> Hosting & DNS> Apache & nginx settings. 

Note: To disable gzip compression for a domain / subdomain that does not exist in Plesk (e.g hostname), create it first. 

Step 3. Add the following directive to the Additional nginx directives field. 

gzip off;

Step 4. Click apply to save the changes 

Frequently Asked Questions:

What is Gzip compression, and why is it important for a web server?

 Gzip compression is a method used to reduce the size of data transferred between a web server and a user’s browser. It is crucial for web servers because it significantly improves website performance by reducing page loading times. This, in turn, leads to a better user experience and can positively impact search engine rankings.

Updated on November 14, 2023

Was this article helpful?

Related Articles