I have read the following guide. I was able to understand the code. The setup works perfectly on my VPS. Is there a guide explaining how to add Let's Encrypt to the server and renew it automatically when it expires?
I would like to create a Docker Compose file to publish a static html page reachable through a secure connection for life.
My html file:
<!doctype html>
<html lang="it">
<head><title>Ciao Mondo!</title></head>
<body>
<h1>Ciao Mondo!</h1>
<p>Questa è una semplice pagina HTML statica servita grazie a Traefik.</p>
</body>
</html>
Traefik manages automatically Let's Encrypt certificates (creation and renew), so if you have defined a resolver and set TLS on your router, everything will be done automatically.
Note: You don't need Certbot, Traefik internally uses a lib called lego to handle ACME/Let's Encrypt.
Also, Traefik is a reverse proxy and not a web server, so Traefik cannot serve a static file if you don't have a web server.
Thanks for your answer and your code. You have been very kind. Magnificent!
I have replaced the email and the domain name. The page is reachable but the browser tells me that the certificate is not valid:
http://*****************.tk/> 404 page not found
http://www.*****************.tk/> 404 page not found
https://*****************.tk/> ok but the certificates are not valid
https://www.*****************.tk/> 404 page not found
I get this error:
ubuntu-22-04-lts@webserver:~/Traefik-Static-Page$ cd /home/ubuntu-22-04-lts/Traefik-Static-Page
docker-compose build
docker-compose up
traefik uses an image, skipping
Building webserver
error checking context: 'no permission to read from '/home/ubuntu-22-04-lts/Traefik-Static-Page/letsencrypt/acme.json''.
ERROR: Service 'webserver' failed to build : Build failed
traefik-static-page_traefik_1 is up-to-date
Recreating traefik-static-page_webserver_1 ...
Is my DNS configuration right? Do I have to do anything other than launch the 2 commands from the terminal and upload the folder with all the project files to the server?
Ok, thanks, everything works but sometimes the script doesn't start and I get this message:
Building webserver
error checking context: 'no permission to read from '/home/ubuntu-22-04-lts/Traefik-Static-Page/letsencrypt/acme.json''.
ERROR: Service 'webserver' failed to build : Build failed
Thank you very much. Is exposing the dashboard on the production server a security risk? Does it make sense to use these codes or is it enough not to write "8080:8080"?
- --api.insecure=false
- --api.dashboard=false
Which of the 2 scripts is the most modern and advisable for a working configuration with future versions of Docker Compose?