销售:050-1791-1110

SSL 证书申请

什么是 SSL 证书?

SSL 证书用于加密浏览器与服务器之间的通信,让你的网站地址从 http:// 变为 https://。这对安全性、SEO 和用户信任都至关重要。

证书类型

类型 验证级别 价格 适用场景
DV(域名验证) 域名所有权 免费~低价 个人网站、博客
OV(组织验证) 企业身份 中等 企业官网
EV(扩展验证) 严格审核 较高 金融、电商

使用 Certbot 申请免费证书

Let’s Encrypt 提供免费的 DV 证书,Certbot 是官方推荐的自动化工具。

安装 Certbot

sudo apt update
sudo apt install certbot python3-certbot-nginx

申请证书(Nginx)

# 自动配置 Nginx 并申请证书
sudo certbot --nginx -d example.com -d www.example.com

# 仅申请证书(手动配置)
sudo certbot certonly --nginx -d example.com

申请证书(独立模式)

# 需临时停止 Web 服务器
sudo certbot certonly --standalone -d example.com

自动续期

# 测试续期
sudo certbot renew --dry-run

# 查看自动续期定时器
sudo systemctl status certbot.timer

Certbot 安装后会自动设置定时任务(systemd timer 或 cron),在证书到期前自动续期。

通配符证书

# 需要 DNS 验证
sudo certbot certonly --manual --preferred-challenges dns -d "*.example.com" -d example.com

按提示在 DNS 添加 TXT 记录完成验证。

验证证书

# 查看证书信息
sudo certbot certificates

# 用 openssl 检查
openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | openssl x509 -noout -dates

常见问题

  • 申请失败? 确保域名已解析到服务器、80 端口可访问
  • 混合内容警告? 替换页面中所有 http://https://
  • 证书过期? 检查 certbot renew 和定时任务是否正常
滚动至顶部