-
-
Save kumarrishav/f5d924bee37471d61abb2092b8f1d64c to your computer and use it in GitHub Desktop.
Build and install google brotli nginx as a dynamic module (ubuntu xenial)
This file contains 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
#install brotli | |
sudo apt-get install brotli | |
#check nginx version | |
nginx -V | |
#download nginx source | |
wget http://nginx.org/download/nginx-1.14.1.tar.gz | |
#extract the source | |
tar -xzvf nginx-1.14.1.tar.gz | |
#clone the official nginx brotli module | |
git clone --recursive https://github.com/google/ngx_brotli.git | |
#get the nginx build dependecies | |
sudo apt-get build-dep nginx | |
#configure the build | |
nginx -V 2>&1 >/dev/null | grep -o " --.*" | grep -oP .+?(?=--add-dynamic-module)| head -1 > nginx-1.14.1/build_args.txt | |
cd nginx-1.14.1 | |
./configure --with-compat $(cat build_args.txt) --add-dynamic-module=../ngx_brotli | |
make install | |
#copy the dynamic module to your nginx lib | |
sudo cp objs/ngx_http_brotli_filter_module.so /usr/lib/nginx/modules/ | |
sudo chmod 644 /usr/lib/nginx/modules/ngx_http_brotli_filter_module.so | |
sudo cp objs/ngx_http_brotli_static_module.so /usr/lib/nginx/modules/ | |
sudo chmod 644 /usr/lib/nginx/modules/ngx_http_brotli_static_module.so | |
#in yor nginx.conf use | |
# load_module /usr/lib/nginx/modules/ngx_http_brotli_filter_module.so; | |
# load_module /usr/lib/nginx/modules/ngx_http_brotli_static_module.so; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment