Build from source

Current nginz and nginz-token source builds require Zig 0.17.0 exactly. Install that compiler and put its zig executable on your PATH. The build checks the version and rejects a different release.

Use ReleaseSafe for optimized builds with safety checks enabled. Existing packaging recipes that explicitly select ReleaseFast retain that performance mode; follow the recipe when reproducing a packaged build.

Prerequisites

Build on Linux with git, make, a C compiler, and the development libraries documented in the selected repository’s README and Dockerfile. Initialize the vendored submodules before compiling. Using a prebuilt image does not require installing Zig on the deployment host.

nginz development binary

git clone https://github.com/darkanchor/nginz.git
cd nginz
git submodule update --init
test "$(zig version)" = "0.17.0"
zig build -Doptimize=ReleaseSafe

The bundled nginx wrapper is installed at zig-out/bin/nginz. Verify its unit tests and C/Zig layout checks with the same mode:

zig build test check-layout -Doptimize=ReleaseSafe

For modules to integrate into an nginx build, use:

zig build package -Doptimize=ReleaseSafe

The module objects and nginx config fragments are generated under zig-out/modules/. Follow the repository README for nginx configure flags, module order, system libraries, and compatibility requirements.

nginz-token module packages

git clone https://github.com/darkanchor/nginz-token.git
cd nginz-token
git submodule update --init
test "$(zig version)" = "0.17.0"
zig build package -Doptimize=ReleaseSafe

This generates the AI gateway module packages under zig-out/modules/. Follow the repository’s integration instructions to link them into nginx. Source availability remains governed by the repository’s BSL 1.1 license.

Earlier tutorials and measurements

The July 2026 AI gateway build tutorial records the Zig 0.16.0 and ReleaseSmall setup used at publication. Its original commands are retained for that context. Use the commands on this page for current source builds.

Dated performance and release posts retain their original compiler versions, optimization modes, and measurements. Those results describe the tested artifacts and do not establish performance for a rebuilt Zig 0.17 image.