Last active
December 8, 2017 07:08
-
-
Save lukecav/0c99f411d36e67797156d26d26a6fcfc to your computer and use it in GitHub Desktop.
Gzip enabled in NGNIX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enable gzip compression. | |
# Default: off | |
gzip on; | |
# Enable compression both for HTTP/1.0 and HTTP/1.1. | |
gzip_http_version 1.1; | |
# Compression level (1-9). | |
# 5 is a perfect compromise between size and CPU usage, offering about | |
# 75% reduction for most ASCII files (almost identical to level 9). | |
# Default: 1 | |
gzip_comp_level 5; | |
# Don't compress anything that's already small and unlikely to shrink much | |
# if at all (the default is 20 bytes, which is bad as that usually leads to | |
# larger files after gzipping). | |
# Default: 20 | |
gzip_min_length 256; | |
# Compress data even for clients that are connecting to us via proxies, | |
# identified by the "Via" header (required for CloudFront). | |
# Default: off | |
gzip_proxied any; | |
# Tell proxies to cache both the gzipped and regular version of a resource | |
# whenever the client's Accept-Encoding capabilities header varies; | |
# Avoids the issue where a non-gzip capable client (which is extremely rare | |
# today) would display gibberish if their proxy gave them the gzipped version. | |
# Default: off | |
gzip_vary on; | |
# Compress all output labeled with one of the following MIME-types. | |
# text/html is always compressed by gzip module. | |
# Default: text/html | |
gzip_types | |
application/atom+xml | |
application/javascript | |
application/json | |
application/ld+json | |
application/manifest+json | |
application/rss+xml | |
application/vnd.geo+json | |
application/vnd.ms-fontobject | |
application/x-font | |
application/x-font-opentype | |
application/x-font-otf | |
application/x-font-truetype | |
application/x-font-ttf | |
application/x-javascript | |
application/x-web-app-manifest+json | |
application/xhtml+xml | |
application/xml | |
font/opentype | |
font/otf | |
font/ttf | |
image/bmp | |
image/svg+xml | |
image/x-icon | |
text/cache-manifest | |
text/css | |
text/plain | |
text/vcard | |
text/vnd.rim.location.xloc | |
text/vtt | |
text/x-component | |
text/x-cross-domain-policy; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://www.nginx.com/resources/admin-guide/compression-and-decompression/
https://mattstauffer.co/blog/enabling-gzip-on-nginx-servers-including-laravel-forge