Lightweight library for getting Free SSL certifications through Let's Encrypt, using the ACME protocol
https://git.rootprojects.org/root/acme.js
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
532 B
21 lines
532 B
'use strict';
|
|
|
|
var https = require('http2');
|
|
var tls = require('tls');
|
|
var fs = require('fs');
|
|
|
|
var key = fs.readFileSync('./privkey.pem');
|
|
var cert = fs.readFileSync('./fullchain.pem');
|
|
|
|
function SNICallback(servername, cb) {
|
|
console.log('sni:', servername);
|
|
cb(null, tls.createSecureContext({ key, cert }));
|
|
}
|
|
|
|
var server = https
|
|
.createSecureServer({ SNICallback: SNICallback }, function (req, res) {
|
|
res.end('Hello, Encrypted World!');
|
|
})
|
|
.listen(443, function () {
|
|
console.info('Listening on', server.address());
|
|
});
|
|
|