Skip to content

Instantly share code, notes, and snippets.

@moisesnarvaez
Last active August 27, 2021 03:55
Show Gist options
  • Save moisesnarvaez/c51dbe51ef51303b6150e9a638c3b9ca to your computer and use it in GitHub Desktop.
Save moisesnarvaez/c51dbe51ef51303b6150e9a638c3b9ca to your computer and use it in GitHub Desktop.
SSL on Localhost
openssl req -x509 -out localhost.crt -keyout localhost.key -newkey rsa:2048 -nodes -sha256 -subj '/CN=localhost' -extensions EXT -config <(printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
mkdir ~/certs/
mv localhost.crt ~/certs/
mv localhost.key ~/certs/

bin/rails s -b "ssl://127.0.0.1:3000?key=$HOME/certs/localhost.key&cert=$HOME/certs/localhost.crt"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment