The simplest way is to use mkcert utility.
It is easy to use tool for making local development SSL/TLS certificates.
Installation
At first, you need to install it. You can download a binary file from here to use it immediately without installation. Or follow the installation guide for your OS.
Usage
Run command to create local CA (Certificate Authority).
mkcert -install
Run command to create certificate files.
mkcert localhost
That's it.
You have two SSL certificate files now: *.pem which is a certificate file and *key.pem which is a key file.
Use these files in the configuration of your local webserver.
If you want to know how to generate it manually, read the How to get HTTPS working on localhost article on my website. The article has a simple Nginx example of configuration to use generated SSL certificate.
Top comments (0)