Last active
May 22, 2017 20:42
-
-
Save PragmaticEd/43a8e7e926addcd04517700d7251d6dc to your computer and use it in GitHub Desktop.
Run Puma server with https
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1) Create your private key (any password will do, we remove it below) | |
$ cd ~/.ssh | |
$ openssl genrsa -des3 -out server.orig.key 2048 | |
# 2) Remove the password | |
$ openssl rsa -in server.orig.key -out server.key | |
# 3) Generate the csr (Certificate signing request) (Details are important!) | |
$ openssl req -new -key server.key -out server.csr | |
# IMPORTANT | |
# MUST have localhost.ssl as the common name to keep browsers happy | |
# (has to do with non internal domain names ... which sadly can be | |
# avoided with a domain name with a "." in the middle of it somewhere) | |
# | |
#Country Name (2 letter code) [AU]: | |
#... | |
#Common Name: localhost.ssl | |
#... | |
# 4) Generate self signed ssl certificate | |
$ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt | |
# 5) Finally Add localhost.ssl to your hosts file | |
$ echo "127.0.0.1 localhost.ssl" | sudo tee -a /private/etc/hosts | |
# 6) Boot puma | |
$ puma -b 'ssl://0.0.0.0:3000?key=/home/pragmaticed/.ssh/server.key&cert=/home/pragmaticed/.ssh/server.crt' | |
$ puma -b 'ssl://0.0.0.0:3000?key=/home/vagrant/.ssh/server.key&cert=/home/vagrant/.ssh/server.crt' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment