1. 安装 Certbot
首先,您需要在您的服务器上安装 Certbot。这个过程依赖于您的操作系统。在 Ubuntu 上,您可以使用以下命令:
sudo apt update
sudo apt install certbot
2. 为多个子域名申请证书
Certbot 支持多种方式来验证您的域名所有权,包括通过 HTTP、DNS 等。如果您使用的是 Nginx 或 Apache,Certbot 甚至可以自动配置您的服务器。
一种常用的方式是使用 webroot 插件。下面的命令会为主域名 deephacking.pro 和其子域名生成一个证书:
sudo certbot certonly --webroot -w /var/www/html -d deephacking.pro -d www.deephacking.pro -d ipcc.deephacking.pro -d chat.deephacking.pro -d gpt.deephacking.pro
这里,/var/www/html 是您网站的 web root 目录。Certbot 将在这个目录下创建一个临时文件,以完成 HTTP 验证。
3.renew证书
certbot renew