Traefik is a reverse proxy that allows in our case to make redirections from a website to an application running on a specific port. We will also have an automatic TLS certificate renewed thanks to Let's Encrypt.
The necessary prerequisites:
Docker installation
Ports 80 and 443 opens
Once Docker is installed and ports 80 and 443 are open we will create a directory with the name of our choice in our case we will call it traefik.
mkdir traekif
Type the following command and keep the information. This will allow us to
The docker-compose.yml file which is the file that will be read during the execution of our container. Replace pathoffile by the path where the files are located after the . At the label level we put the username and password kept previously.
Then we will create the acme file and give it the necessary rights.
touchacme.jsonchmod600acme.json
Now we just need to launch our container.
docker-composeup-d
Let's check that our container is up.
dockerps-a
So now we can access by url to traefik at traefik.domain.com
Now if we want to have another container with active TLS certificate in the docker compose we put this part. replace SERVICE by the name of the service you want to see displayed on the GUI of traefik.