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. The traefik container throws the following error message:
level:error msg="Error creating route for frontend frontend-HOST-qwert-de-0: error parsing rule: error parsing rule: 'HOST:qwert.de'. Unknown function: 'HOST'"
I don't know if I have to somehow configure the server with the new domain or what I did 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.
Best Answer
Here i'm using Host instead of HOST