IT基础设施:在CentOS7中为nginx布署免费SSL证书

简介: 前言此前在阿里申请了免费的SSL证书,但每个人只有20个证书的额度,此额度是一次性、永久性的,也就是说,到期的证书也算;由于各种各样的原因,我的测试额度已经满了。

前言

此前在阿里申请了免费的SSL证书,但每个人只有20个证书的额度,此额度是一次性、永久性的,也就是说,到期的证书也算;由于各种各样的原因,我的测试额度已经满了。于是转粉腾讯云,结果腾讯这边直接审核不通过,顿时心凉;猛然间想起咱们还有Let's Encrypt's,立马感觉生活又有了希望。

img_71a68b83b7f6d74f2270671c1ecc4025.png
我一域名咋就不安全啦

Let's Encrypt's 介绍

Let’s Encrypt is a free, automated, and open certificate authority (CA), run for the public’s benefit. It is a service provided by the Internet Security Research Group (ISRG).

Let's Encrypt's 是一个免费,自动化和开放的证书颁发机构(CA),为公众的利益而运行。它是由Internet Security Research Group(ISRG)提供的服务。

We give people the digital certificates they need in order to enable HTTPS (SSL/TLS) for websites, for free, in the most user-friendly way we can. We do this because we want to create a more secure and privacy-respecting Web.

我们免费为人们提供数字证书,以帮助他们为网站启用HTTPS,使得他们的网站能更加的安全,数据的隐私能更加有效地得到保护。

The key principles behind Let’s Encrypt are:

  • Free: Anyone who owns a domain name can use Let’s Encrypt to obtain a trusted certificate at zero cost.
  • Automatic: Software running on a web server can interact with Let’s Encrypt to painlessly obtain a certificate, securely configure it for use, and automatically take care of renewal.
  • Secure: Let’s Encrypt will serve as a platform for advancing TLS security best practices, both on the CA side and by helping site operators properly secure their servers.
  • Transparent: All certificates issued or revoked will be publicly recorded and available for anyone to inspect.
  • Open: The automatic issuance and renewal protocol will be published as an open standard that others can adopt.
  • Cooperative: Much like the underlying Internet protocols themselves, Let’s Encrypt is a joint effort to benefit the community, beyond the control of any one organization.

我们的主旨是:免费、自动化、安全、透明、开放、合作

Certbot

Certbot是Let's Encrypt CA(或任何其他讲ACME协议的CA)的全功能,可扩展的客户端,可以自动完成获取证书和配置Web服务器以使用它们的任务。此客户端在基于Unix的操作系统上运行。

安装

Certbot打包在EPEL(企业Linux的额外包)中。 要使用Certbot,必须先启用EPEL存储库。 在RHEL或Oracle Linux上,还必须启用可选通道。

yum -y install yum-utils
yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional

安装certbot的nginx版插件

yum install python2-certbot-nginx

自动识别nginx配置文件中的域名,一步步获取证书,并自动修改配置文件

certbot --nginx

如果不希望修改配置文件,而只是获取证书可以使用下面这个命令

certbot --nginx certonly

自动续期

可以将Certbot配置为在证书过期之前自动续订证书。 由于Let's Encrypt证书持续90天,因此最好利用此功能。 您可以通过运行以下命令来测试证书的自动续订:

certbot renew --dry-run

如果这看起来工作正常,您可以通过添加运行以下命令的cron作业或systemd计时器来安排自动续订:

certbot renew

如果您正在设置cron或systemd作业,我们建议每天运行两次(在您的证书到期或续订之前,它将不会执行任何操作,但定期运行它会使您的站点有机会保持在线状态 案例a由于某种原因,我们发生了加密启动的撤销。 请在一小时内随机选择续订任务。

一个示例cron作业可能看起来像这样,它将在每天中午和午夜运行:

0 0,12 * * * python -c 'import random; import time; time.sleep(random.random() * 3600)' && certbot renew 

引用

1.certbot on github
2.Certbot Installation Guide

相关文章
|
9天前
|
存储 算法 安全
ssl 证书名词解释--crt和pem
ssl 证书名词解释--crt和pem
22 0
|
9天前
|
应用服务中间件 Linux 网络安全
CentOS 7.4源码编译nginx1.12 并且隐藏nginx的版本
CentOS 7.4源码编译nginx1.12 并且隐藏nginx的版本
14 0
|
10天前
|
安全 搜索推荐 数据建模
解决网站“不安全”、“不受信”、“排名下降”,你需要——「SSL证书」
SSL证书是网络安全的关键,用于加密和验证网站身份,保护用户数据安全,防止信息被窃取。它分为DV、OV、EV和IV四种类型,每种验证网站身份的程度不同。DV证书快速签发,OV和EV证书提供更高级别的身份验证,EV证书曾在浏览器地址栏显示绿色。目前,DV证书占据市场大部分份额。SSL证书还有单域、通配符和多域之分,有效期曾从多年逐渐缩短至90天,以增强安全性。部署SSL证书能提升用户信任,优化SEO排名,并符合网络安全法规要求。
解决网站“不安全”、“不受信”、“排名下降”,你需要——「SSL证书」
|
2月前
|
前端开发 应用服务中间件 Linux
nginx解决springcloud前后端跨域问题,同时配置ssl
nginx解决springcloud前后端跨域问题,同时配置ssl
|
2月前
|
Linux 应用服务中间件 网络安全
CentOS7搭建本地离线局域网yum源(Httpd/Nginx+yum)
CentOS7搭建本地离线局域网yum源(Httpd/Nginx+yum)
289 0
|
2月前
|
缓存 负载均衡 应用服务中间件
如何在 CentOS 7 上为 NGINX 安装开源 HTTP 加速器:Varnish
如何在 CentOS 7 上为 NGINX 安装开源 HTTP 加速器:Varnish
67 1
如何在 CentOS 7 上为 NGINX 安装开源 HTTP 加速器:Varnish
|
2月前
|
运维 应用服务中间件 Shell
通过 saltstack 批量更新 SSL 证书
通过 saltstack 批量更新 SSL 证书
|
2月前
|
应用服务中间件 网络安全 nginx
解决nginx:[emerg]unknown directive ssl错误
解决nginx:[emerg]unknown directive ssl错误
|
2月前
|
Java 应用服务中间件 网络安全
Nginx配置静态页面+springboot应用+swagger+SSL的实现
Nginx配置静态页面+springboot应用+swagger+SSL的实现
|
2月前
|
存储 Linux 网络安全
如何在 Linux 中删除 SSL 证书和 SSH 密码?
如何在 Linux 中删除 SSL 证书和 SSH 密码?
79 1
如何在 Linux 中删除 SSL 证书和 SSH 密码?