How to Generate a Self-Signed Certificate and Private Key using OpenSSL ubuntu code example
Example: create self signed certificate for localhost ubuntu
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/apache-selfsigned.key -out /etc/ssl/certs/apache-selfsigned.crt