用 Certbot 申请免费 TLS 证书

为域名申请并自动续期 Let's Encrypt 证书。

Linux证书TLS加密中风险
运行 sudo certbot certonly --standalone -d example.com 申请证书。

01命令

命令
$ sudo certbot certonly --standalone -d example.com

02作用说明

Certbot 通过 standalone(临时起一个 Web 服务)或 --nginx/--apache 验证域名控制权,把证书保存在 /etc/letsencrypt 并安装续期定时任务。证书有效期 90 天,会自动续期。

03风险

风险中风险
使用条件sudo apt install certbot
!注意: standalone 模式需要 80 端口可达,并会临时停用占用该端口的已有 Web 服务。

04撤销

✓无需撤销——该命令不会改变持久状态。

05来源

  • Certbot
    Official project · vendor-doc · 2026-09-20
    依据: Debian packages Certbot, the EFF client for Let's Encrypt certificates.
  • Debian package: certbot
    Debian · vendor-doc · 2026-09-20
    依据: Debian packages Certbot, the EFF client for Let's Encrypt certificates.

最后验证: 2026-09-22 · 分类: 安全与隐私