Build nginx from source with verified modules, selectable profiles, and GeoIP support.
Installation · How it works · Compatibility · Troubleshooting · Usage · Contributing
- ✅ nginx source tarballs are PGP-verified against pinned nginx.org signing keys.
- ✅ Third-party sources are pinned and checksum-verified from
tmiland/nginx-modules. - ✅ Module dependencies resolve automatically;
lua-nginxpulls inluajit2andngx-devel-kit. - ✅ Minimal and full built-in profiles; third-party modules by id or curated bundle.
- ✅ GeoIP credentials stay in a mode-0600 env file instead of the process list.
- ✅ CI builds on Debian 12/13 and Ubuntu 22.04/24.04.
Full module mainline install on Debian 13 with nginx 1.31.9. Build output is sped up after the command; the command is in Installation.
Run the installer as root. The examples use sudo; omit it if you are already root.
Latest tested release:
curl -fsSL https://github.com/tmiland/nginx-installer/releases/latest/download/nginx_installer.sh -o nginx_installer.sh chmod +x nginx_installer.sh
The main branch is available for development, but is not the tested release:
curl -fsSL https://raw.githubusercontent.com/tmiland/nginx-installer/main/nginx_installer.sh -o nginx_installer.sh chmod +x nginx_installer.sh
| Recipe | --profile |
--modules |
Native HTTP/3 |
|---|---|---|---|
| Full module mainline | full |
all |
yes |
| Minimal mainline | minimal |
all |
no |
| Nginx only | minimal |
none | no |
| Stable default | minimal |
none | no |
Full built-in profile, the all third-party module set, GeoIP, and the bad bot blocker:
sudo ./nginx_installer.sh -m \ --profile full \ --modules "all" \ --geoip-env-file "$HOME"/.credentials/geoip.env \ --bad-bot \ --dir /opt/nginx
-m selects the latest mainline nginx. Remove --bad-bot if you do not want the blocker.
Note
--modules "all" includes geoip2, so the GeoIP credentials file is required.
The same all module set with the smaller built-in profile:
sudo ./nginx_installer.sh -m \ --profile minimal \ --modules "all" \ --geoip-env-file "$HOME"/.credentials/geoip.env \ --bad-bot \ --dir /opt/nginx
The minimal profile builds TLS, HTTP/2, real IP, threads, file AIO, PCRE, and compatibility support only. It does not include native HTTP/3; --profile full adds that.
For nginx only, with no third-party modules:
sudo ./nginx_installer.sh -m --profile minimal
With no arguments, the installer builds the latest stable nginx with the minimal built-in profile and no third-party modules:
sudo ./nginx_installer.sh
sudo mkdir -p /opt/nginx-installer sudo curl -fsSL https://github.com/tmiland/nginx-installer/releases/latest/download/nginx_installer.sh -o /opt/nginx-installer/nginx-installer.sh sudo chmod +x /opt/nginx-installer/nginx-installer.sh sudo ln -sf /opt/nginx-installer/nginx-installer.sh /usr/local/bin/nginx-installer sudo nginx-installer
flowchart LR
A[Detect distro] --> B[Install packages]
B --> C[Download + PGP-verify nginx]
B --> D[Download + verify modules]
C --> E[Resolve module ids]
D --> E
E --> F[Apply patches + build libs]
F --> G[Configure + compile]
G --> H[Install + test + restart]
The installer never installs a distribution nginx package. It verifies the nginx source and the module bundle, resolves module dependencies, applies the selected patches, compiles nginx, installs it, and tests the configuration before restarting the service.
Full build flow, module bundle, and verification boundaries →
| Platform | CI coverage |
|---|---|
| Debian 12 (bookworm) | build + uninstall |
| Debian 13 (trixie) | build + uninstall; module jobs |
| Ubuntu 22.04 / 24.04 | build + uninstall |
| Linux Mint 21.3 / LMDE 7 | detection |
Debian 9+ is the intended range; Debian 12/13 are the current CI baseline. Stable 1.30.7 is covered by CI; mainline 1.31.9 was manually verified with the full module set.
Full compatibility matrix and verification details →
| Symptom | Fix |
|---|---|
pkg-config not found |
Upgrade to v2.0.1+ |
Cannot prepare build directory: /opt/nginx |
Upgrade to v2.0.1+, or pass --dir "$(realpath -m /opt/nginx)" |
ngx_http_lua_module 0.10.29 required |
Use nginx-modules v2026.11.6+ |
tlsdyn patch fails |
Use nginx-modules v2026.11.5+ |
geoip2 requires GeoIP credentials |
Create ~/.credentials/geoip.env |
Full troubleshooting guide and diagnostics →
sudo ./nginx_installer.sh --help
sudo ./nginx_installer.sh --detect
sudo ./nginx_installer.sh --modules "web,lua"The full option list, profile table, module bundle reference, and GeoIP details live in docs/usage.md.
- Debian 9 or later, and Debian-family distributions including Ubuntu.
- Root access.
- Network access to nginx.org, GitHub, and the module sources.
- Enough disk space and RAM to compile nginx and the selected modules.
Requirements and tested platforms →
nginx -V
The configure arguments show the selected profile and every --add-module. That line is the authoritative record of what was compiled.
See CONTRIBUTING.md for the test commands, CI layout, module-change workflow, and release steps.
See GitHub Releases for version history and release notes.
- Code is mixed and customized from nginx-autoinstall.
Use at own risk.
