Let's Encrypt, Docker, and WordPress
Created at 2016-08-18 Updated at 2016-11-02
Intro
I had a specific problem that i wanted to solve: setting up a wordpress installation that had HTTPS, and it had to be inside of a docker container. Seemed challenging.
Luckily for me, the project HTTPS-PORTAL is is working order and being actively developed!
Using Let’s Encrypt’s certificate automation, I was able to set up an HTTPS wordpress install in under five minutes. Here are some reasons why sites should be using HTTPS:
HTTPS helps prevent intruders from tampering with the communications between your websites and your users’ browsers. Intruders include intentionally malicious attackers, and legitimate but intrusive companies, such as ISPs or hotels that inject ads into pages.
HTTPS prevents intruders from being able to passively listen in on the communications between your websites and your users.
It is much cheaper and faster to imlement because of the Let’s Encrypt project!
I followed this tutorial to get me up and running with my wordpress install. I had some problems understanding how to write a docker-compose file, but the blog author was very quick in helping to correct my mistakes.
Compose
Here is what my docker-compose.yml file contained, minus the real password:
|
|
In the docker-compose.yml directory, run the command to start the containers:
|
|
After the server generates a TLS Diffie-Hellman key and spins up the WordPress instance, we have our WordPress site installed!
Increase Upload Allowance
Now let’s insert some media. While you could just embed everything from an external site like youtube and imagur, it is nice to have the option to host your own assets. Right now, the upload limit is a puny 2MB. Let’s change it to 64MB.
To enter the running container, type:
|
|
To install the nano text editor, type:
Create the file php.ini in you WordPress root directory.
Once in, paste these lines:
Stop the running containers…
And restart them in detatched mode
|
|
Hooray, our upload limit is now increased! We can now upload media up to 64MB.
My Running Sites (Currently offline)
You can visit the site I generated this way at https://news.containerize.us
Also, using keys a generate with HTTPS-PORTAL, I created a Mattermost instance.