Skip to content

Instantly share code, notes, and snippets.

@maisnamraju
Forked from itsMattShull/create-ssl-for-localhost
Last active September 24, 2019 04:44
Show Gist options
  • Save maisnamraju/f48a56d34416a5459a5d6d1442c2c2f2 to your computer and use it in GitHub Desktop.
Save maisnamraju/f48a56d34416a5459a5d6d1442c2c2f2 to your computer and use it in GitHub Desktop.
Command to create a key.pem and cert.pem for localhost for ubuntu
openssl req \
-newkey rsa:2048 \
-x509 \
-nodes \
-keyout key.pem \
-new \
-out cert.pem \
-subj /CN=localhost \
-reqexts SAN \
-extensions SAN \
-config <(cat /usr/lib/ssl/openssl.cnf \
<(printf '[SAN]\nsubjectAltName=DNS:localhost')) \
-sha256 \
-days 3650
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment