用于Golang ListenAndServeTLS的Letsencrypt证书输出

用于Golang ListenAndServeTLS的Letsencrypt证书输出

问题描述:

Lets'Encrypt provided me with a "Signed Certificate" and an "Intermediate Certificate". I had to create a private key domain.key for the domain before.

Now ListenAndServeTLS expects a certificate and a key file.

I guess the "keyfile" is the locally generated domain.key file but what do I do with a "Signed Certificate" and an "Intermediate Certificate" if ListenAndServeTLS expects two files?

Lets'Encrypt为我提供了“签名证书”和“中间证书”。 我之前必须为该域创建一个私钥domain.key。 p>

现在 ListenAndServeTLS 需要一个证书和一个密钥文件。 p>

我猜“密钥文件”是本地生成的domain.key文件,但是我该怎么做呢? 如果ListenAndServeTLS需要两个文件,则“签名证书”和“中间证书”? p> div>

As with most http servers, the Go tls server implementation only accepts a single file for the certificate. From the net/http documentation:

If the certificate is signed by a certificate authority, the certFile should be the concatenation of the server's certificate, any intermediates, and the CA's certificate.

All you need to do is concatenate the files together.