The first part of our configuration explicitly turns the gzip module on. Then, to maintain compatibility with really old versions of Internet Explorer (which hopefully nobody still uses), we disable gzip using the MSIE [1-6]\.(?!.*SV1) regex.
Then, gzip_proxied sets which proxied connections will use gzip, which we set to any to cover all requests. gzip_types is then used to set what file types are to be compressed. This is matched with the MIME type, for example, text/plain. We explicitly set types, as not every file type can be compressed further (for example, JPEG images).
Lastly, we set gzip_vary to on. This sets the Vary: Accept-Encoding header, which specifies that both Content Distribution Networks (CDN) and upstream proxies store a copy of the file as both compressed and uncompressed. While every modern browser supports Gzip compression, there are still some minor browsers and script-based HTTP tools which don't. Instructing the upstream CDN or proxy to store both shows that they're still able to support these older systems.