Skip to content
IT // Adventures

gzip Compression with Nginx

Enable gzip compression for the nginx web server.

1 min read

To enable gzip compression in nginx, you need to add a few entries to the nginx configuration. The configuration can be placed per “server”, per “location” or directly in the “http” section.

Configuration in nginx.conf

http {
    # ... remaining configuration directives ...
    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/javascript text/xml application/xml+rss;
}

Sources