Let's Encrypt 安装配置教程,免费的 SSL 证书
安装Let's Encrypt
安装非常简单直接克隆就可以了
git clone https://github.com/letsencrypt/letsencrypt
生成通配符证书
期间需要根据提示设置DNS TXT记录,用作你对判断你是否拥有域名使用权
cd letsencrypt
./certbot-auto certonly -d *.you.cn --manual --preferred-challenges dns --server https://acme-v02.api.letsencrypt.org/directory
其中"you.cn"换成你的一级域名即可
| 参数 | 说明 |
|---|---|
| certonly | 表示安装模式,Certbot 有安装模式和验证模式两种类型的插件。 |
| --manual | 表示手动安装插件,Certbot 有很多插件,不同的插件都可以申请证书,用户可以根据需要自行选择 |
| -d | 为那些主机申请证书,如果是通配符,输入 *.you.cn(可以替换为你自己的一级域名) |
| --preferred-challenges dns | 使用 DNS 方式校验域名所有权 |
| --server | Let's Encrypt ACME v2 版本使用的服务器不同于 v1 版本,需要显示指定。 |
接着可以看到下面界面结果:
Dependency Installed:
dwz.x86_64 :0.11-.el7 perl-srpm-macros.noarch :-.el7 tcl.x86_64 :8.5.-.el7 tix.x86_64 :8.4.-.el7 tk.x86_64 :8.5.-.el7 tkinter.x86_64 :2.7.-.el7_5 Complete!
Creating virtual environment...
Installing Python packages...
Installation succeeded.
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator manual, Installer None
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): @.com
接下来需要输入些指令
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: N
Obtaining a new certificate
Performing the following challenges:
dns- challenge for kuaichuangkeji.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NOTE: The IP of this machine will be publicly logged as having requested this
certificate. If you're running certbot in manual mode on a machine that is not
your server, please ensure you're okay with that. Are you OK with your IP being logged?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
这里有几个需交互的提示
- 是否同意 Let's Encrypt 协议要求=>需要同意
- 是否分享你的邮箱
- 询问是否对域名和机器(IP)进行绑定=>需要同意
需要注意的地方:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please deploy a DNS TXT record under the name
_acme-challenge.you.cn with the following value: RYtObhDvEcXewZckknNQkBKIkvwIlbb4PNRel74LNwU Before continuing, verify the record is deployed.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Press Enter to Continue
Waiting for verification...
Cleaning up challenges
要求配置 DNS TXT 记录,从而校验域名所有权,也就是判断证书申请者是否有域名的所有权。
上面输出要求给 _acme-challenge.you.cn 配置一条 TXT 记录,在没有确认 TXT 记录生效之前不要回车执行。
我用的是阿里云的域名服务器,控制台具体操作如下图所示:

确认生效后,回车执行,输出如下
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/you.cn/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/you.cn/privkey.pem
Your cert will expire on --. To obtain a new or tweaked
version of this certificate in the future, simply run certbot-auto
again. To non-interactively renew *all* of your certificates, run
"certbot-auto renew"
- If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
看到这个界面内容的话,恭喜你,证书安装成功了。
证书续签
注:证书在到期前30天才会续签成功,但为了确保证书在运行过程中不过期,官方建议每天自动执行续签两次;
使用crontab自动续期
crontab -e // 编辑定时任务
*/ * * * certbot renew --quiet --renew-hook "/etc/init.d/nginx reload"
- 需要注意"/etc/init.d/nginx reload"为nginx重启命令,需要根据自己服务器的重启命令重启即可;这里建议使用reload,不推荐使用restart,因为这样万一配错了,也不会影响服务器其他项目的运行
证书保存的路径[配置nginx需要用到的]
/etc/letsencrypt/live/you.cn/fullchain.pem
/etc/letsencrypt/live/you.cn/privkey.pem
nginx 开启 https
证书生成完成后可以到 /etc/letsencrypt/live/ 目录下查看对应域名的证书文件。编辑 nginx 配置文件监听 443 端口,启用 SSL,并配置 SSL 的公钥、私钥证书路径:
server {
listen ssl;
server_name you.cn;
root /home/www/you;
index index.html index.htm index.php;
ssl on;
ssl_certificate /etc/letsencrypt/live/you.cn/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/you.cn/privkey.pem;
...
}
添加 HTTP 自动跳转到 HTTPS:
server {
listen ;
server_name you.cn;
location / {
rewrite ^(.*)$ https://$host$1 permanent;
}
}
配置好nginx后,重启nginx
证书安装成功后,该域名下的所有二级域名都可以使用噢
取消证书
可以使用一下命令取消刚刚生成的密匙,也就是以上的反操作:
certbot revoke --cert-path /etc/letsencrypt/live/you.cn/cert.pem
certbot delete --cert-name you.cn
链接:https://www.jianshu.com/p/0d455c7a9326
来源:简书
Let's Encrypt 安装配置教程,免费的 SSL 证书的更多相关文章
- Let's Encrypt:初次使用免费的ssl证书,并生成java用的 jks(keystore) 文件
现在都流行 https,今天晚上花了二个小时,学习了一下,这里做个学习总结: 因为刚开始接触,就使用免费的:Let's Encrypt Let's Encrypt证书特点: 1. 现在主流的浏览器(c ...
- Let's Encrypt 免费通配符 SSL 证书申请教程——但是也需要email,域名所有权等,如果是黑产用的话会这样用吗?会不会暴露自己身份???
Let's Encrypt 免费通配符 SSL 证书申请教程 from:https://blog.csdn.net/English0523/article/details/79608464 2018 ...
- QT开发环境安装配置教程
QT开发环境安装配置教程 分类: QT2012-11-29 23:31 35366人阅读 评论(12) 收藏 举报 Linux版的直接在ubutnu软件中心输入QT,安装响应的Designer,Cre ...
- 2018超详细sublime text3+python3.x安装配置教程(附常用插件安装教程)
导读 本文是关于2018年7月最新版sublime text3+pythin3.x下载及安装配置教程,sublime text3版本为3176,python版本为3.7,安装环境是基于windows1 ...
- centos7命令行和图形界面的相互切换(附centos7安装配置教程)
一.最近安装了centos7,发现在命令行和图形界面的相互切换命令上,与centos以往版本有很大不同,先整理如下,加深记忆. 1,centos7默认安装后,跟其他版本一样,启动默认进入图形界面: 2 ...
- MySQL基础环境_安装配置教程(Windows7 64或Centos7.2 64、MySQL5.7)
MySQL基础环境_安装配置教程(Windows7 64或Centos7.2 64.MySQL5.7) 安装包版本 1) VMawre-workstation版本包 地址: https://m ...
- Windows基础环境_安装配置教程(Windows7 64、JDK1.8、Android SDK23.0、TortoiseSVN 1.9.5)
Windows基础环境_安装配置教程(Windows7 64.JDK1.8.Android SDK23.0.TortoiseSVN 1.9.5) 安装包版本 1) JDK版本包 地址: htt ...
- Linux基础环境_安装配置教程(CentOS7.2 64、JDK1.8、Tomcat8)
Linux基础环境_安装配置教程 (CentOS7.2 64.JDK1.8.Tomcat8) 安装包版本 1) VMawre-workstation版本包 地址: https://my.vmw ...
- Windows上PostgreSQL安装配置教程
Windows上PostgreSQL安装配置教程 这篇文章主要为大家详细介绍了Windows上PostgreSQL安装配置教程,具有一定的参考价值,感兴趣的小伙伴们可以参考一下 PostgreSQL的 ...
随机推荐
- vue-cli中进行微信支付代码详解
最近做微信支付,颇经历一番波折,这里总结一下,便于以后少走弯路: 在进行微信支付,除了需要公众号之外,你还需要一个微信商户.根据商户规则进行商户申请 这是公众号的基本开发配置,这里在微信授权的时候就已 ...
- 【HDOJ】P1007 Quoit Design (最近点对)
题目意思很简单,意思就是求一个图上最近点对. 具体思想就是二分法,这里就不做介绍,相信大家都会明白的,在这里我说明一下如何进行拼合. 具体证明一下为什么只需要检查6个点 首先,假设当前左侧和右侧的最小 ...
- windows 和 linux 多线程
学习了几天多线程技术,做个总结,便于记忆. 一般 多线程传递参数 为 void* 所以会有一个强制转换过程 (int*) (void *)等,传递多个参数选择 结构体指针.为了避免多个线程访问数据 ...
- 解决vi显示文件不能全屏的问题
https://blog.csdn.net/ly890700/article/details/52735092 docker外: vi ~/.vimrc
- shell 例子
shell编程入门 http://www.runoob.com/linux/linux-shell-variable.html http://c.biancheng.net/cpp/shell/ .查 ...
- Qt 【无法打开 xxxx头文件】
经过多次磕碰,终于发现了通用的办法. 测试环境Qt5.5.1 mvcs 比如需要用到QtWin 直接去包含然后运行,but fail, 我去查找他的父类 QtWinExtras Qt自带的自动补全, ...
- Java判断链表是否为回文链表
请判断一个链表是否为回文链表. 示例 1: 输入: 1->2 输出: false 示例 2: 输入: 1->2->2->1 输出: true 思路:1.通过快慢指针,来遍历链表 ...
- SQL Server SQLBindCol
说明 编辑 版本引入:ODBC 1.0 遵从标准:ISO 92 功能说明: SQLBindCol将应用程序的数据缓冲绑定到结果集的各列 函数原型: SQLRETURN SQLBindCol( SQLH ...
- 【网络】IP地址,子网掩码,网段表示法,默认网关,DNS服务器详解
楔子: 以Windows系统中IP地址设置界面为参考(如图1), IP地址, 子网掩码, 默认网关 和 DNS服务器, 这些都是什么意思呢? 学习IP地址的相关知识时还会遇到网络地址,广播地址,子网等 ...
- 关于移动端使用swiper做图片文字轮播的思考
最近做移动端网页的时候,需要在首页添加一个公告的模块,用来轮播公告消息标题并且能链接到相应的详情页面,最开始用的是swiper插件,在安卓上测试完全没有问题,但是在苹果机上就没有那么灵敏了,来回切换首 ...