Quick and easy local ssl/https with mkcert on ubuntu

One time install of mkcert with:

sudo apt install mkcert libnss3-tools  
mkcert -install  

Then set up your SSL cert for the needed domains, e.g. here I'm setting up localhost & mytestsite.localhost and i'm saving them to /home/andrew/bin/mkcert/ but change this to wherever you'd like the certs to save to:

mkcert -cert-file /home/andrew/bin/mkcert/localhost-cert.pem -key-file /home/andrew/bin/mkcert/localhost-cert-key.pem localhost mytestsite.localhost 127.0.0.1 ::1  

Simple and done.

For configuring your local apache, nginx or caddy etc. use the Mozilla SSL Configuration Generator.

comments powered by Disqus
Want to setup your own server? Digital Ocean offer $100 free for new accounts.
DigitalOcean Referral Badge