This commit is contained in:
neil 2016-07-20 22:18:07 +08:00
parent fa989a554d
commit c3dd3ef0d7
1 changed files with 10 additions and 10 deletions

20
acme.sh
View File

@ -1105,23 +1105,23 @@ _initpath() {
_apachePath() {
_APAHECTL="apachectl"
_APACHECTL="apachectl"
if ! _exists apachectl ; then
if _exists apache2ctl ; then
_APAHECTL="apache2ctl"
_APACHECTL="apache2ctl"
else
_err "'apachectl not found. It seems that apache is not installed, or you are not root user.'"
_err "Please use webroot mode to try again."
return 1
fi
fi
httpdconfname="$($_APAHECTL -V | grep SERVER_CONFIG_FILE= | cut -d = -f 2 | tr -d '"' )"
httpdconfname="$($_APACHECTL -V | grep SERVER_CONFIG_FILE= | cut -d = -f 2 | tr -d '"' )"
_debug httpdconfname "$httpdconfname"
if _startswith "$httpdconfname" '/' ; then
httpdconf="$httpdconfname"
httpdconfname="$(basename $httpdconfname)"
else
httpdroot="$($_APAHECTL -V | grep HTTPD_ROOT= | cut -d = -f 2 | tr -d '"' )"
httpdroot="$($_APACHECTL -V | grep HTTPD_ROOT= | cut -d = -f 2 | tr -d '"' )"
_debug httpdroot "$httpdroot"
httpdconf="$httpdroot/$httpdconfname"
httpdconfname="$(basename $httpdconfname)"
@ -1151,7 +1151,7 @@ _restoreApache() {
cat "$APACHE_CONF_BACKUP_DIR/$httpdconfname" > "$httpdconf"
_debug "Restored: $httpdconf."
if ! $_APAHECTL -t >/dev/null 2>&1 ; then
if ! $_APACHECTL -t >/dev/null 2>&1 ; then
_err "Sorry, restore apache config error, please contact me."
return 1;
fi
@ -1168,7 +1168,7 @@ _setApache() {
#test the conf first
_info "Checking if there is an error in the apache config file before starting."
_msg="$($_APAHECTL -t 2>&1 )"
_msg="$($_APACHECTL -t 2>&1 )"
if [ "$?" != "0" ] ; then
_err "Sorry, apache config file has error, please fix it first, then try again."
_err "Don't worry, there is nothing changed to your system."
@ -1191,7 +1191,7 @@ _setApache() {
#add alias
apacheVer="$($_APAHECTL -V | grep "Server version:" | cut -d : -f 2 | cut -d " " -f 2 | cut -d '/' -f 2 )"
apacheVer="$($_APACHECTL -V | grep "Server version:" | cut -d : -f 2 | cut -d " " -f 2 | cut -d '/' -f 2 )"
_debug "apacheVer" "$apacheVer"
apacheMajer="$(echo "$apacheVer" | cut -d . -f 1)"
apacheMinor="$(echo "$apacheVer" | cut -d . -f 2)"
@ -1215,7 +1215,7 @@ Allow from all
" >> "$httpdconf"
fi
_msg="$($_APAHECTL -t 2>&1 )"
_msg="$($_APACHECTL -t 2>&1 )"
if [ "$?" != "0" ] ; then
_err "Sorry, apache config error"
if _restoreApache ; then
@ -1231,8 +1231,8 @@ Allow from all
chmod 755 "$ACME_DIR"
fi
if ! $_APAHECTL graceful ; then
_err "Sorry, $_APAHECTL graceful error, please contact me."
if ! $_APACHECTL graceful ; then
_err "Sorry, $_APACHECTL graceful error, please contact me."
_restoreApache
return 1;
fi