diff --git a/base/utils.sh b/base/utils.sh index b5676bf..b7cf3ea 100755 --- a/base/utils.sh +++ b/base/utils.sh @@ -42,10 +42,16 @@ create_super_user() { set_nginx_port() { echo "setting nginx port" - # the nginx s6 service copies the file from /nginx/nginx.conf, which overwrites our changes, - # so we have to change the source file. - /usr/bin/sed -i s/listen\ 80/listen\ "${NGINX_PORT}"/g /nginx/nginx.conf - /usr/bin/sed -i s/listen\ 443/listen\ "${NGINX_SSL_PORT}"/g /nginx/ssl_nginx.conf + # the nginx s6 service templates/copies the file from /nginx/nginx.conf.j2;/nginx/nginx.conf, + # which overwrites our changes, so we have to change the source file. + if [[ -f /nginx/nginx.conf ]]; then + /usr/bin/sed -i s/listen\ 80/listen\ "${NGINX_PORT}"/g /nginx/nginx.conf + /usr/bin/sed -i s/listen\ 443/listen\ "${NGINX_SSL_PORT}"/g /nginx/ssl_nginx.conf + fi + if [[ -f /nginx/nginx.conf.j2 ]]; then + /usr/bin/sed -i s/listen\ 80/listen\ "${NGINX_PORT}"/g /nginx/nginx.conf.j2 + /usr/bin/sed -i s/listen\ 443/listen\ "${NGINX_SSL_PORT}"/g /nginx/nginx.conf.j2 + fi # this is the older command. Leaving this in for backwards compatibility for devs that haven't # updated their images.