我是新来的NodeJS,我已经安装了Ubuntu上的NodeJS ,我必须从Comodo SSL证书以及当我启用了HTTPS的网站停止工作
我也跟着下面的步骤
1) Login to root account and copy the key file in SSL cert to /etc/ssl/private/private.key file.
2) Then created file called /etc/ssl/certs/STAR_cert.com.crt and paste the contents of STAR_cert_com.crt into it.
3) Then create file called /etc/ssl/certs/AddTrustExternalCARoot.crt file and paste all the contents of three files present inside "CA and Intermediate Certs" folder.
而且从那以后,我配置了我的app.js文件follwoing
var sslOptions = {
key: fs.readFileSync('/etc/ssl/private/private.key'),
cert: fs.readFileSync('/etc/ssl/certs/STAR_cert_com.crt'),
requestCert: false,
//ca: fs.readFileSync('/etc/ssl/certs/AddTrustExternalCARoot.crt'),
rejectUnauthorized: false
};
var secureServer = https.createServer(sslOptions,app).listen(443, function(){
console.log("Express server listening on port : " + app.get('port'));
console.log("Mode : " + app.get('mode'));
});
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(301, { "Location": "https://" + req.headers['host'] + req.url });
res.end();
}).listen(80);
var secureServer = https.createServer(sslOptions,app).listen(443, function(){
console.log("Express server listening on port : " + app.get('port'));
console.log("Mode : " + app.get('mode'));
});
当我跑我的网站example.com它再导向ECTS到https://example.com,给我下面的错误
> This webpage is not available
>
> DNS_PROBE_FINISHED_NXDOMAIN
但服务器控制台上没有错误。
如果我运行的网站没有HTTPS网站工作正常
任何想法?
感谢
我试过了。同样的问题。 –
您是否使用服务器IP地址代替域名获得相同的错误? –
是的。我只是出于同样的错误 –