Skip to content

Instantly share code, notes, and snippets.

@wanghuizzz
Last active May 16, 2025 11:38
Show Gist options
  • Save wanghuizzz/efe98f06b061372c990b8c3e53f673fc to your computer and use it in GitHub Desktop.
Save wanghuizzz/efe98f06b061372c990b8c3e53f673fc to your computer and use it in GitHub Desktop.
podman run --name debian9-build -itd debian:stretch bash
podman exec -it debian9-build bash
cat > /etc/apt/sources.list << EOF
deb http://archive.debian.org/debian stretch main contrib non-free
deb http://archive.debian.org/debian-security stretch/updates main contrib non-free
EOF
apt update
apt install -y sudo build-essential git wget libpcre3 libpcre3-dev zlib1g zlib1g-dev libxml2 libxml2-dev libxslt1-dev libgd-dev libgeoip-dev libmaxminddb-dev perl libperl-dev cmake unzip software-properties-common apt-transport-https ca-certificates
echo "deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main" > /etc/apt/sources.list.d/toolchain.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA9EF27F
apt-get update
apt-get install -y gcc-9 g++-9
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9
mkdir -p ~/nginx-build
cd ~/nginx-build
wget http://nginx.org/download/nginx-1.27.5.tar.gz
tar -xzf nginx-1.27.5.tar.gz
wget https://www.openssl.org/source/openssl-3.4.1.tar.gz
tar -xzf openssl-3.4.1.tar.gz
wget https://github.com/vision5/ngx_devel_kit/archive/refs/tags/v0.3.3.tar.gz -O ngx_devel_kit-0.3.3.tar.gz
tar -xzf ngx_devel_kit-0.3.3.tar.gz
wget https://github.com/openresty/lua-nginx-module/archive/refs/tags/v0.10.28.tar.gz -O lua-nginx-module-0.10.28.tar.gz
tar -xzf lua-nginx-module-0.10.28.tar.gz
wget https://github.com/openresty/headers-more-nginx-module/archive/refs/tags/v0.38.tar.gz -O headers-more-nginx-module-0.38.tar.gz
tar -xzf headers-more-nginx-module-0.38.tar.gz
wget https://github.com/FRiCKLE/ngx_cache_purge/archive/refs/tags/2.3.tar.gz -O ngx_cache_purge-2.3.tar.gz
tar -xzf ngx_cache_purge-2.3.tar.gz
wget https://github.com/LuaJIT/LuaJIT/archive/refs/tags/v2.1.0-beta3.tar.gz -O LuaJIT-2.1.0-beta3.tar.gz
tar -xzf LuaJIT-2.1.0-beta3.tar.gz
cd LuaJIT-2.1.0-beta3
make
sudo make install
cd ..
export LUAJIT_LIB=/usr/local/lib
export LUAJIT_INC=/usr/local/include/luajit-2.1
cd ~/nginx-build/nginx-1.27.5
./configure \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-stream_ssl_module \
--with-http_v2_module \
--with-http_v3_module \
--with-stream \
--conf-path=/usr/local/etc/nginx.conf \
--error-log-path=/var/log/nginx/error_log \
--http-log-path=/var/log/nginx/access_log \
--sbin-path=/usr/local/sbin/nginx \
--with-openssl=../openssl-3.4.1/ \
--with-openssl-opt=enable-weak-ssl-ciphers \
--with-openssl-opt=no-shared \
--with-openssl-opt=no-module \
--with-http_auth_request_module \
--with-http_slice_module \
--with-cc-opt='-O2 -flto -ffat-lto-objects' \
--with-threads \
--with-file-aio \
--add-module=../ngx_cache_purge-2.3/ \
--add-module=../ngx_devel_kit-0.3.3/ \
--add-module=../lua-nginx-module-0.10.28/ \
--add-module=../headers-more-nginx-module-0.38
make -j$(nproc)
readelf -S objs/nginx | grep debug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment