申请Let’s Encrypt免费SSL证书教程

Let's Encrypt是一个免费的SSL证书颁发机构,官网是:https://letsencrypt.org/
 用它来做网站的https非常合适。
 证书有效期为3个月,快到3个月的时候再次用的命令申请即可。

以下列出Linux(Ubuntu)下申请的简单教程:

1、Git下载官方申请SSL证书客户端
 客户端Git地址https://github.com/certbot/certbot
 可以用命令也可以下载到本地再上传到VPS,方法任意
 默认Linux一般都安装了Git,如果没有,运行
   CentOS系列:yum install git
   Debian/Ubuntu系列:apt-get install git
 命令更新客户端,到客户端安装目录下执行:
   git clone https://github.com/certbot/certbot.git
 等待执行完成即可
 下次在没有修改内容的情况下,下次使用以下命令更新客户端:
   git pull

2、申请SSL证书
 参照https://github.com/certbot/certbot网站的提示操作
 新申请执行命令:
   ./certbot-auto certonly --standalone --email [email protected] 
      -d wt629.com -d www.wt629.com -d wp.wt629.com -d ...
 即将过期重新申请命令
   ./certbot-auto renew
 帮助
   ./certbot-auto --help
 把邮箱和域名信息修改为各自正确的域名即可
 成功申请后证书保存位置:/etc/letsencrypt/live/您的域名/

3、修改服务端Apache配置
 每个人的服务器配置方式都各不相同,
 以下仅供参考:

<VirtualHost *:443>
   ServerName wp.wt629.com
   ServerAdmin [email protected]
   DocumentRoot /home/root/web/wt629.com/public_html/wordpress
 
   SSLEngine on
   SSLCertificateFile "/etc/letsencrypt/live/wt629.com/cert.pem"
   SSLCertificateKeyFile "/etc/letsencrypt/live/wt629.com/privkey.pem"
 </VirtualHost>

最后记得重启apache:service apache2 restart

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据