From 5be1449db5a2870cae7eeea0b5cf78a4694b1459 Mon Sep 17 00:00:00 2001 From: neilpang Date: Sun, 6 Nov 2016 23:26:38 +0800 Subject: [PATCH] add APACHE_HTTPD_CONF https://github.com/Neilpang/acme.sh/issues/363 --- acme.sh | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/acme.sh b/acme.sh index 1bea19d9..b07b1dcd 100755 --- a/acme.sh +++ b/acme.sh @@ -1808,22 +1808,28 @@ _apachePath() { return 1 fi - httpdconfname="$($_APACHECTL -V | grep SERVER_CONFIG_FILE= | cut -d = -f 2 | tr -d '"' )" - _debug httpdconfname "$httpdconfname" - - if [ -z "$httpdconfname" ] ; then - _err "Can not read apache config file." - return 1 - fi - - if _startswith "$httpdconfname" '/' ; then - httpdconf="$httpdconfname" + if [ "$APACHE_HTTPD_CONF" ] ; then + _saveaccountconf APACHE_HTTPD_CONF "$APACHE_HTTPD_CONF" + httpdconf="$APACHE_HTTPD_CONF" httpdconfname="$(basename $httpdconfname)" else - httpdroot="$($_APACHECTL -V | grep HTTPD_ROOT= | cut -d = -f 2 | tr -d '"' )" - _debug httpdroot "$httpdroot" - httpdconf="$httpdroot/$httpdconfname" - httpdconfname="$(basename $httpdconfname)" + httpdconfname="$($_APACHECTL -V | grep SERVER_CONFIG_FILE= | cut -d = -f 2 | tr -d '"' )" + _debug httpdconfname "$httpdconfname" + + if [ -z "$httpdconfname" ] ; then + _err "Can not read apache config file." + return 1 + fi + + if _startswith "$httpdconfname" '/' ; then + httpdconf="$httpdconfname" + httpdconfname="$(basename $httpdconfname)" + else + httpdroot="$($_APACHECTL -V | grep HTTPD_ROOT= | cut -d = -f 2 | tr -d '"' )" + _debug httpdroot "$httpdroot" + httpdconf="$httpdroot/$httpdconfname" + httpdconfname="$(basename $httpdconfname)" + fi fi _debug httpdconf "$httpdconf" _debug httpdconfname "$httpdconfname"