Build Nginx Based #106
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
name: Build Nginx Based | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
nginx_version: | ||
description: "Specify the nginx version" | ||
required: true | ||
default: "1.27.2" | ||
prefix: | ||
description: "Specify the installation prefix" | ||
required: true | ||
default: "/usr/local/nginx" | ||
jobs: | ||
build-nginx: | ||
runs-on: rockylinux-latest | ||
env: | ||
NGINX_SRC_DIR: "/opt/nginx" | ||
PREFIX: ${{ github.event.inputs.prefix }} | ||
NGINX_VERSION: ${{ github.event.inputs.nginx_version }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Update System and Install Dependencies | ||
run: | | ||
sudo dnf --setopt=fastestmirror=True --setopt=deltarpm=True \ | ||
--setopt=max_parallel_downloads=10 --setopt=keepcache=True makecache && | ||
sudo dnf -y update && | ||
sudo dnf -y in epel-release && | ||
sudo dnf -y groupinstall "Development Tools" && | ||
sudo dnf -y in nano wget cmake go automake gcc gcc-c++ kernel-devel git make tar autoconf \ | ||
zlib-devel openssl-devel pcre-devel perl-IPC-Cmd libaio-devel \ | ||
brotli-devel glibc-headers glibc-devel libbsd-devel perl-core \ | ||
libxcrypt-compat libtool binutils binutils-gold | ||
- name: Clone and Build libmaxminddb | ||
run: | | ||
cd ${{ env.NGINX_SRC_DIR}} && | ||
git clone --depth 1 --recurse-submodules https://github.com/maxmind/libmaxminddb.git && | ||
cd libmaxminddb && ./bootstrap && ./configure && | ||
make -j$(nproc) && sudo make install && sudo make clean | ||
- name: Clone OpenSSL | ||
run: | | ||
cd ${{ env.NGINX_SRC_DIR}} && | ||
git clone --depth 1 --recurse-submodules https://github.com/quictls/openssl.git | ||
- name: Clone and Build jemalloc | ||
run: | | ||
cd ${{ env.NGINX_SRC_DIR}} && | ||
git clone --depth 1 --recurse-submodules https://github.com/jemalloc/jemalloc.git && | ||
cd jemalloc && ./autogen.sh && ./configure && | ||
make -j$(nproc) && sudo make install && sudo make clean && | ||
sudo ln -sf /usr/local/lib/libjemalloc.so.2 /usr/lib64/libjemalloc.so.2 | ||
- name: Clone ngx_brotli | ||
run: | | ||
cd ${{ env.NGINX_SRC_DIR}} && | ||
git clone --depth 1 --recurse-submodules https://github.com/google/ngx_brotli.git && | ||
cd ngx_brotli && git submodule update --init | ||
- name: Clone and Build zstd | ||
run: | | ||
cd ${{ env.NGINX_SRC_DIR}} && | ||
git clone --depth 1 --recurse-submodules https://github.com/facebook/zstd.git && | ||
cd zstd && make -j$(nproc) && sudo make install && sudo make clean | ||
- name: Clone ngx_zstd | ||
run: | | ||
cd ${{ env.NGINX_SRC_DIR}} && | ||
git clone --depth 1 --recurse-submodules https://github.com/tokers/zstd-nginx-module.git | ||
- name: Clone and Build PCRE2 | ||
run: | | ||
cd ${{ env.NGINX_SRC_DIR}} && | ||
git clone --depth 1 --recurse-submodules https://github.com/PCRE2Project/pcre2.git && | ||
cd pcre2 && ./autogen.sh && ./configure && | ||
make -j$(nproc) && sudo make install && sudo make clean | ||
- name: Clone ngx_http_geoip2_module | ||
run: | | ||
cd ${{ env.NGINX_SRC_DIR}} && | ||
git clone --depth 1 --recurse-submodules https://github.com/leev/ngx_http_geoip2_module.git | ||
- name: Clone and Build LuaJIT2 | ||
run: | | ||
cd ${{ env.NGINX_SRC_DIR}} && | ||
git clone --depth 1 --recurse-submodules https://github.com/openresty/luajit2.git && | ||
cd luajit2 && make -j$(nproc) && sudo make install && sudo make clean | ||
- name: Clone ngx_devel_kit | ||
run: | | ||
cd ${{ env.NGINX_SRC_DIR}} && | ||
git clone --depth 1 --recurse-submodules https://github.com/vision5/ngx_devel_kit.git | ||
- name: Clone lua_nginx_module | ||
run: | | ||
cd ${{ env.NGINX_SRC_DIR}} && | ||
git clone --depth 1 --recurse-submodules https://github.com/openresty/lua-nginx-module.git | ||
- name: Download and Extract Nginx | ||
run: | | ||
cd ${{ env.NGINX_SRC_DIR}} && | ||
wget https://nginx.org/download/nginx-${{ env.NGINX_VERSION }}.tar.gz && | ||
tar -zxvf nginx-${{ env.NGINX_VERSION }}.tar.gz | ||
- name: Configure Nginx | ||
run: | | ||
cd ${{ env.NGINX_SRC_DIR}}/nginx-${{ env.NGINX_VERSION }} && | ||
sudo source ~/.bashrc && sudo ldconfig && | ||
sudo ./configure --prefix=${{ env.PREFIX }} \ | ||
--with-compat \ | ||
--with-threads \ | ||
--with-file-aio \ | ||
--with-http_v2_module \ | ||
--with-http_v3_module \ | ||
--with-http_ssl_module \ | ||
--with-http_sub_module \ | ||
--with-http_slice_module \ | ||
--with-http_realip_module \ | ||
--with-http_degradation_module \ | ||
--with-http_stub_status_module \ | ||
--with-pcre-jit \ | ||
--with-pcre=../pcre2 \ | ||
--with-stream \ | ||
--with-stream_ssl_module \ | ||
--with-stream_ssl_preread_module \ | ||
--with-openssl=../openssl \ | ||
--add-module=../ngx_zstd \ | ||
--add-module=../ngx_brotli \ | ||
--add-dynamic-module=../ngx_http_geoip2_module \ | ||
--with-ld-opt="-ljemalloc -lcrypt -Wl,-z,relro,-z,now -flto -fuse-ld=gold" \ | ||
--with-openssl-opt='no-weak-ssl-ciphers enable-ec_nistp_64_gcc_128 enable-tls1_3 enable-quic' \ | ||
--with-cc-opt='-O3 -march=haswell -mtune=haswell -mavx2 -funroll-loops -fprefetch-loop-arrays \ | ||
-fstack-protector-strong -D_FORTIFY_SOURCE=2 -fPIC -pipe -flto -fuse-ld=gold' | ||
- name: Build Nginx | ||
env: | ||
NGINX_BUILD: ${{ NGINX_SRC_DIR }}/build/ | ||
Check failure on line 142 in .github/workflows/build_nginx.yml GitHub Actions / Build Nginx BasedInvalid workflow file
|
||
run: | | ||
sudo source ~/.bashrc && sudo ldconfig && | ||
cd ${{ env.NGINX_SRC_DIR}}/nginx-${{ env.NGINX_VERSION }} && | ||
make -j$(nproc) && sudo mkdir -p ${{ NGINX_BUILD }} | ||
sudo objs/nginx -V &> ${{ NGINX_BUILD }}/nginx_build_info.txt && | ||
sudo mv objs/nginx ${{ NGINX_BUILD }} && | ||
sudo mv objs/ngx_http_geoip2_module.so ${{ NGINX_BUILD }} | ||
- name: Upload Nginx binary and build information to repository | ||
uses: actions/upload-artifact@v4 | ||
env: | ||
NGINX_BUILD: ${{ NGINX_SRC_DIR }}/build/ | ||
with: | ||
name: nginx-linux64-${{ env.NGINX_VERSION }} | ||
path: | | ||
${{ NGINX_BUILD }}/nginx | ||
${{ NGINX_BUILD }}/nginx_build_info.txt | ||
${{ NGINX_BUILD }}/ngx_http_geoip2_module.so | ||
retention-days: 2 | ||
compression-level: 9 | ||
if-no-files-found: error |