Skip to content

Instantly share code, notes, and snippets.

@alfonsodev
Created August 6, 2013 14:38
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 alfonsodev/6165068 to your computer and use it in GitHub Desktop.
Save alfonsodev/6165068 to your computer and use it in GitHub Desktop.
generate key to test https express.js application on local

Command line

  openssl genrsa -out hacksparrow-key.pem 1024 
  openssl req -new -key hacksparrow-key.pem -out certrequest.csr
  openssl x509 -req -in certrequest.csr -signkey hacksparrow-key.pem -out hacksparrow-cert.pem

Express application

  var options = {
    key: fs.readFileSync('hacksparrow-key.pem'),
    cert: fs.readFileSync('hacksparrow-cert.pem')
  };

  http.createServer(app).listen(3000);
  https.createServer(options, app).listen(4333);
  debug('listenging ong port 3000');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment