- -

Árbol de páginas

Versiones comparadas

Clave

  • Se ha añadido esta línea.
  • Se ha eliminado esta línea.
  • El formato se ha cambiado.

...

En algunos casos, además de instalar el certificado proporcionado a través de PillínPiolín, es necesario instalar el certificado raíz o el certificado intermedio.

...

El siguiente código establece un servidor https en nodejs;




Bloque de código
languagejs
#vim https_server.js
var https = require('https');
var fs = require('fs');
var https_options = {
    key: fs.readFileSync("/path/to/certificado.key"),
    cert: fs.readFileSync("/path/to/certificado.pem"),
    ca: [
        fs.readFileSync('path/to/cadena.pem')
    ]
};
https.createServer(options, function (req, res) {
    res.writeHead(200);
    res.end("Welcome to Node.js HTTPS Servern");
}).listen(443)