为什么要使用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. idea 多项目部署碰到的问题

    在使用idea部署多个maven项目的时候,出现了各种坑.一天的时间有一半的时间花在了部署环境.运行环境上.把遇到的坑记录下 1.引入maven的依赖包 当项目多的时候,为了加速项目的开发,习惯性的把 ...

  2. 如何阅读 Redis 源码?ZZ

    原文链接 在这篇文章中, 我将向大家介绍一种我认为比较合理的 Redis 源码阅读顺序, 希望可以给对 Redis 有兴趣并打算阅读 Redis 源码的朋友带来一点帮助. 第 1 步:阅读数据结构实现 ...

  3. Oracle案例03——RMAN-06091: no channel allocated for maintenance (of an appropriate type)

    同事收到告警磁盘空间不足,说删除归档无法直接在rman中进行操作,让帮看下,具体处理方法如下: 一.错误信息 在rman执行命令 crosscheck archivelog all; delete n ...

  4. Bash命令行 bash &> >& Bash One-Liners Explained

    Bash One-Liners Explained, Part I: Working with files https://catonmat.net/bash-one-liners-explained ...

  5. npm创建react项目

    1:win+R 输入cmd ,打开cmd面板 2:安装cnpm npm install -g cnpm --registry=https://registry.npm.taobao.org 3:安装r ...

  6. 稳定sqlplan方法

    参考文档:SQLT (SQLTXPLAIN) - Tool that helps to diagnose SQL statements performing poorly [ID 215187.1]

  7. hdu-4135 Co-prime---容斥定理经典&&求1-m中与n互质的数目

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4135 题目大意: 求区间[a, b]中与N互质的数目. 解题思路: 首先对n求出所有素因子. 对于区 ...

  8. springmvc使用map接收form表单的参数

    其实只需要在map前面加上@RequestParam参数即可,jsp的name等都不变 public String queryByCondition(@RequestParam Map<Stri ...

  9. 20145238-荆玉茗《网络对抗技术》MSF基础应用

    20145238荆玉茗-<网络攻防>-MSF基础应用 实践过程 MS08_067漏洞渗透攻击实践(主动攻击) 实验工具: kali&windows xp 将xp的网络设为NAT模式 ...

  10. 装饰模式案列(OutputStream)

    使用装饰模式进行装饰OutputStream 写入文件成功 装饰类继承OutputStream类 DecorOutputStream package com.wbg.springRedis.decor ...