freenginx-custom

Iamdoubz custom freenginx config, tested with Ubuntu 22.04 and 24.04. I was tired of forgetting what I used to compile freenginx so I made my own repo.

Enhancements

Everything except H3 and post-quantum can be turned off with a --no-* flag.

Dependencies

You need sudo and these packages:

sudo apt install build-essential git curl unzip cmake pkg-config libzstd-dev

libzstd-dev isn't needed if you build with --no-zstd.

Additional Packages

The script downloads these itself:

  • PCRE2
  • zlib
  • openssl
  • libmaxminddb, installed system-wide unless the pinned version is already installed. It isn't needed if you build with --no-geoip2.

How to download

Please use the provided script freenginx.sh. Make sure to make it executable first sudo chmod +x freenginx.sh. Then run it with ./freenginx.sh.

By default only the build steps are printed and all output goes to a log file in the build root. Options:

  • -v stream all build output (still logged), -q print only errors and the final summary
  • -r DIR build root, -j N parallel jobs, -l FILE log file, -c run make clean first
  • --no-brotli, --no-zstd, --no-geoip2, --no-headers, --no-ktls, --no-debug
  • --asm build OpenSSL with its assembly optimizations (AES-NI etc.); the default is no-asm
  • --check-updates look up the newest version of each versioned package and show it in the build steps and final summary, e.g. openssl-3.6.5 (cached - update available v3.6.6, newest v4.1.0). The build still uses your pinned versions. Modules tracked by git (GeoIP2, Brotli, Zstd) are always pulled, so they aren't checked.
  • Versions can be set from the environment: V_NGINX=1.31.6 V_QSSL=3.6.5 ./freenginx.sh

If a step fails, the script stops and prints the end of the log.

Make a backup of your existing binary

Type which nginx and make a copy i.e. sudo cp /usr/sbin/nginx /usr/sbin/nginx_apt. NOTE: if you have not installed nginx, you do not have to do this step. NOTE: this script for freenginx is built as a drop in replacement for nginx.

Install newly compiled binary

  1. cd /path/to/buildroot/nginx-release-<version>
  2. sudo make install
  3. Check nginx sudo nginx -t
  4. Reload nginx sudo nginx -s reload
  5. Verify new version sudo nginx -v should output nginx version: freenginx/<version> (w/GeoIP2,Brotli,Zstd,H3,Headers-More,Quantum,debug,KTLS)
  6. Optionally free up disk space with ./freenginx.sh --purge (same -r and versions as the build). It refuses to run if the built binary doesn't match /usr/sbin/nginx.
2025-02-10 15:36:09 -06:00
Languages
Shell 100%