Skip to content

Instantly share code, notes, and snippets.

@afuchs
Created January 16, 2014 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save afuchs/8457813 to your computer and use it in GitHub Desktop.
Save afuchs/8457813 to your computer and use it in GitHub Desktop.
// 1. Generate SSL cert
// > openssl genrsa -out privatekey.pem 1024
// > openssl req -new -key privatekey.pem -out certrequest.csr
// > openssl x509 -req -in certrequest.csr -signkey privatekey.pem -out certificate.pem
// 2. Set up your express server
var https = require('https');
var fs = require('fs');
var express = require('express');
var app = express();
var options = {
key: fs.readFileSync('privatekey.pem'),
cert: fs.readFileSync('certificate.pem')
};
https.createServer(options, app).listen(443);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment