尝试遵循有关创建自签名证书以使用本地主机的各种说明,大多数说明似乎适用于IIS,但我正在尝试使用Nodejs / Express。没有一个工作正常,因为在安装证书时,它不被信任。以下是我尝试过的失败:
Trying to follow various instructions on creating a self-signed cert for use with localhost, Most of the instructions seem to be for IIS, but I'm trying to use Nodejs/Express. None of them work properly because while the cert gets installed, it is not trusted. here's what I've tried that fails:
- 如何为本地主机创建自签名证书
- https:// www.digitalocean/community/articles/how-to-create-a-ssl-certificate-on-nginx-for-ubuntu-12-04/
- blogs.developerforce/开发者关系/ 2011/05 / generate-valid-self-signed-certificates.html
- www.robbagby/iis/self-已登录证书上-IIS-7最容易的方式和 - 的最有效的单向/
- How can I create a self-signed cert for localhost?
- www.digitalocean/community/articles/how-to-create-a-ssl-certificate-on-nginx-for-ubuntu-12-04/
- blogs.developerforce/developer-relations/2011/05/generating-valid-self-signed-certificates.html
- www.robbagby/iis/self-signed-certificates-on-iis-7-the-easy-way-and-the-most-effective-way/
有人可以提供可以做到这一点的工作流吗? 我可以安装证书,但我无法使用chrome(v32)或IE(v10)信任证书。
Can someone offer a workflow that can do this? I can get a cert installed, but I can't get the cert to be trusted in either chrome (v32) or IE (v10).
编辑:在评论中建议问题是不信任的证书根。我通过IE安装了证书,但它仍然不被信任。
it was suggested in comments that the problem is no trusted cert-root. I installed the cert via IE but it's still not being trusted.
推荐答案您可以尝试使用openSSL生成证书。 看看这个。
You can try openSSL to generate certificates. Take a look at this.
您将需要一个.key和.crt文件将HTTPS添加到节点JS express服务器。一旦你生成这个,使用这个代码来添加HTTPS到服务器。
You are going to need a .key and .crt file to add HTTPS to node JS express server. Once you generate this, use this code to add HTTPS to server.
var https = require('https'); var fs = require('fs'); var express = require('express'); var options = { key: fs.readFileSync('/etc/apache2/ssl/server.key'), cert: fs.readFileSync('/etc/apache2/ssl/server.crt'), requestCert: false, rejectUnauthorized: false }; var app = express(); var server = https.createServer(options, app).listen(3000, function(){ console.log("server started at port 3000"); });这在我的本地机器以及我部署过的服务器中正常工作。我在服务器中的一个是从goDaddy购买的,但是localhost有一个自签名证书。
This is working fine in my local machine as well as the server where I have deployed this. The one I have in server was bought from goDaddy but localhost had a self signed certificate.
然而,每个浏览器都会出现一个错误,表示连接不受信任,你想要继续。点击继续后,它工作正常。
However, every browser threw an error saying connection is not trusted, do you want to continue. After I click continue, it worked fine.
如果有人绕过了带有自签名证书的错误,请启示。
If anyone has ever bypassed this error with self signed certificate, please enlighten.
更多推荐
为localhost创建受信任的自签名SSL证书(用于Express / Node)
发布评论