nginx-build - provides a command to build nginx seamlessly.
go install github.com/cubicdaiya/nginx-build@latestnginx-build -d worknginx-build provides a mechanism for customizing configuration for building nginx.
Prepare a configure script like the following.
#!/bin/sh ./configure \ --sbin-path=/usr/sbin/nginx \ --conf-path=/etc/nginx/nginx.conf \Give this file to nginx-build with -c.
$ nginx-build -d work -c configure.exampleGive -zlib to nginx-build.
$ nginx-build -d work -zlib-zlibversion is an option to set a version of zlib.
Give -pcre to nginx-build.
$ nginx-build -d work -pcre-pcreversion is an option to set a version of PCRE.
Give -openssl to nginx-build.
$ nginx-build -d work -openssl-opensslversion is an option to set a version of OpenSSL.
Give -libressl to nginx-build.
$ nginx-build -d work -libressl-libresslversion is an option to set a version of LibreSSL.
nginx-build supports using arbitrary SSL libraries through custom SSL options. This is useful for libraries like BoringSSL that are not available as standard options.
To use a custom SSL library, provide the download URL with -customssl. The URL can be either a tarball or a Git repository:
# Using BoringSSL from Git repository $ nginx-build -d work -customssl https://boringssl.googlesource.com/boringssl -customsslname boringssl # Using a tarball URL $ nginx-build -d work -customssl https://example.com/customssl-1.0.0.tar.gz -customsslname customsslFor Git repositories, you can specify a tag or branch with -customssltag:
# Use BoringSSL with chromium-stable branch $ nginx-build -d work \ -customssl https://boringssl.googlesource.com/boringssl \ -customsslname boringssl \ -customssltag chromium-stable # Use OpenSSL from Git with specific tag $ nginx-build -d work \ -customssl https://github.com/openssl/openssl.git \ -customsslname openssl-git \ -customssltag openssl-3.5.1 # Use oqs-provider (OpenSSL provider) with tag 0.9.0 $ nginx-build -d work \ -customssl https://github.com/open-quantum-safe/oqs-provider.git \ -customsslname oqs-provider \ -customssltag 0.9.0You can also use tarball URLs for custom SSL libraries:
# Using a custom OpenSSL build from a tarball $ nginx-build -d work \ -customssl https://example.com/myssl-1.0.0.tar.gz \ -customsslname myssl-customssl: URL of the custom SSL library (supports both Git repositories and tarballs)-customsslname: Name for the custom SSL library (used in directory names)-customssltag: Git tag or branch to checkout (only for Git repositories)
The following Git repository URL formats are automatically detected:
- URLs ending with 
.git - URLs using 
git://protocol - GitHub repository URLs (e.g., 
https://github.com/user/repo) - Google Source URLs (e.g., 
https://boringssl.googlesource.com/boringssl) 
Note: URLs containing /releases/download/ or /archive/ are treated as tarball downloads, not Git repositories.
nginx-build provides a mechanism for embedding 3rd-party modules. Prepare a json file below.
[ { "name": "ngx_http_hello_world", "form": "git", "url": "https://github.com/cubicdaiya/ngx_http_hello_world" } ]Give this file to nginx-build with -m.
$ nginx-build -d work -m modules.json.exampleGive true to dynamic.
[ { "name": "ngx_http_hello_world", "form": "git", "url": "https://github.com/cubicdaiya/ngx_http_hello_world", "dynamic": true } ]There are some 3rd-party modules expected provision. nginx-build provides the options such as shprov and shprovdir for this problem. There is the example configuration below.
[ { "name": "njs/nginx", "form": "hg", "url": "https://hg.nginx.org/njs", "shprov": "./configure && make", "shprovdir": ".." } ]nginx-build provides the options such as -patch and -patch-opt for applying patch to nginx.
nginx-build \  -d work \  -patch something.patch \  -patch-opt "-p1"nginx-build supports a certain level of idempotent build of nginx. If you want to ensure a build of nginx idempotent and do not want to build nginx as same as already installed nginx, give -idempotent to nginx-build.
$ nginx-build -d work -idempotent-idempotent ensures an idempotent by checking the software versions below.
- nginx
 - PCRE
 - zlib
 - OpenSSL
 
On the other hand, -idempotent does not cover versions of 3rd party modules and dynamic linked libraries.
nginx-build supports to build OpenResty.
$ nginx-build -d work -openresty -pcre -opensslIf you don't install PCRE and OpenSSL on your system, it is required to add the option -pcre and -openssl.
And there is the limitation for the support of OpenResty. nginx-build does not allow to use OpenResty's unique configure options directly. If you want to use OpenResty's unique configure option, Configuration for building nginx is helpful.
nginx-build supports to build freenginx.
$ nginx-build -d work -freenginx -opensslIf you don't install OpenSSL on your system, it is required to add the option -openssl.
