一、安装
首先在https://github.com/Neilpang/acme.sh/releases中下载最新版本, tar zxvf 解压然后进入目录。
运行命令安装acme.sh
./acme.sh --install \
--home /usr/local/acme.sh \
--config-home /etc/acme.sh \
--cert-home /etc/acme.sh/certs/ \
--accountemail "mail@example.com"
安装完成后可见如下输出
[2019年 05月 27日 星期一 11:48:36 BST] It is recommended to install socat first. [2019年 05月 27日 星期一 11:48:36 BST] We use socat for standalone server if you use standalone mode. [2019年 05月 27日 星期一 11:48:36 BST] If you don't use standalone mode, just ignore this warning. [2019年 05月 27日 星期一 11:48:36 BST] Installing to /usr/local/acme.sh [2019年 05月 27日 星期一 11:48:36 BST] Installed to /usr/local/acme.sh/acme.sh [2019年 05月 27日 星期一 11:48:36 BST] Installing alias to '/root/.bashrc' [2019年 05月 27日 星期一 11:48:36 BST] OK, Close and reopen your terminal to start using acme.sh [2019年 05月 27日 星期一 11:48:36 BST] Installing cron job [2019年 05月 27日 星期一 11:48:36 BST] Good, bash is found, so change the shebang to use bash as preferred. [2019年 05月 27日 星期一 11:48:36 BST] OK
运行source /root/.bashrc免终端重启使alias生效
二、配置DNSAPI
以下为使用CloudXNS时环境变量名称,更多DNS解析商支持详见https://github.com/Neilpang/acme.sh/wiki/dnsapi
export CX_Key="1234" export CX_Secret="abcdefg"
替换上方Key与Secret为自己所使用的,然后运行
三、申请证书
运行acme.sh --issue -d shenqhy.com -d *.shenqhy.com --dns dns_cx自动使用DNSAPI验证方式申请证书
申请成功后,最后4行输出证书和私钥保存路径,即上方安装时指定的路径;
同时DNSAPI的Key与Secret将自动保存与安装目录下的account.conf中;
并且自动添加crontab任务自动更新证书
四、OpenLiteSpeed部署证书
注意:无论OpenLiteSpeed是否有多个HTTPS站点,443端口监听器中SSL选项必须配置1个域名的证书,否则SNI无法正常使用。
于虚拟机SSL选项中,修改SSL私钥和证书五项。
前两项为私钥于证书路径,证书路径填入fullchain.cer路径,
链式证书勾选是
CA证书路径填入fullchain.cer路径
CA证书文件同fullchain.cer路径
平滑重启即完成配置
参考:https://i.congm.in/ssl/