Use the below command to create a self-signed certificate:
openssl req -x509 -days 365 -nodes -newkey rsa:2048 -keyout tls.key -out tls.crt \
-subj “/C=CN/ST=Shandong/L=Qingdao/O=Nokia/OU=RD Team/CN=deskshell.com”
A very good reference material can be found in digital ocean as below