在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
一、升级系统
- # yum -y update
二、安装EPEL库,为CertBot提供最新的Python包。
- # yum -y install epel-release
三、下载CertBot
1、CentOS7:
- # yum -y install python-certbot-apache
2、CentOS6:
- # wget https://dl.eff.org/certbot-auto
- # chmod 755 certbot-auto
四、Apache下配置Let's Encrypt
执行下条命令
- # ./certbot-auto --apache
根据提示操作
- /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
- DeprecationWarning
- 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.1.1-August-1-2016.pdf. You must agree
- in order to register with the ACME server at
- https://acme-v01.api.letsencrypt.org/directory
- -------------------------------------------------------------------------------
- (A)gree/(C)ancel: A
- -------------------------------------------------------------------------------
- Would you be willing 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 EFF and
- our work to encrypt the web, protect its users and defend digital rights.
- -------------------------------------------------------------------------------
- (Y)es/(N)o: Y
- Which names would you like to activate HTTPS for?
- -------------------------------------------------------------------------------
- 1: www.xi-chuang.com
- -------------------------------------------------------------------------------
- Select the appropriate numbers separated by commas and/or spaces, or leave input
- blank to select all options shown (Enter 'c' to cancel):1
- Obtaining a new certificate
成功后,在/etc/letsencrypt/live/www.xi-chuang.com/下生成4个证书:
- cert.pem ->
- chain.pem ->
- fullchain.pem ->
- privkey.pem ->
五、打开防火墙iptables的443端口
- -A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
- #service iptables restart
六、编辑ssl.conf
vi /etc/httpd/conf.d/ssl.conf
- # General setup for the virtual host, inherited from global configuration
- DocumentRoot "/var/www/html/xi-chuang.com"
- ServerName www.xi-chuang.com:443
- .
- .
- .
- SSLCertificateFile /etc/letsencrypt/live/www.xi-chuang.com/fullchain.pem
- .
- .
- .
- SSLCertificateKeyFile /etc/letsencrypt/live/www.xi-chuang.com/privkey.pem
- .
- .
- .
service httpd restart
七、这个时候网站HTTPS已经能够访问了,试一下
最后,通过.htaccess进行301转向
- RewriteEngine On
- RewriteCond %{SERVER_PORT} 80
- RewriteRule ^(.*)$ https://www.xi-chuang.com/$1 [R=301,L]
- RewriteCond %{HTTP_HOST} !^www.xi-chuang.com$ [NC]
- RewriteRule ^(.*)$ https://www.xi-chuang.com/$1 [L,R=301]
八、大功告成
注意:Let'sEncrypt的证书有效期为90天,因此,建议使用cron作业在证书到期前一周将证书renew
在CentOS6,CentOS7安装 Let'sEncrypt 免费SSL安全证书的更多相关文章
- 去freessl.org申请免费ssl服务器证书
去freessl.org申请免费ssl服务器证书 来源: 本文链接 来自osnosn的博客 写于: 2019-03-30. 想搞个自签名证书,可以参考这篇: 用openssl为WEB服务器生成证书(自 ...
- 申请安装阿里云免费SSL证书
微信小程序已经全面要求使用HTTPS服务了,还有苹果商店也是,所以,实现网站HTTPS已经很有必要.要实现HTTPS就需要一个SSL证书,证书大部分都很贵,不过也有一些免费的证书服务供个人开发者使用. ...
- centos6 / centos7 安装apache
=================centos6.1 安装apache===================== 安装: yum -y install httpd 启动 /etc/init.d/htt ...
- 免费 SSL 安全证书
为了保证网上传输信息的安全而在自己的 Linode VPS 上部署 SSL 加密服务.商业 CA 较贵,所以使用了自己签发的 CA.网友神爱的留言提到了 StartSSL 的免费 CA,稍做了一些调查 ...
- 云栖社区> > 正文 永久免费SSL安全证书Letsencrypt安装使用方法
./letsencrypt-auto certonly --standalone --email admin@thing.com -d thing.com -d www.thing.com
- 【转】IIS - 自动申请、部署Let's Encrypt的免费SSL证书
IIS - 自动申请.部署Let's Encrypt的免费SSL证书(让网站实现HTTPS协议) 2017-12-19发布:hangge阅读:161 一.HTTPS 协议介绍 1,什么是 HTTP ...
- IIS - 自动申请、部署Let's Encrypt的免费SSL证书(让网站实现HTTPS协议)
IIS - 自动申请.部署Let's Encrypt的免费SSL证书(让网站实现HTTPS协议) 2017-12-19发布:hangge阅读:161 一.HTTPS 协议介绍 1,什么是 HTTP ...
- Let'sEncrypt 免费通配符/泛域名SSL证书添加使用教程
Let'sEncrypt 免费通配符/泛域名SSL证书添加使用教程 通配符证书一般还是比较贵的一般最便宜的通配符证书5.60美元一年,只不过Let'sEncrypt的有效期是3个月,对于一般用户来说基 ...
- LNMP安装Let’s Encrypt 免费SSL证书方法:自动安装与手动配置Nginx
前几天介绍了最新StartSSL免费SSL申请与配置,很多人看到部落介绍SSL证书安装时总是推荐了OneinStack,因为OneinStack提供了一键添加和配置Let's Encrypt 免费SS ...
随机推荐
- 洛谷 P1993 小K的农场
P1993 小K的农场 题目描述 小K在MC里面建立很多很多的农场,总共n个,以至于他自己都忘记了每个农场中种植作物的具体数量了,他只记得一些含糊的信息(共m个),以下列三种形式描述: 农场a比农场b ...
- Material-design icon生成插件
在使用android studio开发android应用的过程.会遇到一些非常不错的插件,当中android-material-design-icon-generator-plugin 是一个Mate ...
- Flex 绘制圆形并填充图片
注意:Ellipse 绘制椭圆,当width = height 时 则绘制圆形. BitmapFill:填充图片 <s:Group id="gpimgUser" width= ...
- ios学习之旅---指针也不难
1.认识指针 #include <stdio.h> //基本数据类型作为函数參数传递是值传递 //void moveFront(int x ,int y) //{ // x = x + 2 ...
- LeetCode 680. Valid Palindrome II (验证回文字符串 Ⅱ)
Given a non-empty string s, you may delete at most one character. Judge whether you can make it a pa ...
- football statistics
https://www.whoscored.com/Players/24328/Show/Edinson-Cavani
- android5.1 Recovery添加从U盘升级功能【转】
本文转载自:http://blog.csdn.net/tfslovexizi/article/details/73835594 之前看到过一个人写了4.4上添加U盘升级功能的博客http://blog ...
- sqlserver 触发器实例代码
定义: 何为触发器?在SQL Server里面也就是对某一个表的一定的操作,触发某种条件,从而执行的一段程序.触发器是一个特殊的存储过程. 常见的触发器有三种:分别应用于Insert , Update ...
- Luogu[SDOI2008]Sue的小球
题目描述 Sue和Sandy最近迷上了一个电脑游戏,这个游戏的故事发在美丽神秘并且充满刺激的大海上,Sue有一支轻便小巧的小船.然而,Sue的目标并不是当一个海盗,而是要收集空中漂浮的彩蛋,Sue有一 ...
- Linux搭建tomcat文件服务器
Linux搭建tomcat文件服务器 Linux下配置Tomcat服务器和Windows下其实差不多,可以去官网下载安装包释放或者在线下载,只是当时下载的windows.zip文件,现在下载.tar. ...