Compression

Compression can improve website speed by reducing the amount of data transferred over the network. NGINX offers a couple of alternatives to use for serving compressed content.

ngx_http_gzip_module

This module enables gzip compression in NGINX. The server compresses the data and then sends it over wire. Compression is mostly helpful in serving textual content. It does not help in serving noncompressible content, such as JPEG, GIF, MP3, and so on. Also, if the compression level is high, there is not much gain in terms of the compressed data size, and the server mostly ends up wasting CPU cycles.

The module offers the following directives to configure the gzip compression.

gzip

This directive enables gzip compression in NGINX. By default, ...

Get NGINX High Performance now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.