申请证书的各种方式
注意
申请证书的前提是购买了域名,且映射到了自己的 IP 地址。
可以在各大平台自行申请,如 DigiCert、GlobalSign、Sectigo、Let's Encrypt 等,这里不再过多介绍。
注意
一些国家需要实名注册,一些国家则不需要,建议选择不需要实名的国家域名
官网地址: https://letsencrypt.org/
可以通过 Let’s Encrypt 官方网站获取免费证书,但通常推荐使用自动化工具进行申请。
Certbot 是 Let’s Encrypt 官方推荐的客户端,可用于自动化获取和更新 SSL 证书。
官网使用教程: https://certbot.eff.org/
在 Linux 服务器上,通常可以使用以下命令安装 certbot:
shsudo apt update && sudo apt install certbot -y
如果使用 Nginx 或 Apache,可以安装对应的插件:
shsudo apt install python3-certbot-nginx -y # 适用于 Nginx
sudo apt install python3-certbot-apache -y # 适用于 Apache
以 Nginx 为例,申请证书的命令如下:
shsudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
Certbot 安装后会默认创建自动续期任务,也可以手动测试续期:
shsudo certbot renew --dry-run
Acme.sh 是另一个广泛使用的 ACME 客户端,支持 Let’s Encrypt 及其他 CA。
官网地址: https://github.com/acmesh-official/acme.sh
shcurl https://get.acme.sh | sh
或者使用 Git 方式安装:
shgit clone https://github.com/acmesh-official/acme.sh.git
cd acme.sh
./acme.sh --install
以 HTTP 验证方式申请证书:
shacme.sh --issue -d yourdomain.com --webroot /var/www/html
安装证书到 Nginx:
shacme.sh --install-cert -d yourdomain.com \
--key-file /etc/nginx/ssl/yourdomain.key \
--fullchain-file /etc/nginx/ssl/yourdomain.pem \
--reloadcmd "systemctl reload nginx"
Cloudflare 也提供免费 SSL 证书,可以通过 Cloudflare 的“加密”选项来启用。
官网地址: https://www.cloudflare.com/
官网地址: https://freessl.cn/
FreeSSL 提供免费 HTTPS 证书申请,同一个域名最多支持申请 20 个证书。
注
如果有任何错误或需要改进,欢迎留言指正。
资料引用 由于特殊原因,部分资料不便展示,敬请谅解。