From f2606bff156136419044d7414ad6a10e0e604bfe Mon Sep 17 00:00:00 2001 From: Arjun Sreedharan Date: Thu, 8 Feb 2024 23:00:59 +0000 Subject: [PATCH] nginx: add missing doc for env vars --- content/docs/howto/web-servers.md | 25 +++++++++++++++++++++++ content/docs/reference/nginx-reference.md | 6 ++++++ 2 files changed, 31 insertions(+) diff --git a/content/docs/howto/web-servers.md b/content/docs/howto/web-servers.md index 404d40ae..757740be 100644 --- a/content/docs/howto/web-servers.md +++ b/content/docs/howto/web-servers.md @@ -204,6 +204,16 @@ files to `/workspace/my-build-directory`. BP_WEB_SERVER_ROOT=htdocs {{< /code/copyable >}} +#### Set Location Path for the Server +In auto-generated `nginx.conf`, the +[`server.location`](https://nginx.org/en/docs/http/ngx_http_core_module.html#location) +directive is set to the catch-all or default location block. You can override +this by setting the `BP_WEB_SERVER_LOCATION_PATH` variable. + +{{< code/copyable >}} +BP_WEB_SERVER_LOCATION_PATH="/custom" +{{< /code/copyable >}} + #### Enable Push-State Routing The `BP_WEB_SERVER_ENABLE_PUSH_STATE` variable enables push state routing functionality. This is useful for single-page web applications. @@ -221,6 +231,21 @@ endpoint. BP_WEB_SERVER_FORCE_HTTPS=true {{< /code/copyable >}} +#### Obtain real-time status info +The `BP_NGINX_STUB_STATUS_PORT` variable exposes a handful of NGINX Server +metrics via the +[`stub_status`](https://nginx.org/en/docs/http/ngx_http_stub_status_module.html#stub_status) +module which provides basic status information on provided port. This comes +handy for monitoring the server. For example using [NGINX Prometheus +Exporter](https://github.com/nginxinc/nginx-prometheus-exporter) + +The info will be made available at the path `/stub_status` at the specified +port. Make sure that this port isn't used anywhere else in your application. + +{{< code/copyable >}} +BP_NGINX_STUB_STATUS_PORT=8083 +{{< /code/copyable >}} + #### Set Up Basic Authentication You are able to provide basic authentication credentials via a [service binding][service-binding] of type `htpasswd` that specifies the contents of a diff --git a/content/docs/reference/nginx-reference.md b/content/docs/reference/nginx-reference.md index 43b0873c..26ed726e 100644 --- a/content/docs/reference/nginx-reference.md +++ b/content/docs/reference/nginx-reference.md @@ -36,6 +36,9 @@ Defaults to `public`, setting this allows you to modify the location of the static files served by the web server with either an absolute file path or a file path relative to `/workspace`. +### BP_WEB_SERVER_LOCATION_PATH +Set server's location directive. + ### BP_WEB_SERVER_ENABLE_PUSH_STATE Enables push state routing functionality. @@ -43,6 +46,9 @@ Enables push state routing functionality. Allows you to enforce HTTPS for server connections by redirecting all requests to use the HTTPS protocol. +### BP_NGINX_STUB_STATUS_PORT +Gets NGINX basic status info via [`stub_status`](https://nginx.org/en/docs/http/ngx_http_stub_status_module.html#stub_status). + ## Supported Service Bindings The NGINX buildpack can be configured using [service bindings][service-binding]. ####