acme.sh脚本安装免费SSL

acme.sh脚本可以快速安装Let's Encrypt免费SSL
具体教程请访问官方: https://github.com/Neilpang/acme.sh

这里记录一下我个人的SSL安装[使用ECC加密方式]

1 安装acme.sh

wget -O -  https://get.acme.sh | sh -s [email protected]

2 颁发证书

#默认RSA证书
sh /root/.acme.sh/acme.sh  --issue  -w  /path/to/livelu.com/wwwroot/ -d livelu.com -d www.livelu.com  
#ECC证书
sh /root/.acme.sh/acme.sh  --issue  -w  /path/to/livelu.com/wwwroot/ -d livelu.com -d www.livelu.com   --keylength ec-256

3 安装证书到指定位置
apache

#RSA证书安装
sh acme.sh --install-cert -d livelu.com -d www.livelu.com  \
--cert-file   /etc/httpd/conf/ssl.crt/server.crt  \
--key-file   /etc/httpd/conf/ssl.key/server.key  \
--fullchain-file  /path/to/domains/livelu.com.cacert \
--reloadcmd     "service httpd force-reload"
#ECC证书安装
sh acme.sh --install-cert -d livelu.com -d www.livelu.com --ecc \
--cert-file   /etc/httpd/conf/ssl.crt/server.crt  \
--key-file   /etc/httpd/conf/ssl.key/server.key  \
--fullchain-file  /path/to/domains/livelu.com.cacert \
--reloadcmd     "service httpd force-reload"

nginx需要直接添加证书链
#RSA证书安装
sh acme.sh --install-cert -d livelu.com -d www.livelu.com \
--key-file    /path/to/domains/livelu.com.key  \
--fullchain-file  /path/to/domains/livelu.com.pem \
--reloadcmd     "service nginx force-reload"
#ECC证书安装
sh acme.sh --install-cert -d livelu.com -d www.livelu.com --ecc \
--key-file    /path/to/domains/livelu.com.key  \
--fullchain-file  /path/to/domains/livelu.com.pem \
--reloadcmd     "service nginx force-reload"

4 定时续期
由于acme.sh在后台自动每隔60天续期证书,这步省略
想要强制续期的,请访问官方wiki查看教程

个人安装SSL的脚本

#!/usr/bin/sh
cat /root/.acme.sh/livelu.com_ecc/livelu.com.cer > /etc/httpd/conf/ssl.crt/server.crt
cat  /root/.acme.sh/livelu.com_ecc/livelu.com.key > /etc/httpd/conf/ssl.key/server.key
service httpd reload

0 0 1 * * sh /root/.acme.sh/livelu.com_ecc/livelu_renew.sh

附加证书链地址: https://letsencrypt.org/certificates/

此处评论已关闭