nginx-build

无缝 nginx 构建工具。「Seamless nginx builder」

Github星跟蹤圖

nginx-build

nginx-build - provides a command to build nginx seamlessly.

gif

Requirements

  • git and hg for downloading 3rd party modules
  • patch for applying patch to nginx

Build Support

Installation

go install github.com/cubicdaiya/nginx-build@latest

Quick Start

nginx-build -d work

Custom Configuration

nginx-build provides a mechanism for customizing configuration for building nginx.

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.example

About --add-module and --add-dynamic-module

nginx-build allows to use --add-module.

$ nginx-build \
-d work \
--add-module=/path/to/ngx_http_hello_world

Also, nginx-build allows to use --add-dynamic-module.

$ nginx-build \
-d work \
--add-dynamic-module=/path/to/ngx_http_hello_world

Embedding zlib statically

Give -zlib to nginx-build.

$ nginx-build -d work -zlib

-zlibversion is an option to set a version of zlib.

Embedding PCRE statically

Give -pcre to nginx-build.

$ nginx-build -d work -pcre

-pcreversion is an option to set a version of PCRE.

Embedding OpenSSL statically

Give -openssl to nginx-build.

$ nginx-build -d work -openssl

-opensslversion is an option to set a version of OpenSSL.

Embedding LibreSSL statically

Give -libressl to nginx-build.

$ nginx-build -d work -libressl

-libresslversion is an option to set a version of LibreSSL.

Embedding 3rd-party modules

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.example

Embedding 3rd-party module dynamically

Give true to dynamic.

[
  {
    "name": "ngx_http_hello_world",
    "form": "git",
    "url": "https://github.com/cubicdaiya/ngx_http_hello_world",
    "dynamic": true
  }
]

Provision for 3rd-party module

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": ".."
  }
]

Applying patch before building nginx

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"

Idempotent build

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.

Build OpenResty

nginx-build supports to build OpenResty.

$ nginx-build -d work -openresty -pcre -openssl

If 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.

Build freenginx

nginx-build supports to build freenginx.

$ nginx-build -d work -freenginx -openssl

If you don't install OpenSSL on your system, it is required to add the option -openssl.

主要指標

概覽
名稱與所有者cubicdaiya/nginx-build
主編程語言Go
編程語言Makefile (語言數: 4)
平台
許可證MIT License
所有者活动
創建於2014-05-22 12:29:12
推送於2025-09-04 05:31:09
最后一次提交2025-08-30 14:03:40
發布數94
最新版本名稱v0.16.2 (發布於 )
第一版名稱v0.0.1 (發布於 )
用户参与
星數417
關注者數20
派生數49
提交數1k
已啟用問題?
問題數19
打開的問題數2
拉請求數177
打開的拉請求數6
關閉的拉請求數23
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?