版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/madonghyu/article/details/82995850
最近由于想要同时部署多个服务到自己的主机上,而自己又懒得记ip地址,所以想要用子域名来代替,。,
这里安装的certbot是针对centos的,安装教程由certbot提供
按照上面的教程安装完之后,主机会增加certbot
命令,运行命令
certbot certonly -d *.域名 --manual --preferred-challenges dns --server https://acme-v02.api.letsencrypt.org/directory
按照提示确认,之后会出现DNS TXT验证
Please deploy a DNS TXT record under the name
_acme-challenge.域名 with the following value:
pbE8J3xMqc6AuyI1EcM70cpUCeXT91ubqu5LQrD_KHc
Before continuing, verify the record is deployed.
注意这里不要直接按回车。。。。。。
这个时候你需要打开你使用的域名解析的网站,如腾讯云,阿里云等,这里以腾讯云为例
接下来可以运行下面的命令,来实时检测自己的配置是否生效
watch -d -n 2 dig -t txt _acme-challenge.域名 @8.8.8.8
出现下面的;; ANSWER SECTION:
的内容即为配置生效,按下回车即可生成证书
Every 2.0s: dig -t txt _acme-challenge.madongyu.ml ... Sat Oct 13 10:44:00 2018
; <<>> DiG 9.9.4-RedHat-9.9.4-61.el7_5.1 <<>> -t txt _acme-challenge.madongyu.ml
@8.8.8.8
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17549
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;_acme-challenge.madongyu.ml. IN TXT
;; ANSWER SECTION:
_acme-challenge.madongyu.ml. 537 IN TXT "OslTGuM0ETDx6S1Shwje5NZoj-MgR14
IB94JpoG8tdk"
;; Query time: 108 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: 六 10月 13 10:44:00 CST 2018
;; MSG SIZE rcvd: 112