Site Updates

Using Let’s Encrypt with a PHP Application on OpenShift

Hi,

Update: github.com/kuba/simp_le is dead, the github.com/zenhack/simp_le fork is to be used instead.

The following post documents how I used Let’s Encrypt to secure this WordPress site which hosted on OpenShift.

The following is based on this forum post/tutorial. I just made it work with virtualenv and a PHP OpenShift app.

Please note that you need to be a bronze OpenShift user to be able to do this as they don’t allow custom certificates for regular free users.

Login into your rhc app & go to ~/app-root/data

 

Spin-up a virtualenv:

Install dependencies via pip in the virtualenv:

The cool part is that it seems multiple apps share the same environment and you might need to do the above steps only once for all your apps.

Now generate the certificates:

The trick is in the last line where we use the PHP environment variables for this python script.

Now pull the certificates:

Or course, replace “www.example.com” with your hostname.

Restart your app & exit:

Pull the certificates to your local filesystem:

Set them on your app:

Again replace www.example.com with your hostname.

Aaand we’re done!

 

 

 

1 thought on “Using Let’s Encrypt with a PHP Application on OpenShift”

  1. Thanks, this was perfect.
    I added a terms of service hash argument to the “simp_le –email…” line to resolve a “TOS hash mismatch” error.
    –tos_sha256 6373439b9f29d67a5cd4d18cbc7f264809342dbf21cb2ba2fc7588df987a6221

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.