教你快速撸一个免费HTTPS证书
摘要: 免费 HTTPS 证书,了解一下?

HTTPS 已成为业界标准,这篇博客将教你申请Let's Encrypt的免费 HTTPS 证书。
本文的操作是在 Ubuntu 16.04 下进行,使用 nginx 作为 Web 服务器。
1. 安装 Certbot
Certbot可以用于管理(申请、更新、配置、撤销和删除等)Let's Encrypt 证书。这里安装的是带 nginx 插件的 certbot:
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:certbot/certbot
sudo apt-get update
sudo apt-get install -y python-certbot-nginx
2. 配置 Nginx
vim /etc/nginx/conf.d/fundebug.conf
此时还没有 HTTPS 证书,因此域名只能使用 80 端口而非 443 端口,网站只能通过 http 协议而非 https 协议访问:http://www.fundebug.com。
server
{
listen 80;
server_name www.fundebug.com;
}
重启 nginx:
systemctl restart nginx
3. 配置 DNS
使域名www.fundebug.com指向 nginx 所在服务器的 IP:

如果你想发现代码中隐藏的 BUG,欢迎免费试用最专业的 BUG 实时监控平台Fundebug!
4. 申请证书
使用 certbot 命令为www.fundebug.com申请 HTTPS 证书。--nginx选项表示 Web 服务器为 nginx,-d选项指定域名,-n选项表示非交互式运行命令。若去除-n选项,则终端会提醒你选择是否将 http 请求重定向为 https 请求。
certbot --nginx -d www.fundebug.com -n --email help@fundebug.com --agree-tos
证书申请成功之后,会看到以下信息。Let's Encrypt 证书的有效期只有 3 个月,但是Certbot 会通过 Cron 和 systemd timer 自动更新证书,证书的时效性不用担心。
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/www.fundebug.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/www.fundebug.com/privkey.pem
Your cert will expire on 2018-09-29. To obtain a new or tweaked
version of this certificate in the future, simply run certbot again
with the "certonly" option. To non-interactively renew *all* of
your certificates, run "certbot 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
HTTPS 证书相关的文件在/etc/letsencrypt/目录中:
find /etc/letsencrypt/ -name "*www.fundebug.com*"
/etc/letsencrypt/renewal/www.fundebug.com.conf
/etc/letsencrypt/archive/www.fundebug.com
/etc/letsencrypt/live/www.fundebug.com
certbot 会自动修改 nginx 配置文件:
cat /etc/nginx/conf.d/fundebug.conf
nginx 监听了 443 端口并配置了 HTTPS 证书,这时我们可以通过 HTTPS 协议访问了!https://www.fundebug.com
server
{
listen 80;
server_name www.fundebug.com;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/www.fundebug.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/www.fundebug.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
参考
关于Fundebug
Fundebug专注于JavaScript、微信小程序、微信小游戏、支付宝小程序、React Native、Node.js和Java线上应用实时BUG监控。 自从2016年双十一正式上线,Fundebug累计处理了10亿+错误事件,付费客户有Google、360、金山软件、百姓网等众多品牌企业。欢迎大家免费试用!

版权声明
转载时请注明作者Fundebug以及本文地址:
https://blog.fundebug.com/2018/07/06/apply-lets-encrypt-certificate/
教你快速撸一个免费HTTPS证书的更多相关文章
- 分享一个免费SSL证书申请网站,给网站开启https协议 | 张戈博客
这些天,由于公司的业务需求,接触到了ssl证书和https协议.博客前几篇文章也分享了在WEB服务器上安装SSL证书,为网站开启https协议的教程,感兴趣的童鞋可以前往查看相关文章: <Lin ...
- 免费靠谱的 Let’s Encrypt 免费 https 证书申请全过程
申请 Let’s Encrypt证书的原因: 现在阿里云等都有免费的 https 证书,为什么还要申请这个呢(估计也是因为阿里云这些有免费证书的原因,所以 Let’s Encrypt 知道的人其实并不 ...
- 项目总结20:阿里云免费https证书申请
项目总结20:阿里云免费https证书申请 1. 登录阿里云控制台 www.aliyun.com,用账户信息登录 2. 在”产品与服务”搜索SSL,选择SSL证书 3. 点击购买证书 4. 选择” S ...
- Nginx反向代理+负载均衡简单实现(手动申请https证书,申请免费https证书,http强转https)
背景:A服务器(192.168.1.8)作为nginx代理服务器B服务器(192.168.1.150)作为后端真实服务器 现在需要访问https://testwww.huanqiu.com请求时从A服 ...
- linux免费https证书申请教程
linux免费https证书申请教程直接去阿里云 菜单有个证书服务进去有个购买证书菜单 选择免费的 然后会提示写个人资料 然后系统生成csr 然后提交审核这个时候会有份邮件 文件下载上传到你的服务器 ...
- 免费 Https 证书(Let's Encrypt)申请与配置
之前要申请免费的 https 证书操作步骤相当麻烦,今天看到有人在讨论,就搜索了一下.发现现在申请步骤简单多了. 1. 下载 certbot git clone https://github.com/ ...
- Certbot让网站拥有免费https证书
网站使用http协议,在chrome浏览器中总是报不安全,看着就让人不爽,自己建的网站,不安全总是会让自己心慌慌.看到有头有脸的网站都是https开头,心中自然也想装逼一把,让自己的网站高端大气上档次 ...
- 在阿里云里申请免费Https证书SSL
在阿里云控制台:安全(云盾)->证书服务->购买证书里(地址:https://common-buy.aliyun.com/?spm=5176.2020520163.cas.1.zTLyhO ...
- 我的Android进阶之旅------>Android关于HttpsURLConnection一个忽略Https证书是否正确的Https请求工具类
下面是一个Android HttpsURLConnection忽略Https证书是否正确的Https请求工具类,不需要验证服务器端证书是否正确,也不需要验证服务器证书中的域名是否有效. (PS:建议下 ...
随机推荐
- 微信小程序学习笔记(一)
1.新添加页面,找到app.json,在pages中加入写的路径会自动生成文件 2.页面跳转方式,传参数: wx.navigateTo({ url: '../home/home?title=' + a ...
- [tkinter]隐藏/销毁控件
pack布局的情况下有pack_forget()方法让控件“不再显示”但控件还存在可以再次pack出来 from tkinter import * root = Tk() l1 = Label(roo ...
- 原生js实现删除class和添加class
内容来自百度搜索 //判断样式是否存在 function hasClass(ele, cls) { return ele.className.match(new RegExp("(\ ...
- 《C#与.NET程序员面试宝典》学习札记
第2章 .NET概述 2.1-6~ .Net Framework / CLR / IL / Assembly IL:中间语言代码,不同语言(如C#,VB)的基于CLR的编译器编译生成的中间语言字节码, ...
- CS20SI-tensorflow for research笔记: Lecture3
本文整理自知乎专栏深度炼丹,转载请征求原作者同意. 本文的全部代码都在原作者GitHub仓库github CS20SI是Stanford大学开设的基于Tensorflow的深度学习研究课程. Tens ...
- [Swift]LeetCode454. 四数相加 II | 4Sum II
Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l)there are such th ...
- Linux启动Redis失败/没有那个文件或目录
没有那个文件或目录问题,可能是你选择的目录不对. 应切换到Redis目录下启动.
- 在react中使用vis.js
import React from 'react'; import {message} from 'antd' import vis from 'vis'; import {api as http ...
- BBS论坛(十三)
13.1点击更换图形验证码 (1)front/signup.html <div class="form-group"> <div class="inpu ...
- asp.net core系列 31 EF管理数据库架构--必备知识 反向工程
一. 反向工程 反向工程是基于数据库架构,生成的实体类和DbContext类代码的过程,对于Visual Studio开发,建议使用PMC.对于其他开发环境,请选择.NET Core CLI工具( ...