代码之家  ›  专栏  ›  技术社区  ›  forJ

如何开发https nodejs web应用程序,使安全警告不会显示

  •  1
  • forJ  · 技术社区  · 9 年前

    http 而不是 https

    const https = require('https');
    
    const httpsOptions = {
        key : fs.readFileSync('example.key'),
        cert : fs.readFileSync('example.crt')
    };
    
    https.createServer(httpsOptions, app).listen(port, ()=>{
        console.log('server listening at 3000')
    });
    

    但现在每当我试图进入我的本地运营网站 https://localhost:3000

    https://developers.google.com/web/updates/2016/10/avoid-not-secure-warn 看看如何删除上面写着“将整个网站创建为https”的标志,但我不明白的是,我的所有网站都已经被删除了 . 查看我的所有观点 https 必须使用,而不是 http

    以上代码是否不足以制作所有页面 https

    1 回复  |  直到 9 年前
        1
  •  4
  •   Joe Clay    9 年前

    您的证书可能没有签名,特别是如果您自己创建了证书,则需要将其发送给经过认证的SSL证书分发者进行签名。你可以查一下 this

    Let's Encrypt 是一个免费的证书颁发者,您可以自动更新证书,因此您不必担心这一点。

    推荐文章