localhost {
root * /testDir
file_server
reverse_proxy /api/* localhost:3000
}
// And dockerfile
FROM caddy:2.7.6-alpine
EXPOSE 80
EXPOSE 443
COPY Caddyfile /etc/caddy/Caddyfile
COPY testDir /testDir
CMD ["caddy", "run"]
Checked 10 times and yes the Caddyfile is in the container in the path and yes, testDir is also there.
And of course, I build it with:
docker build -t testcaddy .
and run it with:
docker run -p 80:80 -p 443:443 -d testcaddy
And nothing happens when I type localhost in browser I get:
The site can't be reached.
You have to give caddy a config file to use:
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile"]
or load it using HTTP: https://caddyserver.com/docs/getting-started