|
| 1 | +# nginx-src |
| 2 | + |
| 3 | +The crate contains a vendored copy of the NGINX source and a logic to build it. |
| 4 | +It is intended to be consumed by the [nginx-sys] crate for CI builds, tests or |
| 5 | +rustdoc generation. |
| 6 | + |
| 7 | +It is notably not intended for producing binaries suitable for production use. |
| 8 | +For such scenarios we recommend building the `ngx-rust` based module against |
| 9 | +the packages from <https://nginx.org/> or your preferred distribution. |
| 10 | +See the [nginx-sys] documentation for building `ngx-rust` modules against an |
| 11 | +existing pre-configured NGINX source tree. |
| 12 | + |
| 13 | +[nginx-sys]: https://docs.rs/nginx-sys/ |
| 14 | + |
| 15 | +## Versioning |
| 16 | + |
| 17 | +This crate follows the latest stable branch of NGINX. |
| 18 | + |
| 19 | + * The major and minor fields are taken from the NGINX version. |
| 20 | + * The patch version is incremented on changes to the build logic or crate |
| 21 | + metadata. |
| 22 | + * The version metadata contains full version of NGINX. |
| 23 | + |
| 24 | +## Build Requirements |
| 25 | + |
| 26 | +The crate can be built on common Unix-like operating systems and requires all |
| 27 | +the usual NGINX build dependencies (including development headers for the |
| 28 | +libraries) installed in system paths: |
| 29 | + |
| 30 | + * C compiler and toolchain |
| 31 | + * SSL library, OpenSSL or LibreSSL |
| 32 | + * PCRE or PCRE2 |
| 33 | + * Zlib or zlib-ng witn Zlib compatible API enabled |
| 34 | + |
| 35 | +We don't intend to support Windows at the moment, as NGINX does not support |
| 36 | +dynamic modules for this target. |
| 37 | + |
| 38 | +## Environment variables |
| 39 | + |
| 40 | +Following variables can be set to customize the build. |
| 41 | + |
| 42 | + * `NGX_CONFIGURE_ARGS` — additional arguments to pass to the NGINX configure |
| 43 | + script. |
| 44 | + |
| 45 | + Example: `export NGX_CONFIGURE_ARGS='--with-debug'; cargo build` |
| 46 | + |
| 47 | + * `NGX_CFLAGS`, `NGX_LDFLAGS` — additional C compiler and linker flags to |
| 48 | + pass to the NGINX configure script. Internally, this is added to the |
| 49 | + `--with-cc-opt=...` and `--with-ld-opt=...` configure arguments. |
| 50 | + |
| 51 | + Example: |
| 52 | + ```sh |
| 53 | + export NGX_CFLAGS='-I/opt/boringssl/include' |
| 54 | + export NGX_LDFLAGS='-L/opt/boringssl/build -lstdc++' |
| 55 | + cargo build |
| 56 | + ``` |
| 57 | + |
| 58 | +## Download NGINX and dependency sources during build |
| 59 | + |
| 60 | +While we recommend using the system libraries, it is still possible to opt into |
| 61 | +downloading the NGINX itself and the dependency sources from the network with |
| 62 | +the help of the following variables: |
| 63 | + |
| 64 | + * `NGX_VERSION` — if specified, the version of NGINX to download and build |
| 65 | + instead of the one bundled with the crate. |
| 66 | + * `OPENSSL_VERSION` — if specified, the version of OpenSSL to download and use |
| 67 | + use instead of the system-provided library. |
| 68 | + * `PCRE2_VERSION` — if specified, the version of PCRE2 to download and use |
| 69 | + instead of the system-provided library. |
| 70 | + * `ZLIB_VERSION` — if specified, the version of Zlib to download and use |
| 71 | + instead of the system-provided library. |
| 72 | + |
| 73 | +If the `gpg` executable is present in the path, the build script will verify |
| 74 | +the integrity of the downloaded files using GPG signatures and a known set of |
| 75 | +public keys. |
| 76 | +This behavior can be disabled by setting `NGX_NO_SIGNATURE_CHECK`. |
| 77 | + |
| 78 | +## License |
| 79 | + |
| 80 | +The code in this crate is licensed under the [Apache License 2.0](../LICENSE). |
| 81 | +The crate also contains the source code of NGINX, distributed under the |
| 82 | +[BSD 2-Clause License](https://nginx.org/LICENSE). |
0 commit comments