Skip to content

Commit

Permalink
[bitnami/nginx] control stream block via NGINX_ENABLE_STREAM
Browse files Browse the repository at this point in the history
Signed-off-by: TrueGameover <truegameover@gmail.com>
  • Loading branch information
TrueGameover committed Sep 12, 2024
1 parent 7da42b8 commit 5ccffe8
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,3 @@ http {
}
}
}

stream {
include "/opt/bitnami/nginx/conf/stream_server_blocks/*.conf";
}
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ nginx_initialize() {
fi
nginx_configure "absolute_redirect" "$(is_boolean_yes "$NGINX_ENABLE_ABSOLUTE_REDIRECT" && echo "on" || echo "off" )"
nginx_configure "port_in_redirect" "$(is_boolean_yes "$NGINX_ENABLE_PORT_IN_REDIRECT" && echo "on" || echo "off" )"

if [[ "${NGINX_ENABLE_STREAM}" != "no" ]]; then
is_file_writable "$NGINX_CONF_FILE" && cat "${BITNAMI_ROOT_DIR}/scripts/nginx/bitnami-templates/default-stream-block.conf" >> "$NGINX_CONF_FILE"
fi
}

########################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ nginx_env_vars=(
NGINX_SKIP_SAMPLE_CERTS
NGINX_ENABLE_ABSOLUTE_REDIRECT
NGINX_ENABLE_PORT_IN_REDIRECT
NGINX_ENABLE_STREAM
)
for env_var in "${nginx_env_vars[@]}"; do
file_env_var="${env_var}_FILE"
Expand Down Expand Up @@ -78,5 +79,6 @@ export WEB_SERVER_HTTPS_PORT_NUMBER="$NGINX_HTTPS_PORT_NUMBER"
export NGINX_SKIP_SAMPLE_CERTS="${NGINX_SKIP_SAMPLE_CERTS:-false}"
export NGINX_ENABLE_ABSOLUTE_REDIRECT="${NGINX_ENABLE_ABSOLUTE_REDIRECT:-no}"
export NGINX_ENABLE_PORT_IN_REDIRECT="${NGINX_ENABLE_PORT_IN_REDIRECT:-no}"
export NGINX_ENABLE_STREAM="${NGINX_ENABLE_STREAM:-no}"

# Custom environment variables may be defined below
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# stream block
stream {
include "/opt/bitnami/nginx/conf/stream_server_blocks/*.conf";
}
1 change: 1 addition & 0 deletions bitnami/nginx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ Access your web server in the browser by navigating to `http://localhost:9000`.
### Adding custom server blocks

The default `nginx.conf` includes server blocks placed in `/opt/bitnami/nginx/conf/server_blocks/`. You can mount a `my_server_block.conf` file containing your custom server block at this location.
Also `/opt/bitnami/nginx/conf/stream_server_blocks/` available for stream server blocks which can be enabled via NGINX_ENABLE_STREAM.

For example, in order add a server block for `www.example.com`:

Expand Down

0 comments on commit 5ccffe8

Please sign in to comment.