docker-wordpress icon indicating copy to clipboard operation
docker-wordpress copied to clipboard

Wordpress Docker container using SSL Certificates with LetsEncrypt

Docker Wordpress [automation]

This repo is part of a larger script to changes in the files must be reviewed.

If you are looking of the previous version check branch basic.

Using Wordpress with SSL enabled integrated with NGINX proxy and autorenew LetsEncrypt certificates

wordpress-docker-letsencrypt

This docker-compose should be used with WebProxy (the NGINX Proxy):

https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion

Usage

After everything is settle, and you have your three containers running (proxy, generator and letsencrypt) you do the following:

  1. Clone this repository:
git clone https://github.com/evertramos/docker-wordpress.git
  1. Update the service name in your docker-compose.yml file VERY IMPORTANT

You must use any name, but make sure it is a unique service name in your environment, otherwise it will conflict with other services.

  1. Configure your .env file:

Copy .env.sample to .env and update with your data

The proxy network must match the network name you have set in the proxy settings.

  1. Start your project
docker-compose up -d

Be patient - when you first run this repo, the database might take sometime to launch and the process of getting a new certificate for your domain might take some time.


Make sure the wordpress data files has user and group set to www-data, so you could update, install, delete files from your admin panel.


Proxy

Proxy - nginx-proxy-automation


Further Options

wp-cli (https://wp-cli.org/)

For whoever uses wp-cli here is how to implement it on this repo.

Test to see if it´s working

./wp-cli-test.sh

If you would, add the alias "wp" to your .bash_aliases:

alias wp="docker-compose run --rm wpcli"

Next time you need to run a wp-cli command just go to where you have your docker-compose file and run a wp command.


Known Issues

Azure

Running docker on Azure servers you must mount your database in your disks partitions (example: /mnt/data/) so your db container can work. This is a some kind of issue regarding Hyper-V sharing drivers... not really sure why.