Skip to content

Instantly share code, notes, and snippets.


AlchemistCamp/changes to nginx.conf Secret

Last active Aug 11, 2018
What would you like to do?
Instructions for Episode 70
# Top of file, in the main block, add the following
# Compress responses on-the-fly.
load_module modules/;
# Serve pre-compressed files.
# Both modules could be used separately
load_module modules/;
# ...
# 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