存档说明:本文记录的是 2019 年 Ubuntu 与 Certbot 的使用方式。

下面是在 Ubuntu 18.04 上配置 Let’s Encrypt TLS 证书的历史步骤。前提是 Apache、LAMP 和 WordPress 已运行,且你拥有该域名的控制权。
add-apt-repository ppa: certbot/certbot
apt install python-certbot-apache
certbot —apache-d berndkuhlen.de-d www.berndkuhlen.de
certbot renew --dry-run
确认已有 Certbot 定时任务,负责续期证书。
我的定时任务如下:
0 0 * * * /usr/bin/certbot renew >/home/ubuntu/certbot.txt
2>/home/ubuntu/certbot.err
自动生成的配置如下:
renew_before_expiry = 30 days
version = 0.31.0
archive_dir = /etc/letsencrypt/archive/berndkuhlen.de
cert = /etc/letsencrypt/live/berndkuhlen.de/cert.pem
privkey = /etc/letsencrypt/live/berndkuhlen.de/privkey.pem
chain = /etc/letsencrypt/live/berndkuhlen.de/chain.pem
fullchain = /etc/letsencrypt/live/berndkuhlen.de/fullchain.pem
Options used in the renewal process
[renewalparams]
account = SOMEACCOUNTID
authenticator = apache
installer = apache
server = https://acme-v02.api.letsencrypt.org/directory
当时让我意外的是,Certbot 自动更新了 Apache 配置,启用了新证书,并让服务监听 443 端口。


云 / 系统