mirror of
https://github.com/plantroon/acme.sh.git
synced 2024-12-22 13:11:41 +00:00
fix compatible: apache before 2.4 and after 2.4
This commit is contained in:
parent
615cb36029
commit
b09d597c84
18
le.sh
18
le.sh
@ -783,6 +783,13 @@ _setApache() {
|
||||
_info "The backup file will be deleted on sucess, just forget it."
|
||||
|
||||
#add alias
|
||||
|
||||
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)"
|
||||
|
||||
if [[ "$apacheVer" ]] && [[ "$apacheMajer" -ge "2" ]] && [[ "$apacheMinor" -ge "4" ]] ; then
|
||||
echo "
|
||||
Alias /.well-known/acme-challenge $ACME_DIR
|
||||
|
||||
@ -790,6 +797,17 @@ Alias /.well-known/acme-challenge $ACME_DIR
|
||||
Require all granted
|
||||
</Directory>
|
||||
" >> $httpdconf
|
||||
else
|
||||
echo "
|
||||
Alias /.well-known/acme-challenge $ACME_DIR
|
||||
|
||||
<Directory $ACME_DIR >
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</Directory>
|
||||
" >> $httpdconf
|
||||
fi
|
||||
|
||||
|
||||
if ! apachectl -t ; then
|
||||
_err "Sorry, apache config error, please contact me."
|
||||
|
Loading…
Reference in New Issue
Block a user