How to deploy multiweb wordpress SSL certified (Let's Encrypt) in lightsail with docker-compose in 5 minutes
Jesus Blazquez
Posted on July 1, 2022
Deploy Centos7 in lightsail, attach static IP to your server and open this flows inside you Networking server config:
Now you have Lightsail done
Berfore to deploy the solution you need redirect your domain to the server static IP.
Access by console to your new server and install docker and docker-compose:
Install docker:
yum update && yum install -y yum-utils device-mapper-persistent-data lvm2 &&
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo &&
yum install docker-ce docker-ce-cli containerd.io &&
systemctl enable docker &&
systemctl start docker
Install docker-compose:
yum install curl &&
curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose &&
chmod +x /usr/local/bin/docker-compose &&
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
Now make a copy of my Github repository https://github.com/jblazquezmartin/docker_multiweb_https, with the following command:
git clone https://github.com/jblazquezmartin/docker_multiweb_https
Create a network in docker for nginx-proxy:
docker network create nginx-proxy
Run the following command inside the "nginx-proxy" directory, to launch the web server:
docker-compose up -d
verify that it was raised correctly with the following command:
docker-compose ps
Now you must adapt the code downloaded from Github inside the «websites» directory, so that it adapts to the web(s) you want to deploy, use «websites/example.es/docker-compose.yml» as an example, you will have to adapt it to your domain:
Keep in mind that an automatic registration request for your certificate is sent to Let's Encrypt, for which you will need to fill in the "LETSENCRYPT_HOST" and "LETSENCRYPT_EMAIL" fields correctly, as well as having your domain redirected to the external IP assigned in Lightsail.
Run again, inside your web directory, where you modified "docker-compose.yml", the command:
docker-compose up -d
verify that it was raised correctly with the following command:
docker-compose ps
Apache and MariaBD will be up.
Now access your domain and magic!!, you have your wordpress installed with the Let's Encrypt SSL certificate configured:
Enjoy!!
Posted on July 1, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.