生成EV证书到nodeJS服务器

时间:2021-01-25 17:05:39

标签: javascript node.js angularjs ssl certificate

大家好,我有一个托管在 GoDaddy 上的 angularJS 项目,我还有服务器端使用来自 GoDaddy 的 Gen4 VPS Linux 的 nodeJS ...... 我的项目中有一个问题,当我向服务器发送请求时,我被拒绝,因为服务器是自签名证书,我需要接受浏览器才能登录服务器, 有人可以帮我获得一个证书,允许我向服务器发送请求而不被浏览器接受吗?

const express = require('express');
const cors = require('cors');
var sql = require("mssql");
const app = express();
const bodyParser = require("body-parser");
const https = require("https");
const path = require("path");
const fs = require("fs")

app.use(cors())
app.use(express.json()) 

app.use(bodyParser.json({
    limit: '50mb'
  }));
  
  app.use(bodyParser.urlencoded({
    limit: '50mb',
    parameterLimit: 1000000,
    extended: true 
  }));

....


const sslServer = https.createServer({
    key: fs.readFileSync(path.join(__dirname, 'cert', 'generated-private-key.pem.txt')),
    ca: [
        fs.readFileSync(path.join(__dirname, 'cert', '422f9963d338e48.crt')),
        fs.readFileSync(path.join(__dirname, 'cert', 'gd_bundle-g2-g1.crt'))
    ],
    cert: fs.readFileSync(path.join(__dirname, 'cert', 'generated-csr.pem.txt'))
}, app)
sslServer.listen(3443, () => console.log('Secure server is running on port 3443'))
....

0 个答案:

没有答案