最新版 Let’s Encrypt免费证书申请步骤,保姆级教程

2023-05-16

最近将域名迁到了google domain,就研究了一下Let’s Encrypt的域名证书配置。发现网上找到的教程在官方说明中已经废弃,所以自己写一个流程记录一下。

步骤方法官方文档见:https://eff-certbot.readthedocs.io/en/stable/install.html#installation

snapd官方文档见:https://certbot.eff.org/instructions

1. 安装snapd

  • centos(这里我使用的是这个系统)
    sudo yum install snapd
    sudo systemctl enable --now snapd.socket
    sudo ln -s /var/lib/snapd/snap /snap
    

  • ubuntu的
    $ sudo apt update
    $ sudo apt install snapd
    

测试一下:

$ sudo snap install hello-world
hello-world 6.4 from Canonical✓ installed
$ hello-world
Hello World!

2. 使用snapd安装certbot

sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot

3. 生成证书(需要指定nginx)

👉 手动安装nginx

certbot certonly --nginx --nginx-ctl /usr/local/nginx/sbin/nginx --nginx-server-root /usr/local/nginx/conf

这里的certonly就是只下载对应文件,不进行配置nginx,适用于自己配置或者更新使用。去掉则会帮你进行配置nginx(我没有试用)。

可能出现的问题:

The error was: PluginError(‘Nginx build is missing SSL module (–with-http_ssl_module).’)

提示这个错误是因为目前nginx缺少–with-http_ssl_module这个模块,我们要添加这个模块。重新编译nginx

进入nginx下载的目录

./configure --prefix=/usr/local/nginx --with-http_ssl_module

编译完成后

make

make install

/usr/local/nginx/sbin/nginx -s stop

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

使用 /usr/local/nginx/sbin/nginx -V 查看是否生效

[root]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.23.2
built by gcc 10.2.1 20200825 (Alibaba 10.2.1-3 2.32) (GCC) 
built with OpenSSL 1.1.1k  FIPS 25 Mar 2021
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module

生效,重新执行上面的命令即可。

4. 生成证书

执行上面的命令后,程序会让你确认你的邮箱和你的域名,确认完成后会将证书文件生成在指定目录中。

certbot certonly --nginx --nginx-ctl /usr/local/nginx/sbin/nginx --nginx-server-root /usr/local/nginx/conf
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices)
 (Enter 'c' to cancel): [这里输入你的邮箱]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.3-September-21-2022.pdf. You must
agree in order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing, once your first certificate is successfully issued, 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: Y [选Y 继续]
Account registered.

Which names would you like to activate HTTPS for?
We recommend selecting either all domains, or all domains in a VirtualHost/server block.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: whrss.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel):  [这里不需要输入,回车选所有]
Requesting a certificate for whrss.com

Successfully received certificate.
Certificate is saved at: 
# [这里告诉我们生成的文件路径和有效期]
/etc/letsencrypt/live/whrss.com/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/whrss.com/privkey.pem
This certificate expires on 2023-03-02.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

5. Nginx.conf的配置

server{
        #监听443端口
        listen 443 ssl;
        #对应的域名,空格分隔域名就可以了
        server_name whrss.com; 
        #第一个域名的文件
        ssl_certificate /etc/letsencrypt/live/whrss.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/whrss.com/privkey.pem;
        # 其他配置
        ssl_session_timeout 5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
        ssl_prefer_server_ciphers on;
        #这是我的主页访问地址,因为使用的是静态的html网页,所以直接使用location就可以完成了。
        location / {
            root   /;
            index  /;
            proxy_pass http://127.0.0.1:9091;
            proxy_set_header Host $host:443;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Via "nginx";
        }
}

以上!!

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

最新版 Let’s Encrypt免费证书申请步骤,保姆级教程 的相关文章

  • win7 usb u盘打不开,设备管理器提示:该设备无法启动。 (代码 10)

    解决 xff1a 禁用改设备 gt 卸载 gt 重新插入u盘
  • linux netlink机制介绍与实例

    开发和维护内核是一件很繁杂的工作 xff0c 因此 xff0c 只有那些最重要或者与系统性能息息相关的代码才将其安排在内核中 其它程序 xff0c 比如GUI xff0c 管理以及控制部分的代码 xff0c 一般都会作为用户态程序 在 li
  • error LNK2038: 检测到“_ITERATOR_DEBUG_LEVEL”的不匹配项的原因及解决方案

    值 0 不匹配值 2 xff0c Debug使用了Release下的库文件 值 2 不匹配值 0 xff0c Release使用了Debug下的库文件 对于上述两种情况 xff0c 只需要在预处理定义中设定其值使其符合要调用的程序即可 VS
  • SNMP协议详解<二>

    上一篇文章讲解了SNMP的基本架构 xff0c 本篇文章将重点分析SNMP报文 xff0c 并对不同版本 xff08 SNMPv1 v2c v3 xff09 进行区别 xff01 四 SNMP协议数据单元 在SNMP管理中 xff0c 管理
  • SNMP协议详解<三>

    在上篇文章中 xff0c 说到了SNMPv3主要在安全性方面进行了增强 xff0c 采用USM xff08 基于用户的安全模型 xff09 和VACM xff08 基于视图的访问控制模型 xff09 技术 下面我们就主要讲解SNMPv3的报
  • SNMPv3的加密和认证过程

    前面的一些文章详细讲解了SNMPv3的报文内容 xff0c 下面主要的内容就是SNMPv3的加密和认证过程 xff01 USM的定义为实现以下功能 xff1a 鉴别 数据加密 密钥管理 时钟同步化 避免延时和重播攻击 1 UsmSecuri
  • H3C SNMPv3 配置

    1 xff09 H3C SNMPv3 配置 html view plain copy print snmp agent mib view included MIB 2 mib 2 snmp agent mib view included M
  • SNMPv3原理-SNMPv3协议框架

    1 SNMPv3的体系结构 SNMPv3定义了新的体系结构 xff0c 并在其中包含了对SNMPv1和SNMPv2c的兼容 xff0c 即这个新的体系结构也适用于SNMPv1及SNMPv2c xff0c 弥补了SNMP没有完整体系结构的缺点
  • MBR与GTP

    现有的PC机架构 xff0c 是沿用了数十年的主板BIOS 43 硬盘MBR分区的组合模式 随着不久的将来 xff08 2009年 xff1f xff09 硬盘容量突破2TB xff0c BIOS xff0b MBR组合估计会被主板EFI和
  • R6002-floating point not loaded 的问题解决方法 .

    最近项目的要计算浮点数据 xff0c 为了调试方便 xff0c 输出计算结果值到DEBUG信息 xff0c 结果却出现 R6002 错误 Google了一下 xff0c MSDN上对于R6002的描述信息是 xff1a 错误消息 未加载浮点
  • KVM修改虚拟机配置

    1 修改内存或 CPU 编辑虚拟机配置文件 xff1a root 64 controller virsh edit centos2 如 xff0c span class token tag span class token tag span
  • 调试笔记之观察中断

    调试笔记之观察中断 中断好比计算机系统的脉搏 xff0c 是系统生命力的源泉 在WinDBG做内核调试时该如何观察系统的中断分配和响应情况呢 xff1f WinDBG的帮助文件对此描述甚少 xff0c 已经有的几个重要扩展命令居然也没有出现
  • 活动目录域控制器端口

    活动目录域控制器端口 域成员与域控之间通讯需要开放什么端口 xff0c 除了LDAP389 139 445 DNS21 xff0c 还有其他吗 xff1f 回答 xff1a 根据您的描述 xff0c 我对这个问题的理解是 xff1a DC和
  • Apollo编译卡死问题

    最近在研究apollo xff0c 按照他们官方教程下载安装后 输入下面命令开启并进入docker bash docker scripts dev start sh bash docker scripts dev into sh 然后就进入
  • docker服务器的图形显示方案

    问题描述 xff1a 一般docker实操时都是作为服务器 xff0c 以字符方式交互 xff0c 非常不方便 本人尝试各种图形解决方案 xff0c 最终找到完美方案 最初本人尝试过VNC和SSH方式 xff0c 最终被否定了 1 本来do
  • Centos7下使用CMake

    在进行需要提供跨平台服务的项目时 xff0c 最好有相应的跨平台项目构建工具 本文所述的CMake即其中比较好用的跨平台构建工具之一 下文主要以C 43 43 语言为例进行使用演示 安装C 43 43 所需的环境 xff1a yum ins
  • 树莓派+神经计算棒2实时人脸检测

    树莓派配置摄像头 sudo apt get install python opencv sudo apt get install fswebcam 配置摄像头 sudo nano etc modules 查看树莓派CPU型号 cat pro
  • 学习总结-编写自己的CMakeLists.txt

    cmake minimum required span class token punctuation span VERSION span class token number 3 3 span span class token punct
  • 7.4V锂电池USB平衡充电器 串联锂电池充电器

    7 4V锂电池USB平衡充电器 串联锂电池充电器 本文介绍一种简单实用的串联锂电池充电器 大家知道 xff0c 串联电池的充电 xff0c 是一个麻烦的问题 如果直接拿7 4V来充 xff0c 可能会因为两颗电池的参数差异 xff0c 会导
  • 【Echarts】数据可视化完成大屏地图(拓展乡镇地区)的绘制

    绘制地图要素 地图边缘 地理位置 xff08 中心点或者自定义的未知 xff09 echarts绘制 实现在前 成品展示放在最后 代码太长 xff0c 参考代码可见Github Github地址 获取地图 获取精确到乡镇街道的地图JSON数

随机推荐

  • K8s问题【flannel一直重启问题,CrashLoopBackOff】

    kubectl describe 命令查看 Events Type Reason Age From Message Normal Scheduled 13m default scheduler Successfully assigned k
  • Python openpyxl库

    1 读写单元格 span class token keyword from span openpyxl span class token keyword import span load workbook wb span class tok
  • 子网掩码

    子网掩码 subnet mask 是每个网管必须要掌握的基础知识 xff0c 只有掌握它 xff0c 才能够真正理解TCP IP协议的设置 以下我们就来深入浅出地讲解什么是子网掩码 IP地址的结构 要想理解什么是子网掩码 xff0c 就不能
  • AS学习网址大全

    都是我在学习过程中精心收集的 xff0c 大部分为国内网站 xff0c 绝对是您学习AS最好的去处 本贴于2010年3月22日再次更新 xff0c 并新加了很多好的网站 1 同时将网址全都贴出来 xff0c 方便不想下载的朋友使用 2 附件
  • 紧耦合和松耦合有什么区别

  • 我的大一学习生活总结

    今天最后的一科英语考完了 xff0c 但此刻的我并不觉的轻松 xff0c 我知道从现在开始就标志着我的大一已经结束了 xff0c 在大学仅有的四年时光就过去了四分之一 回想起大一这一年 xff0c 自问一下我到底学到了什么 xff1f 我发
  • 阿里云导出raw文件如何还原查看及centos7系统密码破解

    1 Raw格式转换 1 1 格式介绍 目前阿里云ecs镜像文件的导出格式默认为 raw tar gz xff0c 解压后为 raw格式 raw为最原始的虚拟机镜像文件 xff0c vmdk是vmware Virtual Box的虚拟机镜像文
  • 5.33 综合案例2.0 -ESP32拍照上传阿里云OSS

    综合案例2 0 ESP32拍照上传阿里云OSS 案例说明连线功能实现1 阿里云平台连接2 OSS对象存储服务3 ESP32 CAM开发环境4 代码ESP32 CAM开发板代码HaaS506开发板代码 测试数据转图片方法 案例说明 使用ESP
  • 'grep' 不是内部或外部命令,也不是可运行的程序或批处理文件

    使用 grep 来过滤 xff1a adb shell pm list packages grep qq 然后就报了 39 grep 39 不是内部或外部命令 xff0c 也不是可运行的程序或批处理文件 xff0c 后来发现根本不是grep
  • 一个程序员的一生

    一个程序员的一生 作者 佚名 我在程序员的时候 xff0c 我一开始追逐这个API怎么用 xff0c 数据库SQL怎么写更优化 xff0c Dcom技术的细节 xff0c 然后我发现我写出来的产品为了符合客户 需求必须要大量修改 xff0c
  • 搭建Ubuntu Samba服务器(超简单)

    1 xff09 安装samba服务 sudo apt get install samba 2 xff09 配置samba sudo vim etc samba smb conf share comment 61 myshare path 6
  • Nginx-配置HTTPS证书(单向认证)

    目录 一 生成 CA 私钥 1 生成一个 CA 私钥 ca key 二 生成CA 的数字证书 1 生成一个 CA 的数字证书 ca crt 三 生成 server 端数字证书请求 1 生成 nginx 端的私钥 nginx key 2 生成
  • 数据结构—B+树

    1 约束 B 43 树的约束与 B 树类似 xff0c 一棵 m m m 阶 B 43 树具有如下特点 xff1a xff08 1 xff09 根节点要么是一个叶节点 xff0c 要么至少具有两个孩子节点 xff1b xff08 2 xff
  • 服务端三种方式实现单设备登录

    单设备登录 xff0c 顾名思义 xff0c 一个账号在一个app中只能在一个设备上进行登录 使用的场景例如 xff1a 账号多端登录时云存档的一致性问题 单设备登录常用的方法 xff1a 1 web端 xff0c session 43 c
  • go 管道简单入门及注意事项:管道创建,发送、接受数据,管道关闭

    1 使用make命令创建channel span class token comment 未设置缓冲区 xff0c 只能放一个 xff0c 不读取再次赋值则会阻塞 span c1 span class token operator 61 s
  • java 生成grpc调用service

    1 安装protoc 这里以mac为例 xff1a brew install automake brew install libtool brew install protobuf 检查 protoc version 2 下载protoc
  • go微服务框架Kratos简单使用总结

    Kratos是B站开源的一款go的微服务框架 xff0c 最近PS5上的 战神 诸神黄昏比较火 xff0c 主角就是奎托斯 这个框架的名字就取自他 在进行框架选型时 xff0c 对比了目前主流的很多go微服务框架 xff0c 如Zero x
  • Gradle重新安装后下载插件失败 Read timed out 问题解决

    究极大坑记录 在使用gradle进行构建kotlin项目时 xff0c 项目所用依赖版本需要同步升级gradle版本 升级gradle版本后 xff0c gradle相关插件无法下载 xff0c 反复timeout超时 症状如下 xff1a
  • Jenkins启动失败:Failed to start LSB: Jenkins Automation Server.

    启动systemctl start jenkins service提示 Job span class token keyword for span jenkins service failed because the control pro
  • 最新版 Let’s Encrypt免费证书申请步骤,保姆级教程

    最近将域名迁到了google domain xff0c 就研究了一下Let s Encrypt的域名证书配置 发现网上找到的教程在官方说明中已经废弃 xff0c 所以自己写一个流程记录一下 步骤方法官方文档见 xff1a https eff