Follow these steps:
- Now, we'll issue the self-signed certificates for the banka.com and bankb.com domains. To do so, we'll be using the certutil and mkcert utilities.
To install certutil, run the following command:
$ sudo apt-get install -y libnss3-tools
To install mkcert, run the following commands:
mkdir mkcert
cd mkcert
wget https://github.com/FiloSottile/mkcert/releases/download/v1.1.2/mkcert-v1.1.2-linux-amd64
mv mkcert-v1.1.2-linux-amd64 mkcert
chmod +x mkcert
The preceding commands will create a directory called mkcert, download the binary from GitHub, and create an executable called mkcert for issuing self-signed certificates. Make sure you download the binary version for your OS. Since I'm using Ubuntu, I downloaded the Ubuntu version.
- Run the following command to set up a local certificate store:
mkcert –install
Now, let's issue self-signed certificates for banka.com and bankb.com.
- Run the following command to issue a certificate for banka.com:
./mkcert banka.com
Check the directory to see if the certificate files are generated. The banka.com.pem and banka.com-key.pem files should have been generated in your mkcert directory.
- Repeat this for the bankb.com domain:
./mkcert bankb.com
We now have the self-signed SSL certificates for the banka.com and bankb.com domains. Now, let's set up the http server, which will accept and route all the incoming requests to the banka.com and bankb.com domains.