The simplest way is to use mkcert utility.
It is easy to use tool for making local development SSL/TLS certificates.
Run command to create local CA (Certificate Authority).
Run command to create certificate files.
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.