+34 911 599 883

+34 911 895 172

Habilitar compresión gzip en nginx

Aquí están los pasos para habilitar compresión gzip en nginx:

1. Create the file: /etc/nginx/conf.d/gzip.conf

Enter the following:

gzip on;
gzip_comp_level 9;
gzip_min_length 1400;
gzip_proxied any;
gzip_types text/plain text/css image/png image/gif image/jpeg application/x-javascript text/xml application/xml application/x
ml+rss text/javascript;
gzip_vary on;
gzip_disable «MSIE [1-6]\.(?!.*SV1)»;

Then restart nginx in Plesk Services Management. Note that text/html doesn’t need to be specified with gzip_types (and in fact produces a configuration warning if you try). Once you set gzip on, nginx automatically assumes text/html as a gzip type.

To check : http://www.gidnetwork.com/tools/gzip-test.php

gzip on;
gzip_proxied any;
gzip_types text/plain text/xml text/css application/x-javascript;
gzip_vary on;
gzip_disable “msie6?;
Then run nginx -t to test the configuration and if that’s all ok, restart nginx by running /etc/init.d/nginx restart.

Enable GZIP Compression Nginx for Plesk, CentOS, CloudLinux or RedHat

nano /etc/nginx/nginx.conf

Nginx config on CentOS
Edit Nginx config on CentOS, CloudLinux, RedHat, Plesk to enable gzip compression Nginx

Add before }

gzip on;
gzip_comp_level 9;
gzip_http_version 1.1;
gzip_proxied any;
gzip_min_length 10;
gzip_buffers 16 8k;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/xhtml+xml;

# Disable for IE < 6 because there are some known problems
gzip_disable “MSIE [1-6].(?!.*SV1)”;

# Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6
gzip_vary on;

Enable GZIP Compression Nginx
Enable GZIP Compression Nginx on CentOS, CloudLinux, Plesk & RedHat based operating systems.

Restart Nginx and fix any errors:
service nginx restart

Enable GZIP Compression Apache for Plesk, CentOS, CloudLinux or RedHat

Must have mod_deflate enabled on your server. When you run this command and a # in front, you will need to edit and uncomment mod_deflate.

grep “mod_deflate” /etc/httpd/conf/httpd.conf

If # exists nano /etc/httpd/conf/httpd.conf and uncomment out LoadModule mod_deflate/LoadModule mod_deflate

Backup your apache configuration file.