Skip to content

Instantly share code, notes, and snippets.

@startswithaj
Created June 3, 2014 00:59
Show Gist options
  • Save startswithaj/a5c7289da0590a480a3b to your computer and use it in GitHub Desktop.
Save startswithaj/a5c7289da0590a480a3b to your computer and use it in GitHub Desktop.
Generate ssl cert for localhost use with express
Commands:
openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
>>>>>Common Name (eg, YOUR name) []:localhost
openssl x509 -req -days 1024 -in server.csr -signkey server.key -out server.crt
Express:
privateKey = fs.readFileSync('/Users/jake/webclient/server.key').toString();
certificate = fs.readFileSync('/Users/jake/webclient/server.crt').toString();
credentials = {key: privateKey, cert: certificate};
server = https.createServer(credentials, app).listen(config.listenPort)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment