我正在尝试将SSL层应用到node.js服务器。
以下是我已经完成的步骤
我的node.js代码是
var app = express();
var options = {key:fs.readFileSync('./ sslCA / server.key'),cert:fs.readFileSync('./ sslCA / server.crt'),ca:fs.readFileSync('./ sslCA / ca .crt'),requestCert:true,rejectUnauthorized:false};
app.set('port',process.env.PORT || 3000); app.set('views',__dirname +'/ views'); app.set('view engine','jade'); app.set('view options',{layout:false}); app.use(express.favicon()); app.use(express.logger( 'dev的')); app.use(express.bodyParser()); app.use(express.methodOverride());
app.use(express.static(path.join(__ dirname,'public')));
());});});});}。
当我将IE10浏览器指向本地主机时,出现错误
There is a problem with this website's security certificate. The security certificate presented by this website is not secure. Security certificate problems may indicate an attempt to fool you or intercept any data you send to the server. We recommend that you close this webpage and do not continue to this website.
当我把我的Chrome浏览器指向本地主机时,我得到错误
Invalid Server Certificate You attempted to reach localhost, but the server presented an invalid certificate
请帮我理解我做错了什么。
我解决了这个错误。
原来,从我的server.key中删除密码后,我必须重新生成服务器证书。