Enable Content Compression in nginx

To enable content encryption in nginx, put the below configuration inside server block of nginx configuration file (usually in /etc/nginx/nginx.conf):

       gzip on;
       gzip_disable "msie6";
       gzip_http_version  1.1;
       gzip_comp_level    5;
       gzip_min_length    256;
       gzip_proxied       any;
       gzip_vary          on;
       gzip_types
           application/atom+xml
           application/javascript
           application/x-javascript
           application/json
           application/rss+xml
           application/vnd.ms-fontobject
           application/x-font-ttf
           application/x-web-app-manifest+json
           application/xhtml+xml
           application/xml
           font/opentype
           image/svg+xml
           image/x-icon
           text/css
           text/plain
           text/x-component;

You should get content size reduction unto 80%!

Leave a comment