Closed ilanzel closed 1 year ago
Hi @ilanzel ,
You can automate HTTPS installation by using a reverse proxy that automatically obtains and manages SSL certificates from Let's Encrypt. For this task, you can use Docker containers like Traefik or Nginx Proxy Manager.
Here is a basic example of how you can do this using Traefik and Docker Compose:
version: '3'
services:
traefik:
image: traefik:v2.4
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.myresolver.acme.httpchallenge=true"
- "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
- "--certificatesresolvers.myresolver.acme.email=your-email@example.com"
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
ports:
- "80:80"
- "443:443"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./letsencrypt:/letsencrypt"
moodle:
image: moodle
labels:
- "traefik.enable=true"
- "traefik.http.routers.moodle.rule=Host(`moodle.your-domain.com`)"
- "traefik.http.routers.moodle.entrypoints=websecure"
- "traefik.http.routers.moodle.tls.certresolver=myresolver"
In this setup, Traefik handles incoming connections and automatically obtains and renews SSL certificates from Let's Encrypt for your Moodle service. Make sure to replace "your-email@example.com" and "moodle.your-domain.com" with your actual email and domain.
Please note that Let's Encrypt requires a valid domain name pointing to the server where your Moodle container runs.
Remember, you will need to make sure the DNS for your domain is set up correctly, and the ports 80 and 443 are open on your firewall for the Let's Encrypt servers to reach yours.
Hope this helps! If you have more questions, feel free to ask.
Hi @erseco Thanks for the detailed response and the Traefik example (and apologies for my late reaction). Can you send a Docker Compose example using Nginx Proxy Manager? Thanks in advance!
Hi Currently I get only http connection without ssl to the moodle docker. How can I automate HTTPS installation to the moodle docker on the Dockerfile or docker-compose.yml? Thanks