本文使用比较方便的文件验证方式,需要nginx 配置了servername 或者其他方式,端口需要开放全球80,会在默认网页路径生成txt文件,校验网址的url,例http://baidu.com/ssl/qwertyy
git clone https://github.com/acmesh-official/acme.sh.git
cd ./acme.sh
./acme.sh --install
# 或者
curl https://get.acme.sh | sh
# 或者
wget -O - https://get.acme.sh | sh
server {
listen 80;
server_name baidu.com;
root /usr/local/nginx/html;
location / {
return 404;
}
location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
}
location = /.well-known/acme-challenge/ {
return 404;
}
#!/bin/bash
# 脚本可命名为 update_ssl.sh
if [ -z "$1" ];then
exit
fi
# acme.sh 可能需要配置绝对路径
acme.sh --issue -d $1 -d www.$1 -w /usr/local/nginx/html
sed "s/demo.com/$1/g" /usr/local/nginx/conf/conf.d/demo.com.conf.b > /usr/local/nginx/conf/conf.d/$1.conf
/usr/local/nginx/sbin/nginx -t && /usr/local/nginx/sbin/nginx -s reload
for i in `cat domain.txt`
do
update_ssl.sh $i
done
原文:https://www.cnblogs.com/oam-zhanjiang/p/14116823.html