adds run-nginx.sh script

This commit is contained in:
Sameer Naik
2017-03-09 17:00:11 +05:30
parent 3c890a555b
commit 69aa96b472
3 changed files with 16 additions and 12 deletions

View File

@@ -25,4 +25,4 @@ EXPOSE 80 443
ENTRYPOINT ["/app-entrypoint.sh"]
CMD ["/opt/bitnami/nginx/sbin/nginx"]
CMD ["/run-nginx.sh"]

View File

@@ -5,18 +5,8 @@
print_welcome_page
check_for_updates &
if [[ "$1" == "nami" && "$2" == "start" ]] || [[ "$(basename $1)" == "nginx" ]] || [[ "$1" == "/init.sh" ]]; then
if [[ "$1" == "nami" && "$2" == "start" ]] || [[ "$1" == "/run-nginx.sh" ]]; then
nami_initialize nginx
# redirect nginx logs to stdout/stderr
ln -sf /dev/stdout /opt/bitnami/nginx/logs/access.log
ln -sf /dev/stderr /opt/bitnami/nginx/logs/error.log
# ensure nginx is not daemonized
if [[ "$(basename $1)" == "nginx" ]]; then
set -- "$@" -g 'daemon off;'
fi
chown -R :daemon /bitnami/nginx || true
fi

View File

@@ -0,0 +1,14 @@
#!/bin/bash
. /opt/bitnami/base/functions
. /opt/bitnami/base/helpers
DAEMON=nginx
EXEC=$(which $DAEMON)
ARGS=
# redirect nginx logs to stdout/stderr
ln -sf /dev/stdout /opt/bitnami/nginx/logs/access.log
ln -sf /dev/stderr /opt/bitnami/nginx/logs/error.log
info "Starting ${DAEMON}..."
exec ${EXEC} ${ARGS} -g 'daemon off;'