在CentOS6,CentOS7安装 Let'sEncrypt 免费SSL安全证书

相对来说,个人网站建立SSL是昂贵的,而且往往过程繁琐。一个标准的2048位证书费用至少150美元/年,网站除了要支付一笔昂贵的费用、重新配置Web服务器,并需要解决大量的配置错误。这让广大中小网站望而生畏。

然而,Let‘s Encrypt免费证书的开放,极大推进了国内 HTTPS 的进程。Let‘s Encrypt 真正的意义在于,它推动了 HTTPS 在小型网站和个人网站中的应用,加速全面 HTTPS 时代的到来。Let‘s Encrypt 的最大贡献是它的 ACME 协议,第一份全自动服务器身份验证协议,以及配套的基础设施和客户端。这是为了解决一直以来 HTTPS TLS X.509 PKI 信任模型,即证书权威(Certificate Authority, CA)模型缺陷的一个起步。

Let‘sEncrypt的工作原理

看图:

ACME 解决了私钥持有者验证自己身份这一过程的自动化问题。

在CentOS6,CentOS7上安装Let‘s Encrypt

非营利组织电子前沿基金会的CertBot是一个很好的工具,我们使用它来安装Let‘s Encrypt

一、升级系统

  1. # yum -y update

二、安装EPEL库,为CertBot提供最新的Python包。

  1. # yum -y install epel-release

三、下载CertBot

1、CentOS7:

  1. # yum -y install python-certbot-apache

2、CentOS6:

  1. # wget https://dl.eff.org/certbot-auto
  2. # chmod 755 certbot-auto

四、Apache下配置Let‘s Encrypt

执行下条命令

  1. # ./certbot-auto --apache

根据提示操作

  1. /root/.local/share/letsencrypt/lib/python2.6/site-packages/cryptography/__init__.py:26: DeprecationWarning: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of cryptography will drop support for Python 2.6
  2. DeprecationWarning
  3. Saving debug log to /var/log/letsencrypt/letsencrypt.log
  4. Enter email address (used for urgent renewal and security notices) (Enter ‘c‘ to
  5. cancel):输入管理员邮箱
  6. -------------------------------------------------------------------------------
  7. Please read the Terms of Service at
  8. https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf. You must agree
  9. in order to register with the ACME server at
  10. https://acme-v01.api.letsencrypt.org/directory
  11. -------------------------------------------------------------------------------
  12. (A)gree/(C)ancel: A
  13. -------------------------------------------------------------------------------
  14. Would you be willing to share your email address with the Electronic Frontier
  15. Foundation, a founding partner of the Let‘s Encrypt project and the non-profit
  16. organization that develops Certbot? We‘d like to send you email about EFF and
  17. our work to encrypt the web, protect its users and defend digital rights.
  18. -------------------------------------------------------------------------------
  19. (Y)es/(N)o: Y
  20. Which names would you like to activate HTTPS for?
  21. -------------------------------------------------------------------------------
  22. 1: www.xi-chuang.com
  23. -------------------------------------------------------------------------------
  24. Select the appropriate numbers separated by commas and/or spaces, or leave input
  25. blank to select all options shown (Enter ‘c‘ to cancel):1
  26. Obtaining a new certificate

成功后,在/etc/letsencrypt/live/www.xi-chuang.com/下生成4个证书:

  1. cert.pem ->
  2. chain.pem ->
  3. fullchain.pem ->
  4. privkey.pem ->

五、打开防火墙iptables的443端口

  1. -A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
  2. #service iptables restart

六、编辑ssl.conf

vi /etc/httpd/conf.d/ssl.conf

  1. # General setup for the virtual host, inherited from global configuration
  2. DocumentRoot "/var/www/html/xi-chuang.com"
  3. ServerName www.xi-chuang.com:443
  4. .
  5. .
  6. .
  7. SSLCertificateFile /etc/letsencrypt/live/www.xi-chuang.com/fullchain.pem
  8. .
  9. .
  10. .
  11. SSLCertificateKeyFile /etc/letsencrypt/live/www.xi-chuang.com/privkey.pem
  12. .
  13. .
  14. .

service httpd restart

七、这个时候网站HTTPS已经能够访问了,试一下

最后,通过.htaccess进行301转向

  1. RewriteEngine On
  2. RewriteCond %{SERVER_PORT} 80
  3. RewriteRule ^(.*)$ https://www.xi-chuang.com/$1 [R=301,L]
  4. RewriteCond %{HTTP_HOST} !^www.xi-chuang.com$ [NC]
  5. RewriteRule ^(.*)$ https://www.xi-chuang.com/$1 [L,R=301]

八、大功告成

注意:Let‘sEncrypt的证书有效期为90天,因此,建议使用cron作业在证书到期前一周将证书renew

在CentOS6,CentOS7安装 Let'sEncrypt 免费SSL安全证书

时间: 2024-12-15 01:32:44

在CentOS6,CentOS7安装 Let'sEncrypt 免费SSL安全证书的相关文章

云栖社区> > 正文 永久免费SSL安全证书Letsencrypt安装使用方法

./letsencrypt-auto certonly --standalone --email [email protected] -d thing.com -d www.thing.com 原文地址:https://www.cnblogs.com/ZHONGZHENHUA/p/8998016.html

七牛最便宜免费SSL证书TrustAsia申请教程(独家)

互联网已经开启全民SSL时代.如果你的站点还没有启用https加密访问,真得落伍了.如何获取ssl证书呢?卖ssl证书的奸商实在太多了.便宜的DV单域名ssl证书每年不足十美元,挺便宜:泛域名证书wildcard ssl每年便宜得有几千块,贵得有几万块. 如果你是个人玩家,我推荐用Let's Encrypt免费域名证书,浏览器识别度高,上手容易.你不必看网上教程自己折腾服务器代码申请,你可以直接在线申请Let's Encrypt证书.但是,本文分享的是来自七牛云存储CDN免费提供的一年单域名SS

【转】IIS - 自动申请、部署Let's Encrypt的免费SSL证书

IIS - 自动申请.部署Let's Encrypt的免费SSL证书(让网站实现HTTPS协议) 2017-12-19发布:hangge阅读:161 一.HTTPS 协议介绍 1,什么是 HTTPS 协议? HTTPS(全称:Hyper Text Transfer Protocol over Secure Socket Layer),是以安全为目标的 HTTP 通道,即 HTTP 的安全版. 简单来说 HTTPS 就是在 HTTP 上面加了一层 SSL 协议.我们可以在 HTTP 站点上部署 S

Let'sEncrypt 免费通配符/泛域名SSL证书添加使用教程

Wildcard certificate俗称野卡正式点一般称为通配符或泛域名证书,也就是为*.lnmp.org 签发包含所有子域名的SSL证书,从去年6.7月份左右就已经说过Let'sEncrypt将于2018年1月支持,但是几次放鸽子后最近终于证书支持了.通配符证书一般还是比较贵的一般最便宜的通配符证书5.60美元一年,只不过Let'sEncrypt的有效期是3个月,对于一般用户来说基本没差别. LNMP 1.5已经添加了对通配符证书的支持,生成通配符证书和Let'sEncrypt平常SSL证

nginx安装Lets Encrypt SSL免费HTTPS加密证书

Linux Nginx网站:Certbot安装配置Lets Encrypt SSL免费HTTPS加密证书 原文地址:https://renwole.com/archives/157 实验环境:CentOS Linux release 7.2内核版本:Linux version 3.10.0-514.26.2.el7.x86_64Nginx版本: Nginx-1.13.0 Let's Encrypt是一个免费的.自动化.开放的证书颁发机构.由Mozilla.Cisco.Chrome.faceboo

免费SSL证书Let's Encrypt(certbot)安装使用教程

免费SSL证书Let's Encrypt(certbot)安装使用教程 原文地址:https://www.cnblogs.com/ZHONGZHENHUA/p/9003960.html

windows server使用 LetsEncrypt-Win-Simple来安装和使用用Let's Encrypt免费SSL证书

一.网站部署 LetsEncrypt-Win-Simple可以自动发现已经部署的网站供我们选择要生成证书的网站,而且还需要进行验证.所以在生成证书之前,确保网站已经部署好并可以正常访问. 二.生成证书 软件下载地址如下: https://github.com/Lone-Coder/letsencrypt-win-simple/releases 直接下载zip压缩包就好,下载完之后解压运行里面的letsencrypt.exe打开控制台窗口,第一次运行会提示你输入一个邮箱以供后续使用. Let's 

SSL.LA免费SSL证书申请(Let&8217;sEncrypt)

SSL.LA免费SSL证书申请(Let's Encrypt) SSL.LA(加密啦)为宽大站长免费供给LetsEncrypt证书,完成5分钟快速申请.同时供给一站式证书管理平台,证书到时邮件通牒等服务,处理证书管理困苦等问题. 本来加密啦还供给过TrustAisa和AlphaSSL的免费证书,但因为AlphaSSL接口的关闭和其他缘故,关闭了这两个的申请. 1.申请途中 1.SSL.LA官网:https://www.ssl.la/ 2.进入官网,点击右上角的注册,注册一个账号 3.进入后台,找到

CentOs6和Centos7安装docker

Centos6安装的时候是按照网上的步骤, yum install -y epel-release yum install -y docker -io service docker start 失败了,说是未被识别的服务,接下来 yum remove docker yum remove docker-io vi  /etc/yum.repos.d/docker.repo 放入下面的内容 [dockerrepo] name=Docker Repository baseurl=https://yum