为什么要使用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. web安全-XSS

    了解XSS的定义 跨站脚本攻击(Cross Site Scripting),为了不和层叠样式表(Cascading Style Sheets, CSS)的缩写混淆,故将跨站脚本攻击缩写为XSS.恶意攻 ...

  2. python 小词云

    # Author:Alex.wang# Date:2017.06.02# Version:3.6.0 import matplotlib.pyplot as pltfrom wordcloud imp ...

  3. c#编程指南(五) 扩展方法(Extension Method)

    C# 3.0就引入的新特性,扩展方法可以很大的增加你代码的优美度,扩展方法提供你扩展.NET Framewoke类的扩展途径,书写和规则也简单的要命. 编写扩展方法有下面几个要求: 第一:扩展方法所在 ...

  4. 高精度定时器实现 z

    1背景Permalink .NET Framework 提供了四种定时器,然而其精度都不高(一般情况下 15ms 左右),难以满足一些场景下的需求. 在进行媒体播放.绘制动画.性能分析以及和硬件交互时 ...

  5. python全栈学习笔记(三)网络基础之网络设备及架构介绍

       

  6. Python学习---远程执行命令

    原则:发送一个接受一个 原理:发送执行命令的大小给客户端,客户端根据接受的大小判断是否全部接收了服务器sendall()发送的全部 利用send发送的全部数据都是bytes类型的,需要进行字符编码的转 ...

  7. How to import .sql script

    How to import .sql script 1.Export .sql from pl/sql developer you can reference to other document in ...

  8. SAP Cloud for Customer Account和individual customer的区别

    在SAP Cloud for Customer的Customers工作中心里,有三个视图:Accounts,Contacts和Individual Customers. 这三种主数据的区别是什么?我们 ...

  9. 浅聊IOC

    1.概述 IOC:有很多人把控制反转和依赖注入混为一谈,虽然在某种意义上来看他们是一体的,但好像又有些不同. 1. IOC(控制反转)是一个控制容器,DI(依赖注入)就是这个容器的运行机制. 2. I ...

  10. xwork-2.1.2.jar与xwork-core-2.1.6.jar的区别是什么? 在线等待 先谢谢了

    两个包是一样,都是struts2的核心包.不过有时下在的struts2的jar包中只有xwordk-core-2.1.6.jar包.做项目的时候最好两个都导入.