为什么要使用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. unity中Animation与Animator的区别

    Animation:单一动画,一般使用在单一动画播放.占用资源小. Animator:多个动画,可用控制器切换多个动画播放.占用资源大.

  2. day14 HTML CSS

    HTML HTML是英文Hyper Text Mark-up Language(超文本标记语言)的缩写,他是一种制作万维网页面标准语言(标记).相当于定义统一的一套规则,大家都来遵守他,这样就可以让浏 ...

  3. android测试Code

    <!--android:layout_alignParentTop="true"--><com.koooke.platform.View.CenterImage ...

  4. Android学习——Service(一)

    这篇博文来介绍Android另一个十分重要的组件,Service.Service和Activity很类似,区别在于它运行在后台,不可见且没有界面.Service的优先级高于Activity,当系统负载 ...

  5. bootstrap colorscheme以及theme自动生成

    http://paintstrap.com/ 是一个根据adobe kuler color scheme自动生成theme 的工具,比较直观好用,对于调整前端theme有一定参考意义

  6. linux下生成带符号的随机密码

    cat /dev/urandom |tr -dc "[:graph:]"|fold -w 15|head 结果如下:

  7. ASP.NET Core - 中间件与管道(1)

    今天来讨论一个ASP.NET Core 很重要概念管道和中间件,在ASP.NET Core中,针对HTTP请求采用pipeline也就是通常说的管道方式来处理,而管道容器内可以挂载很多中间件(处理逻辑 ...

  8. 第三周 day3 python学习笔记

    1.字符串str类型,不支持修改. 2.关于集合的学习: (1)将列表转成集合set:集合(set)是无序的,集合中不会出现重复元素--互不相同 (2)集合的操作:交集,并集.差集.对称差集.父集.子 ...

  9. Ubuntu查看版本信息

    关于查看Ubuntu的版本信息,我们会用到两个命令uname和cat. uname命令 这个命令用于显示系统信息.其参数为: -a 显示所有系统信息.其中包括机器名.操作系统名.内核名称等. 以下为执 ...

  10. 【java基础】随手写的一个日期计算,新手可以看看

    随手写的一个例子, 只是练习下自己的代码布局以及思路.. 1. 先写下简单的测试 2. 根据常用的不用修改的变量抽取出来, 作为常量(常量的命名可能有点不规范,谅解~) 3. 方法的作用不一样, 抽取 ...