Skip to content

Instantly share code, notes, and snippets.

@hosamshahin
Forked from trcarden/gist:3295935
Last active March 30, 2016 20:03
Show Gist options
  • Save hosamshahin/eac6676eece72546c96d9f164397f60b to your computer and use it in GitHub Desktop.
Save hosamshahin/eac6676eece72546c96d9f164397f60b to your computer and use it in GitHub Desktop.
Rails SSL Localhost
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) In your rails applicaiton root folder create self signed certificate
$ openssl req -new -newkey rsa:2048 -sha1 -days 365 -nodes -x509 -subj "/C=US/ST=Colorado/L=Colorado Springs/O=SW/CN=localhost.ssl" -keyout server.key -out server.crt
# 2) Add localhost.ssl to your hosts file
$ echo "127.0.0.1 localhost.ssl" | sudo tee -a /etc/hosts
# 3) Boot thin http://code.macournoyer.com/thin/
$ thin start --ssl --ssl-key-file server.key --ssl-cert-file server.crt
# 4) Add server.crt as trusted !!SYSTEM!! (not login) cert in the mac osx keychain
# Open keychain tool, drag .crt file to system, and trust everything.
# Notes:
# 1) Https traffic and http traffic can't be served from the same thin process. If you want
# both you need to start two instances on different ports.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment