Skip to content

Latest commit

 

History

History
46 lines (37 loc) · 1.27 KB

File metadata and controls

46 lines (37 loc) · 1.27 KB

Wordpress, Nginx and Let’s Encrypt with Docker Compose

Intro:

I use this setup for my blog, its adapted from this step up from evgeniy-khist

Prerequsites:

You must own a domain name and have a DNS (A record) pointing to an IP address.

Run as test:

Set the variables in config.env.example then rename it to config.env.

Create the required volumes:

docker volume create --name=nginx_ssl
docker volume create --name=certbot_certs

Then run:

# See if it works
docker-compose --env-file config.env up --build
# Run it properly
docker-compose --env-file config.env up --build -d

Test the site and make sure its all working before moving to production.

Run as Production:

Re-create the volume for Let's Encrypt certificates:

# Destroy the cert bot container and volume
docker-compose down
# docker rm {COMPOSE_PROJECT_NAME}_certbot_1 {COMPOSE_PROJECT_NAME}_nginx_1
# example
docker rm wptest_certbot_1 wptest_nginx_1
docker volume rm certbot_certs
docker volume create --name=certbot_certs

Change the CERTBOT_TEST_CERT value to 0 in config.env

Start the containers:

docker-compose --env-file config.env up --build
docker-compose up -d --env-file config.env