diff --git a/plugins/nginx-vhosts/functions b/plugins/nginx-vhosts/functions index 1382c92f1..5dfeecac4 100755 --- a/plugins/nginx-vhosts/functions +++ b/plugins/nginx-vhosts/functions @@ -68,6 +68,10 @@ nginx_build_config() { dokku_log_info1 "VHOST support disabled, deleting $APP/VHOST" rm "$DOKKU_ROOT/$APP/VHOST" fi + if [[ -f "$DOKKU_ROOT/$APP/URLS" ]]; then + dokku_log_info1 "VHOST support disabled, deleting $APP/URLS" + rm "$DOKKU_ROOT/$APP/URLS" + fi fi if [[ -z "$DOKKU_NGINX_PORT" ]]; then @@ -155,7 +159,9 @@ EOF xargs -i echo "-----> Configuring {}..." <<< "$NONSSL_VHOSTS" fi eval "cat <<< \"$(< $NGINX_TEMPLATE)\" >> $NGINX_CONF" - [[ -n "$NO_VHOST" ]] && sed --in-place -n -e '/^.*server_name.*$/!p' $NGINX_CONF + if [[ -n "$NO_VHOST" ]] || [[ -z "$NONSSL_VHOSTS" ]];then + sed --in-place -n -e '/^.*server_name.*$/!p' $NGINX_CONF + fi if [[ -n "$DOKKU_APP_LISTEN_PORT" ]] && [[ -n "$DOKKU_APP_LISTEN_IP" ]]; then echo "upstream $APP { server $DOKKU_APP_LISTEN_IP:$DOKKU_APP_LISTEN_PORT; }" >> $NGINX_CONF @@ -178,7 +184,7 @@ EOF validate_nginx && restart_nginx fi - if [[ -z "$NO_VHOST" ]]; then + if [[ ! -n "$NO_VHOST" ]] && [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then echo "# THIS FILE IS GENERATED BY DOKKU - DO NOT EDIT, YOUR CHANGES WILL BE OVERWRITTEN" > $URLS_PATH xargs -i echo "https://{}" <<< "${SSL_VHOSTS}" >> $URLS_PATH xargs -i echo "http://{}" <<< "${NONSSL_VHOSTS}" >> $URLS_PATH