Reviewed-on: #10
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
- Support for H3/QUIC
- Brotli compression
- Zstandard compression
- GeoIP2
- Headers-More
- Post-quantum TLS key exchange (via OpenSSL)
- KTLS (requires kernel 5.10+)
- debug
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:
-vstream all build output (still logged),-qprint only errors and the final summary-r DIRbuild root,-j Nparallel jobs,-l FILElog file,-crunmake cleanfirst--no-brotli,--no-zstd,--no-geoip2,--no-headers,--no-ktls,--no-debug--asmbuild OpenSSL with its assembly optimizations (AES-NI etc.); the default isno-asm--check-updateslook 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
cd /path/to/buildroot/nginx-release-<version>sudo make install- Check nginx
sudo nginx -t - Reload nginx
sudo nginx -s reload - Verify new version
sudo nginx -vshould outputnginx version: freenginx/<version> (w/GeoIP2,Brotli,Zstd,H3,Headers-More,Quantum,debug,KTLS) - Optionally free up disk space with
./freenginx.sh --purge(same-rand versions as the build). It refuses to run if the built binary doesn't match/usr/sbin/nginx.