问题描述
我正在通过GoDaddy设置SSL,以与AWS EC2上的node.js服务器一起使用.我一直无法使它正常工作.
I'm working to setup a SSL via GoDaddy to use with my node.js server on AWS EC2. I've been unable to get it to work.
这是我尝试过的:
打算用于域:files.mysite.com
Intended for the domain: files.mysite.com
在我运行的服务器上:
$ openssl req -new -newkey rsa:2048 -nodes -keyout files.mysite.key -out files.mysite.csr
Common Name: files.mysite.com
password: left empty
然后我得到CSR:vim files.mysite.csr
I then get the CSR: vim files.mysite.csr
我从以下位置复制并粘贴:
I copy and paste from:
-----BEGIN CERTIFICATE-----
......... lots of stuff
-----END CERTIFICATE-----
最后还有一个空行,我将其留下并使用密钥重新粘贴到GoDaddy界面中.
There is an extra empty line at the end, which I leave and paste into the GoDaddy interface using rekey.
然后我下载高迪密钥,该密钥提供:
I then download the godaddy key which provides:
gd_bundle.crt
files.mysite.com.crt
然后在节点中插入:
key: fs.readFileSync('server.key').toString(),
cert: fs.readFileSync('server.crt').toString()
鉴于GoDaddy提供了两个crt文件,我不确定是什么server.key或server.crt?
你能帮我吗?
I'm not sure what server.key is or server.crt given that GoDaddy provides two crt files?
Can you help?
推荐答案
GoDaddy使用中间证书对您的证书进行签名.这对您和GoDaddy都有很多好处.但是要使它正常工作需要更多的工作(只是有点儿,几乎是在谷歌搜索).
GoDaddy uses an intermidiate certificate to sign your certificate. This has several advantages to both you and GoDaddy. But it takes a bit more work to get it to work (just a bit, mostly googling around).
在node.js中,您可以像这样安装它们:
In node.js you can install them like this:
require('https').createServer({
key: fs.readFileSync('files.mysite.com.key'),
cert: fs.readFileSync('files.mysite.com.crt'),
ca: [fs.readFileSync('gd_bundle.crt')] // <----- note this part
}, app).listen(443);
这篇关于生成SSL密钥以与node.js一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!