diff --git a/docs/nginx.md b/docs/nginx.md index eabd1550c..6debc7ead 100644 --- a/docs/nginx.md +++ b/docs/nginx.md @@ -16,8 +16,7 @@ nginx:error-logs [-t] Show the nginx error logs for a Dokku currently templates out an nginx configuration that is included in the `nginx-vhosts` plugin. If you'd like to provide a custom template for your application, there are a few options: -- Copy the existing template - ssl or non-ssl - into your application repository's root directory as the file `nginx.conf.template`. -- Create a template file in `/home/dokku/APP` named one of the following: +- Copy the existing pertinent (ssl or non-ssl) template found (by default) in `/var/lib/dokku/plugins/available/nginx-vhosts/templates`, place it either in `/home/dokku/APP` or check it into your app repo, and name it one of the following: - `nginx.conf.template` (since 0.3.10) - `nginx.conf.ssl_terminated.template` (since 0.4.0) - `nginx.ssl.conf.template` (since 0.4.2) diff --git a/plugins/nginx-vhosts/functions b/plugins/nginx-vhosts/functions index 8d94ca4b8..7df8d2dc9 100755 --- a/plugins/nginx-vhosts/functions +++ b/plugins/nginx-vhosts/functions @@ -157,7 +157,9 @@ nginx_build_config() { fi DOKKU_APP_CIDS=($(get_app_container_ids $APP)) - docker cp "${DOKKU_APP_CIDS[0]}:/app/nginx.conf.template" "$DOKKU_ROOT/$APP/" 2> /dev/null || true + for file in nginx.conf.template nginx.ssl.conf.template; do + docker cp "${DOKKU_APP_CIDS[0]}:/app/${file}" "$DOKKU_ROOT/$APP/" 2> /dev/null || true + done [[ -f "$APP_NGINX_TEMPLATE" ]] && NGINX_TEMPLATE="$APP_NGINX_TEMPLATE" && NGINX_CUSTOM_TEMPLATE="true" && dokku_log_info1 'Overriding default nginx.conf with detected nginx.conf.template' @@ -235,7 +237,7 @@ EOF while read -r line; do [[ -z "$line" ]] && continue - dokku_log_info1 "Configuring SSL for $line..." + dokku_log_info1 "Configuring SSL for $line...(using $NGINX_SSL_TEMPLATE)" SSL_SERVER_NAME=$line NOSSL_SERVER_NAME=$line eval "cat <<< \"$(< $NGINX_SSL_TEMPLATE)\" >> $NGINX_CONF" @@ -250,7 +252,7 @@ EOF if [[ -n "$NONSSL_VHOSTS" ]]; then NOSSL_SERVER_NAME=$(echo $NONSSL_VHOSTS | tr '\n' ' ') - xargs -i echo "-----> Configuring {}..." <<< "$NONSSL_VHOSTS" + xargs -i echo "-----> Configuring {}...(using $NGINX_TEMPLATE)" <<< "$NONSSL_VHOSTS" eval "cat <<< \"$(< $NGINX_TEMPLATE)\" >> $NGINX_CONF" fi if [[ "$(is_app_vhost_enabled $APP)" == "false" ]] || ([[ -z "$NONSSL_VHOSTS" ]] && [[ -z "$SSL_VHOSTS" ]]); then