Skip to content

Instantly share code, notes, and snippets.

@woohooyeah
Last active July 21, 2026 19:48
Show Gist options
  • Select an option

  • Save woohooyeah/89cab25d0b1cea92bc14 to your computer and use it in GitHub Desktop.

Select an option

Save woohooyeah/89cab25d0b1cea92bc14 to your computer and use it in GitHub Desktop.
#!/bin/bash
export NGINX_VERSION="1.31.3"
export PCRE2_VERSION="10.47"
export OPENSSL_VERSION="4.0.1"
export SPNEGO_VERSION="1.1.3"
export GEOIP2_VERSION="3.4"
export VERSION_NGINX="nginx-${NGINX_VERSION}"
export VERSION_PCRE2="pcre2-${PCRE2_VERSION}"
export VERSION_OPENSSL="openssl-${OPENSSL_VERSION}"
export VERSION_SPNEGO="v${SPNEGO_VERSION}"
export VERSION_GEOIP2="${GEOIP2_VERSION}"
export SOURCE_NGINX="https://nginx.org/download"
export SOURCE_PCRE2="https://github.com/PCRE2Project/pcre2/releases/download/${VERSION_PCRE2}"
export SOURCE_OPENSSL="https://github.com/openssl/openssl/releases/download/${VERSION_OPENSSL}"
export SOURCE_SPNEGO="https://github.com/stnoonan/spnego-http-auth-nginx-module/archive/refs/tags"
export SOURCE_GEOIP2="https://github.com/leev/ngx_http_geoip2_module/archive/refs/tags"
rm -rf build
mkdir build
sudo apt install -y wget build-essential libgeoip-dev checkinstall git krb5-user uuid-dev libmaxminddb-dev libgss-dev
wget -P ./build "${SOURCE_PCRE2}/${VERSION_PCRE2}.tar.gz"
wget -P ./build "${SOURCE_OPENSSL}/${VERSION_OPENSSL}.tar.gz"
wget -P ./build "${SOURCE_NGINX}/${VERSION_NGINX}.tar.gz"
wget -P ./build "${SOURCE_SPNEGO}/${VERSION_SPNEGO}.tar.gz"
wget -P ./build "${SOURCE_GEOIP2}/${VERSION_GEOIP2}.tar.gz"
cd build || exit 1
tar xzf "${VERSION_NGINX}.tar.gz"
tar xzf "${VERSION_OPENSSL}.tar.gz"
tar xzf "${VERSION_PCRE2}.tar.gz"
tar xzf "${VERSION_SPNEGO}.tar.gz"
tar xzf "${VERSION_GEOIP2}.tar.gz"
cd ../ || exit 1
BPATH="$(pwd)/build"
export BPATH
export STATICLIBSSL="${BPATH}/${VERSION_OPENSSL}"
cd "${STATICLIBSSL}" || exit 1
./Configure LDFLAGS=-lrt --prefix="${STATICLIBSSL}/.openssl" && make -j"$(nproc)" install_sw
cd "${BPATH}/${VERSION_NGINX}" || exit 1
mkdir -p "${BPATH}/nginx"
./configure --with-openssl="$STATICLIBSSL" \
--with-cc-opt="-Wno-discarded-qualifiers" \
--add-module="${BPATH}/ngx_http_geoip2_module-${GEOIP2_VERSION}" \
--add-module="${BPATH}/spnego-http-auth-nginx-module-${SPNEGO_VERSION}" --with-debug \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-client-body-temp-path=/var/lib/nginx/body \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--http-log-path=/var/log/nginx/access.log \
--http-proxy-temp-path=/var/lib/nginx/proxy \
--http-scgi-temp-path=/var/lib/nginx/scgi \
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
--lock-path=/var/lock/nginx.lock \
--pid-path=/run/nginx.pid \
--sbin-path=/usr/sbin/nginx \
--with-debug \
--with-file-aio \
--with-http_addition_module \
--with-http_auth_request_module \
--with-http_geoip_module \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_sub_module \
--with-http_v2_module \
--with-http_v3_module \
--with-ld-opt="-lrt" \
--with-pcre-jit \
--with-pcre="${BPATH}/${VERSION_PCRE2}" \
--with-threads \
--without-mail_imap_module \
--without-mail_pop3_module \
--without-mail_smtp_module \
--build="nginx with ${VERSION_OPENSSL}"
touch "${STATICLIBSSL}/.openssl/include/openssl/ssl.h"
make -j"$(nproc)" && checkinstall --pkgname="nginx-openssl" --pkgversion="${NGINX_VERSION}" \
--provides="nginx" --requires="libc6, libpcre3, zlib1g" --strip=yes \
--stripso=yes --backup=yes -y --install=no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment