0

I'm trying to solve this problem since days, but I don't get it and I didn't find anything helpful in the internet, so I'd be very grateful for every hint.

A few weeks ago, I set up a new Ubuntu 16.04.4 LTS Server. I installed docker and ran an internal web page on it. Now we've got an additional webpage and I'd like to make them accessible with two different subdomains.

  • appone.qwert.de
  • apptwo.qwert.de

For this reason I bought the domain qwert.de and asked my provider for a fixed ip address. My server is now reachable over the domain qwert.de.

Then I found traefik which does pretty much cover all my needs. So I installed it with the following configuration:

debug = false

logLevel = "ERROR"
defaultEntryPoints = ["https","http"]

[entryPoints]
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect]
    entryPoint = "https"
  [entryPoints.https]
  address = ":443"
  [entryPoints.https.tls]

[retry]

[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "qwert.de"
watch = true
exposedbydefault = false

[acme]
email = "admin@qwert.ch"
storage = "acme.json"
entryPoint = "https"
OnHostRule = true
[acme.httpChallenge]
entryPoint = "http"

And then I started the container with the following docker-compose command:

version: '2'

services:
  traefik:
    image: traefik:latest
    restart: always
    ports:
      - 80:80
      - 443:443
    networks:
      - web
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /srv/docker/traefik/traefik.toml:/traefik.toml
      - /srv/docker/traefik/acme.json:/acme.json
    container_name: traefik

networks:
  web:
    external: true 

Everything works fine and I got the typical "404 page not found" message of traefik. Afterwards, I start a basic nginx container with the following code:

sudo docker run -d --label "traefik.frontend.rule=HOST:appone.qwert.ch" --network web nginx:latest

But when I now try to call the website appone.qwert.ch I also get the typical "404 page not found" message.

I don't know if I have to somehow configure the server with the new domain or if I did something wrong.

My /etc/hosts/ file looks as follows:

127.0.0.1       qwert.de  Linux-Server
127.0.1.1       Linux-Server
212.153.72.45   qwert.de Linux-Server

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

I'd really appreciate every reply.

  • What's the sgfs.ch domain? – grooveplex Mar 20 '18 at 21:36
  • Thanks for your answer. There I just tried something and forgot to redo it. So there, its also qwert.de. – M4SX5 Mar 20 '18 at 22:03
  • And the one in /etc/hosts is also correct? (ch instead of de) – grooveplex Mar 20 '18 at 22:04
  • Yes they are correct, sorry I forgot to change those ones... – M4SX5 Mar 20 '18 at 22:21
  • When I open the dashboard of traefik I can see, that the rule was correct set up. So the frontend Host rule is correct and also the ip address and the port of the backend are correct. But I still got the error message 404. Somehow traefik can't access the containers. – M4SX5 Mar 20 '18 at 22:23
0

You need to use Host instead of HOST

sudo docker run -d --label "traefik.frontend.rule=Host:appone.qwert.ch" --network web nginx:latest

  • Ah, thank you so much. This was the problem. Three capital letters to waste hours of my life... – M4SX5 Mar 27 '18 at 9:47

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.