Once you have node.js installed on your system, you can just follow the procedure below to get a basic web server running with support for both HTTP and HTTPS!


Step 1 : Build a Certificate Authority

  1. create the folder where you want to store your key & certificate :

mkdir conf


  1. go to that directory :

cd conf


  1. grab this ca.cnf file to use as a configuration shortcut :

wget <https://raw.githubusercontent.com/anders94/https-authorized-clients/master/keys/ca.cnf>


  1. create a new certificate authority using this configuration :

openssl req -new -x509 -days 9999 -config ca.cnf -keyout ca-key.pem -out ca-cert.pem


  1. now that we have our certificate authority in ca-key.pem and ca-cert.pem, let’s generate a private key for the server :

openssl genrsa -out key.pem 4096


  1. grab this server.cnf file to use as a configuration shortcut :

wget <https://raw.githubusercontent.com/anders94/https-authorized-clients/master/keys/server.cnf>