Table of Contents
Creating your own self-signed SSL certificate is a quick and inexpensive way to add SSL encryption to non-production applications or apps with limited distribution. Though the certificate implements full encryption, visitors to your site will see a browser warning indicating that the certificate should not be trusted.
For apps with controlled distribution this warning can be avoided by creating your own authority certificate and adding it to your users' browsers.
You can proceed past this warning to view the encrypted site.
The openssl library is required to generate your own certificate. Run the following command in your local environment to see if you already have openssl installed installed.
$ which openssl /usr/bin/openssl
which command does not return a path then you will need to install openssl yourself:
|If you have…||Install with…|
|Mac OS X||
|Windows||Windows complete package .exe installer|
Generate private key and certificate signing request
A private key and certificate signing request are required to create an SSL certificate. These can be generated with a few simple commands. When the
openssl req command asks for a “challenge password”, just press return, leaving the password empty.
More detailed instructions can be found in Creating an SSL Certificate Signing Request.
$ openssl genrsa -des3 -passout pass:x -out server.pass.key 2048 ... $ openssl rsa -passin pass:x -in server.pass.key -out server.key writing RSA key $ rm server.pass.key $ openssl req -new -key server.key -out server.csr ... Country Name (2 letter code) [AU]:US State or Province Name (full name) [Some-State]:California ... A challenge password : ...
Generate SSL certificate
The self-signed SSL certificate is generated from the
server.key private key and
$ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
server.crt file is your site certificate suitable for use with Heroku’s SSL add-on along with the
server.key private key.