letsencrypt免費https(*.yourdomain.com)泛域名證書申請

letsencrypt免費https泛域名(*.yourdomain.com)證書申請

安裝環境CentOS
*.example.com形式的域名即爲泛域名,不通的子域名共用一個證書,省去多次申請的煩惱

1. 工具安裝

安裝最新的certbot
sudo yum install -y certbot
已安裝cerbot,需升級至高版本
sudo yum update -y certbot

2. 證書申請

將*.yourdomain.com 替換成你的泛域名
運行命令:
sudo certbot certonly --preferred-challenges dns --manual -d *.yourdomain.com --server https://acme-v02.api.letsencrypt.org/directory
出現以下內容後,請在阿里云云解析中添加一條TXT解析記錄

Please deploy a DNS TXT record under the name
_acme-challenge.yourdomain.com with the following value: 

xxxxx  

Before continuing, verify the record is deployed.

添加阿里云云解析TXT解析記錄
添加阿里云云解析TXT解析記錄

3. 證書使用(nginx)

/etc/nginx/conf.d中新增配置文件xx.conf: 添加server節點配置並設置獲取到大證書地址
在這裏插入圖片描述

4. 證書自動更新

letsencrypt的證書有效期是三個月,可設置crontab自動任務進行更新

30 1 10 * * /usr/bin/certbot renew && /usr/sbin/nginx -s reload # 每月10日1點30分執行一次
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章