红联Linux门户
Linux帮助

申请Let’s Encrypt通配符HTTPS证书

发布时间:2018-04-03 14:56:14来源:开源中国作者:飞奔的萝卜
Let's Encrypt 发布的 ACME v2 现已正式支持通配符证书,接下来将为大家介绍怎样申请,Let's go.
本教程是在centos 7下操作的,其他Linux系统大同小异。
 
1.获取certbot-auto
# 下载
wget https://dl.eff.org/certbot-auto
# 设为可执行权限
chmod a+x certbot-auto
 
2.开始申请证书
# 注xxx.com请根据自己的域名自行更改
./certbot-auto --server https://acme-v02.api.letsencrypt.org/directory -d "*.xxx.com" --manual --preferred-challenges dns-01 certonly
执行完这一步之后,会下载一些需要的依赖,稍等片刻之后,会提示输入邮箱,随便输入都行
申请Let’s Encrypt通配符HTTPS证书
注意,申请通配符证书是要经过DNS认证的,按照提示,前往域名后台添加对应的DNS TXT记录。添加之后,不要心急着按回车,先执行dig xxxx.xxx.com txt确认解析记录是否生效,生效之后再回去按回车确认。
申请Let’s Encrypt通配符HTTPS证书
到了这一步后,大功告成!证书存放在/etc/letsencrypt/live/xxx.com/里面
要续期的话,执行certbot-auto renew就可以了
申请Let’s Encrypt通配符HTTPS证书
 
下面是一个nginx应用该证书的一个例子
server {
server_name xxx.com;
listen 443 http2 ssl;
ssl on;
ssl_certificate /etc/cert/xxx.cn/fullchain.pem;
ssl_certificate_key /etc/cert/xxx.cn/privkey.pem;
ssl_trusted_certificate  /etc/cert/xxx.cn/chain.pem;
location / {
proxy_pass http://127.0.0.1:6666;
}
}
 
gitlab同步代码时https证书错误:http://www.linuxdiyf.com/linux/27034.html
HTTPS证书安装 - 安装到Ubuntu上的Apache 精简步骤:http://www.linuxdiyf.com/linux/18832.html
解决阿里云SLB无法添加https证书的问题:http://www.linuxdiyf.com/linux/16984.html
如何使用lftp来加速ftp/https下载速度:http://www.linuxdiyf.com/linux/33250.html
在Nginx上正确启用HTTPS,Let’s Encrypt在Ubuntu上进行加密:http://www.linuxdiyf.com/linux/33045.html