Gzip can make customer's website run faster and smoother by caching files on the server.
1. Login to Plesk
2. Go to Domains > example.com > Apache & nginx Settings > Additional nginx directives
3. Set the following directives for nginx:
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/xml+rss text/javascript image/x-icon image/bmp image/svg+xml;
gzip_vary on;
Globally using SSH connection
- Connect to the server using SSH.
-
Create a text file using the following command:
# touch /etc/nginx/conf.d/gzip.conf -
Open the file in any text editor, for example, using vi:
# vi /etc/nginx/conf.d/gzip.conf -
Insert the following content in it:
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/xml+rss text/javascript image/x-icon image/bmp image/svg+xml;
gzip_vary on;
Note: This is an example. It is possible to add other file types in gzip_types section, e.g. application/javascript, application/js, etc. The full list of available types can be viewed on a server directly in /etc/nginx/mime.types file
Test the configuration and fix errors (if any):
nginx -t
Reload nginx configuration: