Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cubicdaiya/nginx-build
Seamless nginx builder
https://github.com/cubicdaiya/nginx-build
build-tool nginx
Last synced: 3 days ago
JSON representation
Seamless nginx builder
- Host: GitHub
- URL: https://github.com/cubicdaiya/nginx-build
- Owner: cubicdaiya
- License: mit
- Created: 2014-05-22T12:29:12.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-09-14T05:14:39.000Z (4 months ago)
- Last Synced: 2024-09-15T16:38:23.478Z (4 months ago)
- Topics: build-tool, nginx
- Language: Go
- Homepage:
- Size: 810 KB
- Stars: 400
- Watchers: 21
- Forks: 49
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nginx - nginx-build - seamless nginx builder. (Tools / Lua Modules)
README
# nginx-build
`nginx-build` - provides a command to build nginx seamlessly.
![gif](https://raw.githubusercontent.com/cubicdaiya/nginx-build/master/images/nginx-build.gif)
## Requirements
* [git](https://git-scm.com/) and [hg](https://www.mercurial-scm.org/) for downloading 3rd party modules
* [patch](https://savannah.gnu.org/projects/patch/) for applying patch to nginx## Build Support
* [nginx](https://nginx.org/)
* [OpenResty](https://openresty.org/)
* [freenginx](https://freenginx.org/)## Installation
```bash
go install github.com/cubicdaiya/nginx-build@latest
```## Quick Start
```console
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.
```bash
#!/bin/sh./configure \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
```Give this file to `nginx-build` with `-c`.
```bash
$ nginx-build -d work -c configure.example
```#### About `--add-module` and `--add-dynamic-module`
`nginx-build` allows to use `--add-module`.
```bash
$ nginx-build \
-d work \
--add-module=/path/to/ngx_http_hello_world
```Also, `nginx-build` allows to use `--add-dynamic-module`.
```bash
$ nginx-build \
-d work \
--add-dynamic-module=/path/to/ngx_http_hello_world
```### Embedding zlib statically
Give `-zlib` to `nginx-build`.
```bash
$ nginx-build -d work -zlib
````-zlibversion` is an option to set a version of zlib.
### Embedding PCRE statically
Give `-pcre` to `nginx-build`.
```bash
$ nginx-build -d work -pcre
````-pcreversion` is an option to set a version of PCRE.
### Embedding OpenSSL statically
Give `-openssl` to `nginx-build`.
```bash
$ nginx-build -d work -openssl
````-opensslversion` is an option to set a version of OpenSSL.
### Embedding LibreSSL statically
Give `-libressl` to `nginx-build`.
```bash
$ 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.```ini
[
{
"name": "ngx_http_hello_world",
"form": "git",
"url": "https://github.com/cubicdaiya/ngx_http_hello_world"
}
]
```Give this file to `nginx-build` with `-m`.
```bash
$ nginx-build -d work -m modules.json.example
```#### Embedding 3rd-party module dynamically
Give `true` to `dynamic`.
```ini
[
{
"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.```ini
[
{
"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.
```console
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`.```bash
$ nginx-build -d work -idempotent
````-idempotent` ensures an idempotent by checking the software versions below.
* nginx
* PCRE
* zlib
* OpenSSLOn the other hand, `-idempotent` does not cover versions of 3rd party modules and dynamic linked libraries.
## Build OpenResty
`nginx-build` supports to build [OpenResty](https://openresty.org/).
```bash
$ 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](#configuration-for-building-nginx) is helpful.## Build freenginx
`nginx-build` supports to build [freenginx](https://freenginx.org/).
```bash
$ nginx-build -d work -freenginx -openssl
```If you don't install OpenSSL on your system, it is required to add the option `-openssl`.