- Documentation
- NGINX http_gzip module
- NGINX http_gunzip module
- Enable gzip. by default, we’re not going to compress the responses that we’re getting from proxied servers or any piece of content that isn’t HTML.
- But if one of our proxied servers happens to send us a pre-compressed response then we probably want to decompress it for clients that can’t handle gzip. In this situation, we’ll use the gunzip module
$ vim /etc/nginx/nginx.conf # uncomment gzip module gzip on; gzip_disable msie6; gzip_proxied no-cache no-store private expired auth; gzip_types text/plain text/css application/x-javascript application/javascript text/xml application/xml application/xml+rss text/javascript image/x-icon image/bmp image/svg+xml; gzip_min_length 1024; gzip_vary on; gunzip on;
- Expanation:
- gzip_disable - Ensure that we’re not sending compressed responses to older versions of Internet Explorer (hopefully no one is actually using these browsers)
- gzip_proxied - Specify that we only want to compress responses from proxied servers if we normally wouldn’t cache them
- gzip_types - The Content-Types that we will compress before sending the response
- gzip_min_length - Adjusting the minimum size of a file that we’ll compress, the default is 20 bytes, but we’re going to not compress resources that are less than one kilobyte
- gzip_vary - Adds a Vary: Accept-Encoding header. This tells intermediate caches (like CDNs) to treat the compressed and uncompressed version of the same resource as 2 separate entities
- Expanation:
Last active
February 28, 2025 02:16
-
-
Save mohanpedala/79fba1f0db65e428a3c83c1e292c09f5 to your computer and use it in GitHub Desktop.
NGINX Performance tuning
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment