I'm using Hugo Framework to play around continuous deployment. I created an image containing Caddy server, Hugo and the test project I used for my tests, sent it to my server that runs Traefik and started the image.
Here is the Dockerfile:
FROM debian:latest
RUN apt-get update -y && apt-get install git curl -y
ADD https://github.com/gohugoio/hugo/releases/download/v0.42.2/hugo_0.42.2_Linux-64bit.deb /tmp/hugo.deb
RUN dpkg -i /tmp/hugo.deb && rm /tmp/hugo.deb
RUN curl https://getcaddy.com | bash -s personal
RUN chown root:root /usr/local/bin/caddy && chmod 755 /usr/local/bin/caddy
RUN mkdir /srv/app
WORKDIR /srv/app
COPY . ./
RUN git clone https://github.com/RealOrangeOne/hugo-theme-revealjs.git themes/hugo-theme-revealjs
RUN hugo
EXPOSE 2015
CMD ["caddy"]
And here is the "docker-compose.yml" that runs my project on my server:
my_project:
image: some_registry/my_project
ports:
- "2015:2015"
labels:
- "traefik.frontend.rule=Host:subdomain.domain.me"
I almost forgot, here is my Caddyfile:
localhost:2015
root /srv/app/public
The image runs without problem, but when reaching subdomain.domain.me
, I get the following message:
404 Site subdomain.domain.me is not served on this interface
However, running curl http://localhost:2015
prints my project's HTML on my server.
So... I think the problem comes from Caddy, since I have no problem when using Apache, and about 5 other of my projects use Traefik without problem.
My question is: how should I edit my Caddyfile so that I don't have this problem?
Thank you in advance
Caddy is looking for a request looking for localhost:2015. I would guess that you are forwarding a request to the machine but not to localhost.
Start Caddy with the -log path/to/log.log parameter and you may see what the request is, or try
:2015
root /srv/app/public
This will serve any request coming in on port 2015.