To form the Gzip compression in Nginx

By kedinn 2014/10/29

One of the important things for our website is to optimize the speed of load, google facilitates the tool PageSpeed Insights that allows to verify the state us of optimization of our site the correct thing would have to be 70/100 for ahead, in aim now will show an extra to them to optimize the Nginx servant with HttpGzipModule.

being useful, another way that is one otherwise the common ones is to minificar archives HTML, Javascript and css is with ngx_pagespeed for our servant nginx, very good recommended.

What is HTTP-Gzip?

HttpGzip is a module of Nginx that is in charge of the compression and decompression “to the flight? of files. This is used enough to improve the load of the Web, I am not going to enter details.

for other servants:


We begin, as all module has some configuration options that agree to know how to apply them according to our needs.

  • gzip_types: one indicates the types of archives to try.
  • gzip_disable: it allows to deshabilitar the compression for certain User-Agents.
  • gzip_comp_level: compression level (0 minimum, 9 maximum).
  • gzip_vary: it activates the answer “Vary: Accept-Encoding? in the head.
  • gzip_proxied: it allows the configuration of compression through proxy.
  • gzip_buffers: configuration of the buffer.

in order to activate and to form of the module it is made changes within HTTP of the NGINX file.

we open to the file nginx.conf

I sweat I saw /etc/nginx/nginx.conf

Within the file we will look for the lines that contains gzip within HTTP \ {and the descomentamos, would have to be something as:

HTTP \ {

         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 text/plain text/css application/json application/javascrip$}

we will reinitiate the servant

service nginx restart

That is everything I hope that they look at the difference with the tool pagespeed, Greetings:)