letsencrypt6

快速注册Let’s Encrypt SSL证书并续期

写在前面

本教程简要说明Nginx(LNMP)环境下快速注册Let’s Encrypt证书的方法并添加自动续期脚本。使用LNMP一键安装包的同学,Javen建议首先升级至LNMP1.3版本并把Nginx升级到1.9.8及以上,开启HTTP/2,注意Let’s Encrypt官方推荐首先升级Python27版本

什么是Let’s Encrypt

The project aims to make encrypted connections in the World Wide Web the default case. By getting rid of payment, web server configuration, validation emails and dealing with expired certificates it is meant to significantly lower the complexity of setting up and maintaining TLS encryption.On a Linux web server, execution of only two commands is sufficient to set up HTTPS encryption, acquire and install certificates within 20 to 30 seconds.

Let’s Encrypt 是一个将于2015年末推出的数字证书认证机构,将通过旨在消除当前手动创建和安装证书的复杂过程的自动化流程,为安全网站提供免费的SSL/TLS证书。目前免费的证书有CloudFlare的免费SSL证书,也可以参考注册沃通免费SSL证书教程

HTTPS现在已经是网站安全环境的必备条件,具有非常重要的意义。签发一个受到所有主流浏览器信任的证书就显得尤为重要。

Let’s Encrypt 是由互联网安全研究小组(ISRG,一个公益组织)提供的服务。主要赞助商包括电子前哨基金会,Mozilla基金会,Akamai以及思科。2015年4月9日,ISRG与Linux基金会宣布合作。

用以实现这一新的数字证书认证机构的协议被称为自动证书管理环境(ACME)。GitHub上有这一规范的草案,且提案的一个版本已作为一个Internet草案发布。

2015年10月19日, Let’s Encrypt已经得到了IdenTrust 的交叉签名,这意味着其证书现在已经可以被所有主流的浏览器所信任。

2015年12月3日,Let’s Encrypt正式公测。

Let’s Encrypt 宣称这一过程将十分简单、自动化并且免费。

letsencrypt7

Let’s Encrypt目前支持多域名证书。在申请的时候你可以输入你拥有的多个域名,比如我可以输入我拥有的两个域名bbs.okwoo.com、tieba.okwoo.com。但最多只能输入100个域名。通配型证书(比如*.okwoo.com)目前不被支持。

具体时间表:

The Let’s Encrypt project was started in late 2012 by two Mozilla employees, Josh Aas and Eric Rescorla. Internet Security Research Group, the company behind Let’s Encrypt, was incorporated in May of 2013. In June of 2013 a project involving the Electronic Frontier Foundation and the University of Michigan merged into the Let’s Encrypt project.

On September 14, 2015, Let’s Encrypt issued its first certificate, which was for the domain helloworld .letsencrypt .org. On the same day, ISRG submitted its root program applications to Mozilla, Microsoft, Google and Apple.

On October 19, 2015 the intermediate certificates became cross-signed by IdenTrust, causing all certificates issued by Let’s Encrypt to be trusted by all major browsers.

On November 12, 2015 Let’s Encrypt announced that general availability would be pushed back and that the first public beta will commence on December 3, 2015.

Nginx下快速安装Let’s Encrypt证书

首先在Linux服务器上安装Git:

然后,克隆Let’s Encrypt的Github repository:

开始配置:

我们需要暂时停止nginx,然后再次运行一次上面的命令:

#若需强制停止Nginx,强制停止命令

-d后为想要申请证书的对应的子域名。多个子域名可以往后续加。当命令完成时,你会看到如下消息,表示你已经成功申请到了证书。证书和密钥都保存在/etc/letsencrypt/live/yourdomain目录下。

那么你应该首先升级Python27版本

界面会要求你输入一个邮箱地址,用来接收紧急通知或者找回密钥。点击“同意”服务条款,然后输入你的域名。Let’s Encrypt支持多域名证书,所以你可以输入多个域名,但不能超过100个。注意你输入的域名的IP地址必须要指向你现在的服务器。Let’s Encrypt会通过DNS验证你的域名是否与你的服务器IP对应。输入的第一个域名是Common Name,然后全部域名都会出现在Alternative Name栏目下。

ssllets1 ssllets2你可能会看见如下错误,提示nginx进程已经在监听80端口:

letsencrypt4

 

然后,启动nginx进程:

最后,修改user/local/nginx/nginx.conf或user/local/nginx/conf/yourdomain.conf文件,添加证书文件:

重启nginx:

然后访问你的域名,期待已久的SSL证书终于可以用了!既然开启了HTTPS,建议开启HSTS,这将更加安全。

letsencrypt5

为Let’s Encrypt证书续期

因为Let’s Encrypt的证书有效期只有90天,方便起见可以使用crontab来设置定时任务。

手动续期

 

相关文章:

Wikipedia: Let’s Encrypt

HTTPS加密简介以及Nginx安装 Let’s Encrypt 免费SSL/TLS证书

网站HTTPS使用Let’s Encrypt证书

 

 

发布者

Javen

一個喜歡折騰的自由散漫又帶有幽默感的處女座完美型浪漫主義豪放派人士。

《快速注册Let’s Encrypt SSL证书并续期》有40个想法

  1. 博主,那个自动脚本更新不了呀
    提示:{
    usage:
    letsencrypt-auto [SUBCOMMAND] [options] [-d domain] [-d domain] …

    Certbot can obtain and install HTTPS/TLS/SSL certificates. By default,
    it will attempt to use a webserver both for obtaining and installing the
    cert. Major SUBCOMMANDS are:

    (default) run Obtain & install a cert in your current webserver
    certonly Obtain cert, but do not install it (aka “auth”)
    install Install a previously obtained cert in a server
    renew Renew previously obtained certs that are near expiry
    revoke Revoke a previously obtained certificate
    register Perform tasks related to registering with the CA
    rollback Rollback server configuration changes made during install
    config_changes Show changes made to server config during installation
    plugins Display information about installed plugins
    letsencrypt: error: ambiguous option: –renew could match –renew-by-default, –renew-hook

  2. 我也开启用这个了。不过还是有一些问题没有解决。必入字体是360的,不提供https。看看我的http://shanglei.net还有ssl方面的那些问题。求指点。

  3. 以后 HTTPS 是趋势,HTTP 慢慢的会被淘汰掉。之前一直关注这个,但是由于没有自己的服务器,所以一直没能使用。文章写的不错,赞一个!

    1. 公益性质的证书普及程度大,加之由多家权威组织发起,并取得著名签发机构的认证,必然兼容性良好而且值得信赖!

bookcase进行回复 取消回复

电子邮件地址不会被公开。 必填项已用*标注