为什么要使用Letsencrypt做SSL certificate?

最简单直接的原因是免费。但是免费存在是否靠谱的问题,尤其是对安全要求比较高的网站,需要考虑使用letsencrypt的安全性是否符合你的标准。本文旨在介绍怎么使用letsencrypt做SSL certificate,或者说是letsencrypt学习笔记更适合,对其适用场景没有做过多研究。

从git上下载letsencrypt到服务器上

$ git clone https://github.com/letsencrypt/letsencrypt

进到letsencrypt目录下,使用一下命令来创建以及安装CA

$ ./letsencrypt-auto certonly
$ ./letsencrypt-auto --apache -d domainName

CA的一些文件在 /etc/letsencrypt 目录下。

这样就可以以https方式访问你指定的域名了。

但是,网站内可能存在一些http请求,浏览器会报错并加载不成功。这里,我的做法是将站内所有的http请求重定向到https请求。我们需要修改apache2的配置文件。

打开000-default.conf文件,

/etc/apache2/sites-enabled/-default.conf

加上

RewriteEngine On
RewriteRule ^/(.*)$ https://domainname/$1 [R,L]

修改tomcat下的server.xml文件

<Connector URIEncoding="UTF-8" port="" protocol="HTTP/1.1"
connectionTimeout=""
compression="on"
compressionMinSize=""
compressableMimeType="application/json,application/javascript,application/xml,image/gif,image/png,text/css,text/html,text/javascript,text/plain,text/xml"
redirectPort=""
proxyPort = "" scheme="https"/>

这样网站所有的请求都指向https请求了。

letsencrypt默认30天内有效,但有renew的命令可以在letsencrypt过期之后更新CA。自动更新CA的脚本如下

#!/bin/sh
if ! /path/to/letsencrypt-auto renew > /var/log/letsencrypt/renew.log >& ; then
echo Automated renewal failed:
cat /var/log/letsencrypt/renew.log
exit
fi

需要在服务器上定期执行这个脚本,可以使用crontab。

使用Letsencrypt做SSL certificate的更多相关文章

  1. 用 letsencrypt 生成 SSL 证书

    letsencrypt 生成 SSL 证书 事先配置好访问域名解析 在nginx 对应虚拟主机添加一个验证区域: 配置 nginx server { listen 80; ... location ~ ...

  2. How To Create a SSL Certificate on Apache for CentOS 6

    About Self-Signed Certificates 自签证书.一个SSL证书,是加密网站的信息,并创建更安全的链接的一种方式.附加地,证书可以给网站浏览者显示VPS的的身份证明信息.如果一个 ...

  3. last error : SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate veri

    今天在用搜狐提供的邮件群发系统的sdk,做发送邮件的测试时,提示: last error : SSL certificate problem, verify that the CA cert is O ...

  4. curl: (60) SSL certificate problem: unable to get local issuer certificate 错误

    今天同事做微信管理的项目,请求接口返回如下错误SSL certificate problem: unable to get local issuer certificate. 此问题的出现是由于没有配 ...

  5. PySpider 框架爬虫错误 HTTP 599: SSL certificate problem: unable to get local issuer certificate解决方案

    首先pyspider all启动pyspider的所有服务,然后访问http://localhost:5000创建一个爬虫任务:taobaomm,点开任务链接编辑http://localhost:50 ...

  6. 使用 OpenSSL为WindowsServer远程桌面(RDP)创建自签名证书 (Self-signed SSL certificate)

    前言 笔者查阅很多资料,才写成此文章,如有错误,请读者们及时提出. 一般大家使用远程桌面(Remote Desktop)连接Windows Server时,总会有一个警告提示,如图1 图1 出现此警告 ...

  7. ...cURL error 60: SSL certificate problem: unable to get local issuer certificate...

    问题描述: 在做PHP爬虫的时候, 安装了 guzzle 和 dom-crawler 之后, 调用的时候出现问题, 如下 报错内容:  Fatal error: Uncaught GuzzleHttp ...

  8. SSL certificate problem unable to get local issuer certificate解决办法

    SSL certificate problem unable to get local issuer certificate 解决办法: 下载:ca-bundle.crt 将它放在自己的wamp或者x ...

  9. How To Set Up Apache with a Free Signed SSL Certificate on a VPS

    Prerequisites Before we get started, here are the web tools you need for this tutorial: Google Chrom ...

随机推荐

  1. DELPHI 小结

    //十六进制(S)-->>十进制(I)  [重写:Jey]function hextoint(s: string): Integer; begin           //$代表16进制  ...

  2. 精通Groovy

    https://www.ibm.com/developerworks/cn/education/java/j-groovy/j-groovy.html https://juejin.im/entry/ ...

  3. 故障排除:无法启动、访问或连接到 Azure 虚拟机上运行的应用程序

    有多种原因可导致无法启用或连接到在 Azure 虚拟机 (VM) 上运行的应用程序.原因包括应用程序未在预期端口上运行或侦听.侦听端口受到阻止,或网络规则未将流量正确传递到应用程序.本文说明有条理地找 ...

  4. tcp.cc

    ns2-tcp-tcp.cc /* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */ /* * Copyri ...

  5. linux下查看数据库版本的5中方法

    1.在Linux终端窗口中,输入mysql -V查看MySQL版本信息[sky@qin ~]# mysql -Vmysql  Ver 14.14 Distrib 5.1.29-rc, for pc-l ...

  6. 文本处理三剑客之 grep

    grep简介 grep(Global search REgular expression and Print out the line)是Linux上的文本处理三剑客之一,另外两个是sed和awk. ...

  7. .NET事务

    概述 事务ACID特性 事务将一系列的工作视为一个工作单元,它具有 ACID 特性: A:Atomicity 不可分性也就是说事务中有多项工作,如果有一项工作失败了,整个事务就算失败了. C:Cons ...

  8. S/4HANA服务订单Service Order的批量创建

    我工作中接到一个任务,需要在性能测试系统里创建一亿条服务订单service order来做性能测试. 这么大规模的数据量,当然只能用代码来创建了. 本文提到的所有ABAP代码,我均已上传到我的Gith ...

  9. Ubuntu Tweak (linux下的优化大师)

    Ubuntu Tweak 是中国人开发的一款专门为Ubuntu准备的配置.调整工具,它类似与compiz,但是界面更友好. 下面是安装命令: 第一步:添加tweak源 sudo add-apt-rep ...

  10. Android中跑马灯效果

    <com.randy.test1.self.MarqueeText android:id="@+id/btn1" android:layout_width="mat ...