@@ -12,6 +12,12 @@ export PHP_PORT="${PHP_PORT:-9000}"
12
12
export NGINX_PHP_READ_TIMEOUT=" ${NGINX_PHP_READ_TIMEOUT:- 900} "
13
13
export NGINX_CATCHALL_RETURN_CODE=" ${NGINX_CATCHALL_RETURN_CODE:- 444} "
14
14
15
+ export NGINX_ACCESS_LOG_FORMAT=" ${NGINX_ACCESS_LOG_FORMAT:- main} "
16
+ # If the environment is not local, we enable structured logging.
17
+ if [ " ${ENV:- } " != " loc" ]; then
18
+ export NGINX_ACCESS_LOG_FORMAT=" structured"
19
+ fi
20
+
15
21
# If you use the rootless image the user directive is not needed
16
22
if [ " $( id -u) " -ne 0 ]; then
17
23
sed -i ' /^user /d' /etc/nginx/nginx.conf
@@ -107,10 +113,9 @@ if [ "${NGINX_DEFAULT_SERVER_NAME}" = "_" ]; then
107
113
else
108
114
export DEFAULT_SERVER=" "
109
115
# shellcheck disable=SC2016 # The envsubst command needs to be executed without variable expansion
110
- envsubst ' ${PHP_HOST} ${PHP_PORT} ${NGINX_DEFAULT_SERVER_PORT} ${NGINX_DEFAULT_SERVER_NAME} ${NGINX_DEFAULT_ROOT} ${NGINX_SUBFOLDER} ${NGINX_SUBFOLDER_ESCAPED} ${NGINX_CATCHALL_RETURN_CODE} ${NGINX_HSTS_HEADER}' < /templates/catch-all-server.conf > /etc/nginx/conf.d/catch-all-server.conf
116
+ envsubst ' ${PHP_HOST} ${PHP_PORT} ${NGINX_ACCESS_LOG_FORMAT} ${ NGINX_DEFAULT_SERVER_PORT} ${NGINX_DEFAULT_SERVER_NAME} ${NGINX_DEFAULT_ROOT} ${NGINX_SUBFOLDER} ${NGINX_SUBFOLDER_ESCAPED} ${NGINX_CATCHALL_RETURN_CODE} ${NGINX_HSTS_HEADER}' < /templates/catch-all-server.conf > /etc/nginx/conf.d/catch-all-server.conf
111
117
fi
112
118
113
- export NGINX_ACCESS_LOG_FORMAT=" ${NGINX_ACCESS_LOG_FORMAT:- main} "
114
119
export NGINX_DEFAULT_ROOT=" ${NGINX_DEFAULT_ROOT:-/ var/ www/ html} "
115
120
export NGINX_HTTPSREDIRECT=" ${NGINX_HTTPSREDIRECT:- 0} "
116
121
export NGINX_SUBFOLDER=" ${NGINX_SUBFOLDER:- 0} "
@@ -142,11 +147,6 @@ if [ "${NGINX_OSB_RESOLVER_ENFORCE_IPV6_OFF}" = "1" ] && ! echo "${NGINX_OSB_RES
142
147
export NGINX_OSB_RESOLVER=" ${NGINX_OSB_RESOLVER} ipv6=off"
143
148
fi
144
149
145
- # If the environment is not local, we enable structured logging.
146
- if [ " ${ENV:- } " != " loc" ]; then
147
- export NGINX_ACCESS_LOG_FORMAT=" structured"
148
- fi
149
-
150
150
# These lines of code have been added to provide a BC path for those
151
151
# environments that still have the NGINX_OSB_BUCKET variable filled with the
152
152
# old format that consist in having the value of NGINX_OSB_PUBLIC_PATH (usually
@@ -239,7 +239,7 @@ envsubst '${PHP_HOST} ${PHP_PORT} ${NGINX_ACCESS_LOG_FORMAT} ${NGINX_DEFAULT_SER
239
239
240
240
if [ " ${NGINX_SUBFOLDER} " != 0 ]; then
241
241
# shellcheck disable=SC2016 # The envsubst command needs to be executed without variable expansion
242
- envsubst ' ${PHP_HOST} ${PHP_PORT} ${NGINX_DEFAULT_SERVER_PORT} ${NGINX_DEFAULT_SERVER_NAME} ${NGINX_DEFAULT_ROOT} ${NGINX_SUBFOLDER} ${NGINX_SUBFOLDER_ESCAPED} ${NGINX_XFRAME_OPTION_VALUE} ${NGINX_HSTS_HEADER}' < /templates/subfolder.conf > /etc/nginx/conf.d/default.conf
242
+ envsubst ' ${PHP_HOST} ${PHP_PORT} ${NGINX_ACCESS_LOG_FORMAT} ${ NGINX_DEFAULT_SERVER_PORT} ${NGINX_DEFAULT_SERVER_NAME} ${NGINX_DEFAULT_ROOT} ${NGINX_SUBFOLDER} ${NGINX_SUBFOLDER_ESCAPED} ${NGINX_XFRAME_OPTION_VALUE} ${NGINX_HSTS_HEADER}' < /templates/subfolder.conf > /etc/nginx/conf.d/default.conf
243
243
fi
244
244
245
245
# Handle robots.txt and sitemap directive
@@ -344,7 +344,7 @@ if [ "${NGINX_REDIRECT_FROM_TO_WWW}" -eq 1 ] && [ "${NGINX_DEFAULT_SERVER_NAME}"
344
344
print " /etc/nginx/conf.d/from-to-www.conf - Creating a redirect from ${DOMAIN_FROM} to ${DOMAIN_TO} "
345
345
# shellcheck disable=SC2016 # The envsubst command needs to be executed without variable expansion
346
346
DOMAIN_FROM=${DOMAIN_FROM} DOMAIN_TO=${DOMAIN_TO} \
347
- envsubst ' ${DOMAIN_FROM} ${DOMAIN_TO} ${NGINX_DEFAULT_SERVER_PORT} ${DEFAULT_SERVER} ${NGINX_HSTS_HEADER}' < /templates/from-to-www.conf.tpl \
347
+ envsubst ' ${DOMAIN_FROM} ${DOMAIN_TO} ${NGINX_DEFAULT_SERVER_PORT} ${DEFAULT_SERVER} ${NGINX_ACCESS_LOG_FORMAT} ${ NGINX_HSTS_HEADER}' < /templates/from-to-www.conf.tpl \
348
348
| tee -a /etc/nginx/conf.d/from-to-www.conf > /dev/null
349
349
else
350
350
print " /etc/nginx/conf.d/from-to-www.conf - Skipping redirect from ${DOMAIN_FROM} to ${DOMAIN_TO} because it already exists"
0 commit comments