mirror of
https://github.com/10h30/ols-docker-env.git
synced 2026-05-12 15:21:24 +09:00
scripts update
This commit is contained in:
+33
-7
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
DOMAIN=''
|
||||
TYPE=0
|
||||
|
||||
help_message(){
|
||||
echo 'Command [your_domain]'
|
||||
@@ -13,22 +14,49 @@ check_input(){
|
||||
fi
|
||||
}
|
||||
|
||||
strip_www(){
|
||||
www_domain(){
|
||||
CHECK_WWW=$(echo ${1} | cut -c1-4)
|
||||
if [[ ${CHECK_WWW} == www. ]] ; then
|
||||
DOMAIN=$(echo ${1} | cut -c 5-)
|
||||
else
|
||||
DOMAIN=${1}
|
||||
fi
|
||||
WWW_DOMAIN="www.${DOMAIN}"
|
||||
}
|
||||
|
||||
domain_verify(){
|
||||
curl -Is http://${DOMAIN}/ | grep -i LiteSpeed > /dev/null 2>&1
|
||||
if [ ${?} = 0 ]; then
|
||||
echo "[OK] ${DOMAIN} is accessible."
|
||||
TYPE=1
|
||||
curl -Is http://${WWW_DOMAIN}/ | grep -i LiteSpeed > /dev/null 2>&1
|
||||
if [ ${?} = 0 ]; then
|
||||
echo "[OK] ${WWW_DOMAIN} is accessible."
|
||||
TYPE=2
|
||||
else
|
||||
echo "${WWW_DOMAIN} is inaccessible."
|
||||
fi
|
||||
else
|
||||
echo "${MY_DOMAIN} is inaccessible, please verify."; exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
lecertapply(){
|
||||
docker-compose exec litespeed su -c "certbot certonly --agree-tos --register-unsafely-without-email \
|
||||
--non-interactive --webroot -w /var/www/vhosts/${1}/html -d ${1} -d www.${1}"
|
||||
if [ ${TYPE} = 1 ]; then
|
||||
docker-compose exec litespeed su -c "certbot certonly --agree-tos --register-unsafely-without-email \
|
||||
--non-interactive --webroot -w /var/www/vhosts/${1}/html -d ${1}"
|
||||
elif [ ${TYPE} = 2 ]; then
|
||||
docker-compose exec litespeed su -c "certbot certonly --agree-tos --register-unsafely-without-email \
|
||||
--non-interactive --webroot -w /var/www/vhosts/${1}/html -d ${1} -d www.${1}"
|
||||
else
|
||||
echo 'unknown Type!'
|
||||
exit 2
|
||||
fi
|
||||
}
|
||||
|
||||
main(){
|
||||
strip_www ${1}
|
||||
www_domain ${1}
|
||||
domain_verify
|
||||
lecertapply ${DOMAIN}
|
||||
}
|
||||
|
||||
@@ -43,6 +71,4 @@ while [ ! -z "${1}" ]; do
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
|
||||
done
|
||||
Reference in New Issue
Block a user