Let’s Encrypt免费https证书的使用

SSL免费证书的使用

工具:certbot-auto

操作步骤:
停止nginx : ./nginx -s stop
生成证书: ./certbot-auto certonly --standalone --email 你的邮箱地址 -d 你的域名1 -d 你的域名2
重启nginx: ./nginx

---------------具体步骤----------------------------------
假设运行环境为centos7.1,Web 服务器是 Nginx 1.12.0(因为我的生产环境是),当前工作目录为 /root

1.获取certbot客户端
wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto

2.停止nginx
service nginx stop

3.生成证书
./certbot-auto certonly --standalone --email ***@163.com -d 你的域名

当前网站有多个域名时需在后面增加,例如
./certbot-auto certonly --standalone --email 你的邮箱地址 -d 你的域名1 -d 你的域名2

4.查看生产的证书
tree /etc/letsencrypt/live/

5.将证书用于nginx,在nginx网站配置文件中增加
ssl_certificate /etc/letsencrypt/live/www.just4fun.site/fullchain.pem;#证书位置
ssl_certificate_key /etc/letsencrypt/live/www.just4fun.site/privkey.pem;# 证书位置

6.启动nginx
service nginx start

至此https配置完成

证书续签
Let’s Encrypt 生成的免费证书为3个月时间,但是我们可以无限次续签证书
./nginx -s stop
./certbot-auto renew --force-renewal
./nginx

通配符证书申请(Let’s encrypt通配符证书只是针对二级域名)
./certbot-auto certonly -d “*.ab.io” --manual --preferred-challenges dns-01 --server https://acme-v02.api.letsencrypt.org/directory
配置过程中需要对域名进行解析,具体步骤请查看 https://www.jianshu.com/p/c5c9d071e395

猜你喜欢

转载自blog.csdn.net/qq_35331140/article/details/86478073