剛配置了下Let’s Encrypt,chrome瀏覽器里有綠條出來,看官網其它平台問題應該也不大。我還沒有研究這個工作原理,關鍵是剛花了幾千塊給公司買了個收費的證書認證。這里寫下配置過程(https://github.com/Neilpang/acme.sh):
安裝
curl https://get.acme.sh | sh
退出終端,重新進終端
用DNS模式驗證
acme.sh --issue --dns -d www.xxx.com
www.xx.com是你的域名,會返回如下信息:
[Sat Jul 2 14:12:55 CST 2016] Skip register account key
[Sat Jul 2 14:12:55 CST 2016] Creating csr
[Sat Jul 2 14:12:55 CST 2016] Single domain='www.xxx.com'
[Sat Jul 2 14:12:55 CST 2016] Verify each domain
[Sat Jul 2 14:12:55 CST 2016] Getting webroot for domain='www.xxx.com'
[Sat Jul 2 14:12:55 CST 2016] Getting token for domain='www.xxx.com'
[Sat Jul 2 14:12:58 CST 2016] Add the following TXT record:
[Sat Jul 2 14:12:58 CST 2016] Domain: _acme-challenge.www.xxx.com.com
[Sat Jul 2 14:12:58 CST 2016] TXT value: 5G3SB534HHnl1bjTa1vz1SKfF6aXMTSQFFY8HJe96BKDtl2220
[Sat Jul 2 14:12:58 CST 2016] Please be aware that you prepend _acme-challenge. before your domain
[Sat Jul 2 14:12:58 CST 2016] so the resulting subdomain will be: _acme-challenge.www.xxx.com
[Sat Jul 2 14:12:58 CST 2016] Please add the TXT records to the domains, and retry again.
給域名添加一個txt解析規則,主機記錄填_acme-challenge.www.xxx.com.com
,記錄值填5G3SB534HHnl1bjTa1vz1SKfF6aXMTSQFFY8HJe96BKDtl2220
重新驗證
待剛才配置的域名升效后,執行如下命令:
acme.sh --renew -d www.xx.com
會看到生成cert成功提示。
生成的目錄一般在 ~/acme.sh/www.xx.com 下。有了key和cert文件,我們就可以用來配置nginx ssl了。
注意項
我用 -w 模式沒有成功,不知道原因。相關的nginx也配置對了,啟用了sh debug查看相關過程,都是沒有問題了,但是最后一條驗證總是說 invalid response。