From c49f81cd8b656ce9ef0d904df82a5256b715629a Mon Sep 17 00:00:00 2001 From: Manuel Colmenero Date: Mon, 18 Sep 2017 21:19:30 +0200 Subject: [PATCH] fix: Check first in $PATH for nginx, use sbin location as backup --- plugins/nginx-vhosts/functions | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/nginx-vhosts/functions b/plugins/nginx-vhosts/functions index 70cd0588e..dc4195df2 100755 --- a/plugins/nginx-vhosts/functions +++ b/plugins/nginx-vhosts/functions @@ -8,10 +8,14 @@ source "$PLUGIN_AVAILABLE_PATH/ps/functions" get_nginx_location() { declare desc="check that nginx is at the expected location and return it" - local NGINX_LOCATION="/usr/sbin/nginx" - if ! [[ -x "$NGINX_LOCATION" ]]; then - dokku_log_fail "Could not find nginx binary at ${NGINX_LOCATION}." - exit 1; + local NGINX_LOCATION=$(which nginx 2>/dev/null) + + if [[ -z "$NGINX_LOCATION" ]]; then + NGINX_LOCATION="/usr/sbin/nginx" + if ! [[ -x "$NGINX_LOCATION" ]]; then + dokku_log_fail "Could not find nginx binary in \$PATH or at '${NGINX_LOCATION}'." + exit 1; + fi fi echo "$NGINX_LOCATION" }