免费 Https 证书(Let's Encrypt)申请与配置
之前要申请免费的 https 证书操作步骤相当麻烦,今天看到有人在讨论,就搜索了一下。发现现在申请步骤简单多了。
1. 下载 certbot
git clone https://github.com/certbot/certbot
cd certbot
./certbot-auto --help
解压打开执行就会有相关提示
2. 生成免费证书
./certbot-auto certonly --webroot --agree-tos -v -t --email 邮箱地址 -w 网站根目录 -d 网站域名
./certbot-auto certonly --webroot --agree-tos -v -t --email keeliizhou@gmail.com -w /path/to/your/web/root -d note.crazy4code.com
注意 这里 默认会自动生成到 /网站根目录/.well-known/acme-challenge 文件夹,然后 shell 脚本会对应的访问 网站域名/.well-known/acme-challenge 是否存在来确定你对网站的所属权
比如:我的域名是 note.crazy4code.com 那我就得保证域名下面的 .well-known/acme-challenge/ 目录是可访问的 可以操作chmod 777 -R /网站根目录/.well-known/acme-challenge
如果返回正常就确认了你对这个网站的所有权,就能顺利生成,完成后这个目录会被清空
3. 获取证书
如果上面的步骤正常 shell 脚本会展示如下信息:
- Congratulations! Your certificate and chain have been saved at
/etc/letsencrypt/live/网站域名/fullchain.pem
...
4. 生成 dhparams
使用 openssl 工具生成 dhparams
openssl dhparam -out /etc/ssl/certs/dhparams.pem 2048
5. 配置 Nginx
打开 nginx server 配置文件加入如下设置:
listen 443
ssl on;
ssl_certificate /etc/letsencrypt/live/网站域名/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/网站域名/privkey.pem;
ssl_dhparam /etc/ssl/certs/dhparams.pem;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
然后重启 nginx 服务就可以了
6. 强制跳转 https
https 默认是监听 443 端口的,没开启 https 访问的话一般默认是 80 端口。如果你确定网站 80 端口上的站点都支持 https 的话加入下面的配件可以自动重定向到 https
server {
listen 80;
server_name your.domain.com;
return 301 https://$server_name$request_uri;
}
7. 证书更新
免费证书只有 90 天的有效期,到时需要手动更新 renew。刚好 Let’s encrypt 旗下还有一个 Let’s monitor 免费服务,注册账号添加需要监控的域名,系统会在证书马上到期时发出提醒邮件,非常方便。收到邮件后去后台执行 renew 即可,如果提示成功就表示 renew 成功
./certbot-auto renew
实际操作:
[root@test html]# chmod 777 -R .well-known/
./certbot-auto certonly --webroot --agree-tos -v -t --email zhaoweifeng@hl***ang.cn -w /var/www/html -d test.b****wkd.com
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/test.bjy***d.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/test.bj***d.com/privkey.pem
Your cert will expire on 2018-03-14. 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"
免费 Https 证书(Let's Encrypt)申请与配置的更多相关文章
- 免费SSL证书 - Let's Encrypt申请(WINDOWS + IIS版)
Let’s Encrypt 项目是由互联网安全研究小组ISRG,Internet Security Research Group主导并开发的一个新型数字证书认证机构CA,Certificate Aut ...
- 免费靠谱的 Let’s Encrypt 免费 https 证书申请全过程
申请 Let’s Encrypt证书的原因: 现在阿里云等都有免费的 https 证书,为什么还要申请这个呢(估计也是因为阿里云这些有免费证书的原因,所以 Let’s Encrypt 知道的人其实并不 ...
- 申请免费通配符证书(Let's Encrypt)并绑定IIS
申请免费通配符证书(Let's Encrypt)并绑定IIS 2018-05-25 18:01 by Giant Liu, 800 阅读, 4 评论, 收藏, 编辑 什么是 Let’s Encrypt ...
- 申请免费通配符证书(Let's Encrypt)并绑定IIS(转载)
本文转载自https://blog.csdn.net/qq_41608008/article/details/80491447 什么是 Let's Encrypt? 部署 HTTPS 网站的时候需要证 ...
- 项目总结20:阿里云免费https证书申请
项目总结20:阿里云免费https证书申请 1. 登录阿里云控制台 www.aliyun.com,用账户信息登录 2. 在”产品与服务”搜索SSL,选择SSL证书 3. 点击购买证书 4. 选择” S ...
- linux免费https证书申请教程
linux免费https证书申请教程直接去阿里云 菜单有个证书服务进去有个购买证书菜单 选择免费的 然后会提示写个人资料 然后系统生成csr 然后提交审核这个时候会有份邮件 文件下载上传到你的服务器 ...
- Nginx反向代理+负载均衡简单实现(手动申请https证书,申请免费https证书,http强转https)
背景:A服务器(192.168.1.8)作为nginx代理服务器B服务器(192.168.1.150)作为后端真实服务器 现在需要访问https://testwww.huanqiu.com请求时从A服 ...
- LNMP安装Let’s Encrypt 免费SSL证书方法:自动安装与手动配置Nginx
前几天介绍了最新StartSSL免费SSL申请与配置,很多人看到部落介绍SSL证书安装时总是推荐了OneinStack,因为OneinStack提供了一键添加和配置Let's Encrypt 免费SS ...
- 教你快速撸一个免费HTTPS证书
摘要: 免费 HTTPS 证书,了解一下? HTTPS 已成为业界标准,这篇博客将教你申请Let's Encrypt的免费 HTTPS 证书. 本文的操作是在 Ubuntu 16.04 下进行,使用 ...
- 免费SSL证书Let's Encrypt(certbot)安装使用教程
免费SSL证书Let's Encrypt(certbot)安装使用教程 https://www.vpser.net/build/letsencrypt-certbot.html
随机推荐
- PHP error_reporting() 错误控制函数功能详解
定义和用法: error_reporting() 设置 PHP 的报错级别并返回当前级别. 函数语法: error_reporting(report_level) 如果参数 level 未指定 ...
- dedecms幻灯片调用图片模糊的解决办法
dedecms幻灯片调用的是缩略图,如果图片尺寸比例和幻灯片的大小相差太大的话,图片就会自动拉伸模糊,比较影响美观和用户体验,下面就有常用的2个方法来解决这个图片模糊的问题. 第一种:手动制图 我们用 ...
- Lnmp修改php.ini配置
http://www.chenruixuan.com/archives/341.html A-A+ 陈瑞轩2014年5月8日07102 次浏览PHP | 工作 要在lnmp系统里面修改php.ini配 ...
- Linux中rpm命令用法听语音
rpm 是红帽(RedHat)软件包管理工具,实现类似于 Windows 中的添加/删除程序功能.下面,就来向大家介绍 rpm 命令的用法. 工具/原料 CentOS 一.rpm常用参数 1 rpm ...
- 怎么用Sublime查找替换整个文件夹下的所有文件内容?
https://segmentfault.com/q/1010000003946095 工程目录下有很多图片路径要修改,很多散落在各个文件夹. 2015年11月03日提问 评论 邀请回答 编辑 4个回 ...
- myeclipse 10怎么安装与激活
http://jingyan.baidu.com/article/5553fa82eae0ce65a2393406.html
- ASP.NET导出word实例
ASP.NET导出word实例 最近遇到一个题目就是如何在asp.net中将数据导出到word中,由于数据是动态的,所以需要在后台拼出想要的的格式,翻遍了网页找出了一个比较满意的代码,感谢那位高手.代 ...
- 或许你不知道的10条SQL技巧
一.一些常见的SQL实践 (1)负向条件查询不能使用索引 select * from order where status!=0 and stauts!=1 not in/not exists都不是好 ...
- bootstrap-table 表格加载中....处理
$('#table').bootstrapTable({data:[]}); $('#table').bootstrapTable("showLoading"); ajax数据加载 ...
- background:url() 背景图不显示
奇怪的问题: .box-3 { width: 100%; height: 500px; border: solid 2px red; margin-top: 70px; padding: 0 0 0 ...