1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| Step 1️⃣ 安装 Certbot(CentOS / Rocky / Alma) sudo yum install -y epel-release sudo yum install -y certbot python3-certbot-nginx
Step 2️⃣ 一条命令申请 HTTPS(⭐ 核心) sudo certbot --nginx -d example.com -d www.example.com
Step 3️⃣ 立刻生效(不用重启)
Certbot 会自动:
申请证书
配置 Nginx
打开 443
加 SSL 配置
现在直接访问:
https://example.com
🔒 浏览器出现小锁 = 成功
如果是自己解压安装的nginx,建立软连接,指向安装目录, sudo ln -s /usr/local/nginx/sbin/nginx /usr/sbin/nginx sudo certbot --nginx --nginx-server-root /usr/local/nginx/conf -d codehelps.online -d www.codehelps.online
|