Little short story

I launched my first EC2 instance about 3 years ago. All was runnig well until i had only PHP sites so every applications with the same environment needed. Later i started developing applications with heterogeneous environments, like Python, Go or simply Wordpress blogs.

And so? Docker was the way!

Intro

The intent of this post is to show how to set up an SSL secure Wordpress site using Docker.

I suppose that you have docker-compose installed in your server and bought a domain name that i will call yourdomain.com.

Wordpress Container

WORKSPACE/mywordpresssite/docker-compose.yml

WORKSPACE/mywordpresssite/config/php.conf.uploads.ini

Correctly enable SSL

On the top of your WORKSPACE/mywordpresssite/wp-app/wp-config.php add these lines:

(it avoids the redirects loop once the NGINX reverse proxy container is up)

Generate free SSL cert

Go to https://www.sslforfree.com/ and type your domain name. After that, you have to decide how to verifiy your domain (i generally do the manual verification).

Unzip the downloaded folder and upload ca_bundle.crt , certificate.crt and the private.key inside WORKSPACE/nginx/keys/yourdomain.com/ folder.

NGINX Container

WORKSPACE/nginx/docker-compose.yml

WORKSPACE/nginx/docker-compose.yml

Finally

We have only the last 2 things to do:

  • Update record A on your domain DNS zone in order to point to your server IP.
  • [Only if you are running on an Amazon EC2 istance] Add the 9009 port on Outgoing tab of the EC2 security group. Grant this port access only to your ec2 IPs.