Last active
February 28, 2022 09:16
-
-
Save Dimtree/d07a537bcdfa6fe672b99ad08d93ceee to your computer and use it in GitHub Desktop.
Compile ngx-fancyindex dynamically for current nginx version
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
#!/bin/bash -e | |
#echo "Please enter NGINX version:" | |
#read version | |
version=$(nginx -v 2>&1 | egrep -o "([0-9]{1,}\.)+[0-9]{1,}") | |
echo "Read NGINX version as \"$version\"" | |
tmpdir=$(mktemp -d) | |
pushd "$tmpdir" | |
wget "http://nginx.org/download/nginx-${version}.tar.gz" | |
tar -xzf "nginx-${version}.tar.gz" | |
git clone --depth=1 "https://github.com/aperezdc/ngx-fancyindex.git" | |
pushd "nginx-${version}" | |
./configure --with-compat --add-dynamic-module=../ngx-fancyindex/ | |
make modules | |
sudo mv -v "/etc/nginx/modules/ngx_http_fancyindex_module.so" "/etc/nginx/modules/ngx_http_fancyindex_module.so.bak" || true | |
sudo mv -v "./objs/ngx_http_fancyindex_module.so" "/etc/nginx/modules/" | |
sudo nginx -t | |
sudo systemctl restart nginx | |
popd | |
rm -rf "$tmpdir" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment