{"id":13789187,"url":"https://github.com/jaygooby/build-nginx","last_synced_at":"2025-03-22T15:30:35.095Z","repository":{"id":66731866,"uuid":"107274926","full_name":"jaygooby/build-nginx","owner":"jaygooby","description":"Fetches nginx and any optional third-party modules and dependencies you specify, such as openssl and PCRE and then configures and builds.","archived":false,"fork":false,"pushed_at":"2023-05-05T12:47:06.000Z","size":59,"stargazers_count":53,"open_issues_count":0,"forks_count":12,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-18T12:38:07.123Z","etag":null,"topics":["3rd-party-modules","build-tool","configuration","nginx"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jaygooby.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-10-17T13:49:07.000Z","updated_at":"2024-10-16T06:06:49.000Z","dependencies_parsed_at":"2024-01-07T04:03:36.024Z","dependency_job_id":"9c617fb7-5619-4913-9c4c-75a1085da599","html_url":"https://github.com/jaygooby/build-nginx","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaygooby%2Fbuild-nginx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaygooby%2Fbuild-nginx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaygooby%2Fbuild-nginx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaygooby%2Fbuild-nginx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaygooby","download_url":"https://codeload.github.com/jaygooby/build-nginx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244978341,"owners_count":20541838,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3rd-party-modules","build-tool","configuration","nginx"],"created_at":"2024-08-03T21:00:59.720Z","updated_at":"2025-03-22T15:30:34.649Z","avatar_url":"https://github.com/jaygooby.png","language":"Shell","funding_links":[],"categories":["Tools"],"sub_categories":["Lua Modules"],"readme":"# About `build-nginx`\nAn nginx build tool to really simplify downloading and building specific versions of [nginx](http://nginx.org/) with different core and 3rd-party modules.\n\n[![Build Status](https://app.travis-ci.com/jaygooby/build-nginx.svg?branch=master)](https://app.travis-ci.com/github/jaygooby/build-nginx)\n\n[`ngx_http_hello_world_module`](https://github.com/jaygooby/build-nginx/tree/hello-world-module) courtesy of [perusio](https://github.com/perusio/nginx-hello-world-module) and [kolesar-andras](https://github.com/kolesar-andras/nginx-hello-world-module/tree/content-length)\n\n# TODO                                                                                                                                    \n\n  - [x] Work with git urls\n  - [x] Work with archive urls (gzip \u0026 zipped tar releases)\n  - [x] Use PCRE2 (you can also still use PCRE 1) `build-nginx` will do the right thing based on the dependency url you provide:\n  * `build-nginx -d https://ftp.exim.org/pub/pcre/pcre-8.44.tar.gz` will use the old PCRE library\n\n  * `build-nginx -d https://github.com/PCRE2Project/pcre2.git` will use the official PCRE2 github repo\n\n  * `build-nginx -d https://github.com/PCRE2Project/pcre2.git@pcre2-10.40` will build the PCRE2 release tagged `pcre2-10.40`\n\n  * `build-nginx -d https://sourceforge.net/projects/pcre/files/pcre2/10.37/pcre2-10.37.zip` will use the `10.37` zip at the unofficial sourceforge mirror\n  - [ ] Handle dynamic nginx modules\n  - [ ] Provide different example configurations\n  - [ ] Update README with notes about:\n    - [x] 64 bit MacOS Openssl builds\n    - [ ] Use non-static Openssl on MacOS\n    - [ ] How certain modules might implicitly enable the `--with-http_ssl_module` option\n    - [ ] what takes precedence when you specify the same commandline option in a -k options file **and** on the commandline\n\n# Usage\nBasic usage:\n\n```\n./build-nginx\n```\n\nWill `git --depth 1 --single-branch clone` the nginx `master` branch, configure and build it. Not so very useful...\n\n## Specific nginx version and OpenSSL dependency, with non-core module\nHow about getting nginx stable version 1.12.2 built with OpenSSL version 1.0.2l and HTTP/2 support?\n\n```\n./build-nginx \\\n-n https://github.com/nginx/nginx.git@release-1.12.2 \\\n-d https://github.com/openssl/openssl.git@OpenSSL_1_0_2l \\\n-o --with-http_v2_module\n```\n\nBecause you've specified OpenSSL as a dependency (`-d`) the nginx configure script automatically gets set with the `--with-openssl=` path.\n\nThe `@` syntax lets you specify a release/tag/branch (or even specific commit - any [tree-ish reference](https://git-scm.com/docs/gitglossary#gitglossary-aiddeftree-ishatree-ishalsotreeish) should work).\n\nHere we're building nginx `master` with PCRE2 tagged at `pcre2-10.40`\n\n```\nbuild-nginx -d https://github.com/PCRE2Project/pcre2.git@pcre2-10.40\n```\n\n### Building OpenSSL on 64bit macos\nYou'll need to `export KERNEL_BITS=64` or call `build-nginx` like this:\n\n```\nKERNEL_BITS=64 ./build-nginx \\\n-n https://github.com/nginx/nginx.git@release-1.12.2 \\\n-d https://github.com/openssl/openssl.git@OpenSSL_1_0_2l\n```\n\n## Archive URLs as well as git repos\nIf you don't want to use a git repo, you can also use a source archive:\n\n```\n./build-nginx -n http://nginx.org/download/nginx-1.13.6.tar.gz \\\n              -d https://sourceforge.net/projects/pcre/files/pcre2/10.37/pcre2-10.37.zip \\\n              -d https://www.openssl.org/source/openssl-1.0.2l.tar.gz\n```\n\n## 3rd party modules\nYou can also specify 3rd party modules using the same `git repo url @ version/tag/branch` string or archive url format. In the following example we haven't specifed an nginx version, so we clone from master, but we do clone a forked version of the nginx-upstream-fair module at version 0.1.3\n\n```\n./build-nginx \\\n-m https://github.com/itoffshore/nginx-upstream-fair@0.1.3\n```\n\nBecause we've specified a module (`-m`) the nginx configure script is automatically called with the `--add-module=` option, pointing to where the module was cloned.\n\nYou could also use the official release archive URL:\n\n```\n./build-nginx \\\n-m https://github.com/itoffshore/nginx-upstream-fair/archive/0.1.3.zip\n```\n\n## 3rd party modules with a different config folder\nSome nginx modules don't have the `config` file in their root, and in these cases you need to let the nginx configure script know where to find it. Do this with an optional folder name after the version; in the example below we're using the [NAXSI](https://github.com/nbs-system/naxsi) project repository, specifying version `0.55.3` and letting the configure script know it needs to look in the NAXSI `naxsi_src` folder for the `config` file.\n\n```\n./build-nginx \\\n-n https://github.com/nginx/nginx.git@release-1.12.2 \\\n-m https://github.com/nbs-system/naxsi.git@0.55.3,naxsi_src\n```\n\n## Configuration files\nAs well as specifying the options to `build-nginx` on the command line, you can save them into a configuration file, and pass this to the script instead:\n\n```\n./build-nginx -k my-special-nginx-config\n```\n\nThe config file is just a set of command-line options separated by newlines. Comments are permitted. Your `my-special-nginx-config` file might look like:\n\n```\n# nginx version 1.0\n-n https://github.com/nginx/nginx.git@release-1.0.0\n# it all lives in /opt/nginx\n-o --prefix=/opt/nginx\n-o --with-http_ssl_module # HTTPS\n-o --with-debug # helps us debug location directive errors\n# Use the OpenSSL in /opt\n-o --with-cc-opt=-I/opt/openssl/include\n-o --with-ld-opt=-L/opt/openssl/lib\n```\n\n## Other options\nCall with `-h` to see the full set of options you can use. Currently these are:\n\n```\n-b If you want to build from an existing source repo\n\n-c If you only want to clone (download) and not build\n\n-f \u003coptional compiler flags\u003e Lets you specify CFLAGS like -Wno-unused-variable\n\n-d \u003cdependencies\u003e Specify a git url and branch/tag/version for e.g. pcre\n\n-h Help\n\n-i Install. This will install to nginx's `configure` default location. To change,\npass the nginx `--prefix` option like this:\n\n   build-nginx -i -o --prefix=/usr/local/nginx\n\n-k \u003cfile\u003e Specify which config file to read this script's arguments from.\n          The config file is a text file in which command line arguments\n          can be written which then will be used as if they were written\n          on the actual command line.\n\n-m \u003cadditional modules\u003e Specify either an archive (.tar.gz, .tgz or .zip)\n                        URL or a git url, branch/tag/version and optional src\n                        folder where nginx looks for the module config file\n\n-n \u003curl\u003e Optional nginx archive (.tar.gz, .tgz or .zip) URL or git repo url\n         and/or optional branch/tag/version. Defaults to\n         https://github.com/nginx/nginx.git@master. To specify just a\n         branch/tag/version use @branch. To specify both, use git-url@branch\n\n-o \u003coptions\u003e To pass additional options to the nginx configure script\n\n-s \u003cbuild directory\u003e The directory where this script will git clone\n                     nginx and any modules and dependencies it needs\n                     to build. Defaults to ~/.build-nginx\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaygooby%2Fbuild-nginx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaygooby%2Fbuild-nginx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaygooby%2Fbuild-nginx/lists"}