Files
LEMPer/etc/nginx/comp_brotli
2019-08-17 00:41:33 +07:00

72 lines
2.1 KiB
Plaintext

# Enable brotli compression.
brotli on;
# Checking of the existence of pre-compressed files with.br extension.
brotli_static on;
# A pretty comprehensive list of content mime types that we want to compress
# there's a lot of repetition here because different applications might use different
# (and possibly non-standard) types. we don't really care, we still want them included
# don't include text/html -- it is always included anyway.
brotli_types
application/atom+xml
application/geo+json
application/javascript
application/json
application/ld+json
application/manifest+json
application/rdf+xml
application/rss+xml
application/vnd.ms-fontobject
application/wasm
application/x-font-opentype
application/x-font-truetype
application/x-font-ttf
application/x-javascript
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
application/xml+rss
font/eot
font/opentype
font/otf
image/bmp
image/gif
image/jpeg
image/png
image/svg+xml
image/vnd.microsoft.icon
image/x-icon
image/x-win-bitmap
text/cache-manifest
text/calendar
text/css
text/javascript
text/markdown
text/plain
text/vcard
text/vnd.rim.location.xloc
text/vtt
text/x-component
text/x-cross-domain-policy
text/xml;
# Increase the compression level, at the expense of additional CPU.
# CPU cycles are cheap virtually everywhere now, bandwidth not nearly as much.
brotli_comp_level 6;
# Increase the size of the buffers which hold responses to make sure larger content can be compressed too.
# This means there are 16 buffers and they can each hold 8k.
# If you serve a lot of ridiculously large text (like combined CSS) you might consider upping this slightly.
brotli_buffers 16 8k;
brotli_window 512k;
# Up the minimum length a little to account for gzip overhead
# this means anything smaller than 50 bytes won't be compressed.
# The default is 20 bytes, which is sooo tiny it's a waste to compress.
brotli_min_length 64;
# Custom header.
add_header X-Powered-By "LEMPer/Brotli";