diff --git a/bitnami/nginx/1.27/debian-12/rootfs/opt/bitnami/nginx/conf/nginx.conf b/bitnami/nginx/1.27/debian-12/rootfs/opt/bitnami/nginx/conf/nginx.conf index 8c35872faf87a..9833b1cfd0437 100644 --- a/bitnami/nginx/1.27/debian-12/rootfs/opt/bitnami/nginx/conf/nginx.conf +++ b/bitnami/nginx/1.27/debian-12/rootfs/opt/bitnami/nginx/conf/nginx.conf @@ -58,7 +58,3 @@ http { } } } - -stream { - include "/opt/bitnami/nginx/conf/stream_server_blocks/*.conf"; -} \ No newline at end of file diff --git a/bitnami/nginx/1.27/debian-12/rootfs/opt/bitnami/scripts/libnginx.sh b/bitnami/nginx/1.27/debian-12/rootfs/opt/bitnami/scripts/libnginx.sh index c36866212b9be..0643f38cffbce 100644 --- a/bitnami/nginx/1.27/debian-12/rootfs/opt/bitnami/scripts/libnginx.sh +++ b/bitnami/nginx/1.27/debian-12/rootfs/opt/bitnami/scripts/libnginx.sh @@ -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 } ######################## diff --git a/bitnami/nginx/1.27/debian-12/rootfs/opt/bitnami/scripts/nginx-env.sh b/bitnami/nginx/1.27/debian-12/rootfs/opt/bitnami/scripts/nginx-env.sh index cfed2e1a92ec4..0a02d51a104c4 100644 --- a/bitnami/nginx/1.27/debian-12/rootfs/opt/bitnami/scripts/nginx-env.sh +++ b/bitnami/nginx/1.27/debian-12/rootfs/opt/bitnami/scripts/nginx-env.sh @@ -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" @@ -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 diff --git a/bitnami/nginx/1.27/debian-12/rootfs/opt/bitnami/scripts/nginx/bitnami-templates/default-stream-block.conf b/bitnami/nginx/1.27/debian-12/rootfs/opt/bitnami/scripts/nginx/bitnami-templates/default-stream-block.conf new file mode 100644 index 0000000000000..02f84916bad82 --- /dev/null +++ b/bitnami/nginx/1.27/debian-12/rootfs/opt/bitnami/scripts/nginx/bitnami-templates/default-stream-block.conf @@ -0,0 +1,4 @@ +# stream block +stream { + include "/opt/bitnami/nginx/conf/stream_server_blocks/*.conf"; +} diff --git a/bitnami/nginx/README.md b/bitnami/nginx/README.md index 870ef13982592..c6607b28fae1f 100644 --- a/bitnami/nginx/README.md +++ b/bitnami/nginx/README.md @@ -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`: