Skip to content

Instantly share code, notes, and snippets.

@AlchemistCamp
Last active July 16, 2021 18:03
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlchemistCamp/e29b0080fdd63b732ac52bb1a8a32c6c to your computer and use it in GitHub Desktop.
Save AlchemistCamp/e29b0080fdd63b732ac52bb1a8a32c6c to your computer and use it in GitHub Desktop.
Instructions for Episode 70
# Top of file, in the main block, add the following
# Compress responses on-the-fly.
load_module modules/ngx_http_brotli_filter_module.so;
# Serve pre-compressed files.
# Both modules could be used separately
load_module modules/ngx_http_brotli_static_module.so;
# ...
# in the http block, after your gzip settings, add the following:
brotli on;
brotli_comp_level 4;
brotli_types text/plain text/css application/javascript application/json image/svg+xml application/xml+rss;
brotli_static on;
# This is to be run manually from the command line, not as a bash script
sudo apt-add-repository -y ppa:hda-me/nginx-stable
sudo apt-get update
sudo apt-get install brotli nginx nginx-module-brotli
# Ensure brotli is properly installed. After the following command, you should see:
# --add-dynamic-module=debian/extra/ngx_brotli
nginx -V 2>&1 | tr ' ' '\n' | grep brotli
sudo vi /etc/nginx/nginx.conf
# make changes
sudo systemctl restart nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment