I tried to add Traefik to my Java container and I couldn't do it so I tried a different service, PHP to be precise, and I got the same negative result.
<!doctype html>
<html lang="it">
<head><title>Ciao Mondo!</title></head>
<body>
<h1>Ciao Mondo!</h1>
<p>Questa è una semplice pagina PHP statica servita con Let's Encrypt.</p>
<h2>Versione di PHP in uso:</h2>
<?php phpinfo(); ?>
</body>
</html>
What I get:
https://localhost/
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access this resource.</p>
<hr>
<address>Apache/2.4.53 (Debian) Server at localhost Port 80</address>
</body></html>
What I would like to achieve:
https://localhost/
<!doctype html>
<html lang="it">
<head><title>Ciao Mondo!</title></head>
<body>
<h1>Ciao Mondo!</h1>
<p>Questa è una semplice pagina PHP statica servita con Let's Encrypt.</p>
<h2>Versione di PHP in uso:</h2>
<?php phpinfo(); ?>
</body>
</html>
Hi @Milano2022,
Thanks for your interest in Traefik.
The routing is working properly as the HTML content you are receiving comes from Apache.
So the issue is not related to Traefik, I would suggest creating an issue in Apache related forums.
Can you recommend the right forum to ask this question?
Traefik is not used with Java, it is not even used with PHP, so what service is it used with? You system analysts of the forum, what programming tools do you use? Perhaps Traefik is more used by programmers who use C# or ASP. Is it right?
Traefik is a reverse proxy and only make request forwarding to any application using HTTP, TCP or UDP protocols. The language used to create the application is up to you and is not important, could be Python, Go, Rust, Java, even a netcat in server mode. Just be sure that the dependencies implementing HTTP protocol are carefully respecting the RFC.
From what you posted, I see that there is a permission error accessing your HTML files in your web server. You have to fix this error in your Apache deployment. It could be a specific Apache configuration or a docker volume lacking rights. I'd suggest to post on StackOverflow, where the community is very active.
The script works but there is still a small problem, this time it concerns Traefik.
container-traefik-eb | time="2022-07-08T12:53:38Z" level=info msg="Configuration loaded from flags."
container-traefik-eb | time="2022-07-08T12:53:38Z" level=info msg="Traefik version 2.8.0 built on 2022-06-29T15:43:58Z"
container-traefik-eb | time="2022-07-08T12:53:38Z" level=info msg="\nStats collection is disabled.\nHelp us improve Traefik by turning this feature on :)\nMore details on: https://doc.traefik.io/traefik/contributing/data-collection/\n"
container-traefik-eb | time="2022-07-08T12:53:38Z" level=error msg="The ACME resolver \"leresolver\" is skipped from the resolvers list because: unable to get ACME account: open /letsencrypt/acme.json: no such file or directory"
container-traefik-eb | time="2022-07-08T12:53:38Z" level=warning msg="Traefik Pilot is deprecated and will be removed soon. Please check our Blog for migration instructions later this year."
container-traefik-eb | time="2022-07-08T12:53:38Z" level=info msg="Starting provider aggregator aggregator.ProviderAggregator"
container-traefik-eb | time="2022-07-08T12:53:38Z" level=info msg="Starting provider *traefik.Provider"
container-traefik-eb | time="2022-07-08T12:53:38Z" level=info msg="Starting provider *acme.ChallengeTLSALPN"
container-traefik-eb | time="2022-07-08T12:53:38Z" level=info msg="Starting provider *docker.Provider"
container-traefik-eb | time="2022-07-08T12:53:39Z" level=error msg="the router websecure-training@docker uses a non-existent resolver: leresolver"
Traefik Pilot is deprecated and will be removed soon. Please check our Blog for migration instructions later this year.
It is not an issue, Pilot is just deprecated.
If you want to use plugins, you can just remove the pilot from your configuration.
Is there any other problem?
I have been using Traefik for a few days and I would like to start with something updated. Can you explain me how to update the code please? No, there are no other problems.
If you are using v2.8, then you are using the latest version available. Traefik Pilot is deprecated and we just added a warning for now. We are still in the process of replacing Pilot. But you can go with what you are using right now, Pilot was mainly here to add custom plugins.
If I create the acme.json file, Traefik doesn't fill it. If I delete the file before starting Traefik, the proxy creates the file and writes to it but I can't read it.
the router websecure-training@docker uses a non-existent resolver: leresolver
You have this error because the resolver fails during the creation:
The ACME resolver "leresolver" is skipped from the resolvers list because: ...
so:
the directory data-letsencrypt must exist before the start of Traefik
the direction must be mounted
Traefik will create the acme.json for you.
Let's Encrypt has a rate limit, if you don't mount the letsencrypt directory, Traefik will recreate the certificates each time it restarts and you will hit this rate limitation.
Please read the logs, the errors are in the logs.
note: the perm on the acme.json cannot be 777, it must be related to the user inside the container and be 600.
I drop a cornerstone! I've always used 'build' and 'image' together. In the 'image' field I put a fantasy name. I use the 'image' field to name the image of a certain service. This helps me manage images and containers.
cd /home/gi/Dropbox/DOCKER/Docker-Traefik-Php-Java
docker-compose up --force-recreate
Zeroing:
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
docker volume rm $(docker volume ls -q)
docker system prune -y
docker system prune -a -y
I added the log file by looking at your link but I can't find any files after starting my service's containers. I also updated my project by reading the page you indicated but I struggle to understand it in detail because it uses a different standard than the one I am used to. Below is the complete code that always gives the same error (404 page not found).