HTTPS 免费证书申请及续期

160 阅读1分钟

安装ACME脚本,生成、续期证书

安装脚本:

curl https://get.acme.sh | sh -s email=my@example.com

国内的备用地址:

curl https://gitcode.net/cert/cn-acme.sh/-/raw/master/install.sh?inline=false | sh -s email=my@example.com

配置域名

访问: freessl.cn/acme-deploy

添加域名,进行授权配置

image.png

配置CNAME记录,并进行配置检测

脚本部署

acme.sh --issue -d www.abc.com  --dns dns_dp --server https://acme.freessl.cn/v2/DV90/directory/abc123

证书续期,增加--force参数

acme.sh --issue -d www.abc.com  --dns dns_dp --server https://acme.freessl.cn/v2/DV90/directory/abc123 --force

Nginx 配置 https

server {  
    listen 443 ssl;  
    server_name www.abc.com;  
    ssl_certificate /root/.acme.sh/www.abc.com_ecc/fullchain.cer;  
    ssl_certificate_key /root/.acme.sh/www.abc.com_ecc/cert.key;  
    location / {  
        root /usr/share/nginx/html;  
        index index.html;  
    }  
}