第一步
打开 SSL For Free网站https://www.sslforfree.com ,在输入框中填入你要申请 Let’s Encrypt 凭证的网域名称,可以用空白来分隔不同的网址,例如[subdomain.domain.com domain.com other.com](这个没试过),输入后点选右边的[Create Free SSL Certificate]继续。
![这里写图片描述]
(https://images.gitee.com/uplo... "20170517164046782.png")
第二步
提供了三种验证网站的方式,此处选择使用手动的验证方式,即[Manually Verification]:点选下方的[Manually Verify Domain]继续。
第三步
按照手工验证的步骤说明[Upload Verification Files]依次操作,
1.点击 第 步骤1 中的 Download File #1 链接下载验证文件
2.上传验证文件到服务器,确认步骤5中的链接能正常访问后,点击
[Download SSL Certificate]。
第四步
如果通过验证后,就会开始为生成所申请网站 SSL 凭证。当凭证生成后,可以看到[Get Notified of Expiration],由于申请的凭证有效期只有90天,所以可以在此设定一组 Email 和密码,即可在凭证过期前(一周左右)取得通知,以免错过延长(renew)时间。
点击[Download All SSL Certificate Files]下载凭证文件压缩包,解压缩后可以看到private.key、ca_bundle.crt 和 certificate.crt 三个文件!
第五步
修改域名配置(以nginx为例)
http跳转到https配置
server {
listen 80;
server_name my.domain.com;
index index.html;
return 301 https://servernameservernamerequest_uri;
}
server {
listen 443 ssl;
server_name my.domain.com;
index index.html;
access_log logs/access_my_domain_com.log;
ssl_certificate /etc/ssl/my_domain_com/certificatet.crt;#对应压缩包里的certificatet.crt
ssl_certificate_key /etc/ssl/my_domain_com/private.key;#对应压缩包里的private.key
location / {
root /opt/vhosts/my_domian_com;
}
}
http,https同时可以访问配置
server {
listen 80;
listen 443 ssl;
server_name my.domain.com;
index index.html;
ssl_certificate /etc/ssl/my_domain_com/certificatet.crt;#对应压缩包里的certificatet.crt
ssl_certificate_key /etc/ssl/my_domain_com/private.key;#对应压缩包里的private.key
access_log logs/access_my_domain_com.log;
location / {
root /opt/vhosts/my_domian_com;
}
}
验证修改后的配置文件是否正确
$ ./nginx -t -c /usr/local/nginx/conf/nginx.conf
the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok#验证通过
./nginx -s reload #重新加载nginx配置
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。