我通过以下命令使用预构建的二进制文件(v1.6.4)启动Traefik:
./traefik_linux-amd64 --configFile=traefik.toml
traefik.toml文件:
defaultEntryPoints = ["http"]
[entryPoints]
[entryPoints.http]
address = ":11111"
[backends]
[backends.abcd]
[backends.abcd.servers]
[backends.abcd.servers.server0]
url = "http://10.0.3.192:80"
[frontends]
[frontends.frontend1]
backend = "abcd"
[frontends.frontend1.routes.abcd]
rule = "Path:/abcd"
卷曲http://localhost:11111/abcd -v
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 11111 (#0)
> GET /abcd HTTP/1.1
> Host: localhost:11111
> User-Agent: curl/7.47.0
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Content-Type: text/plain; charset=utf-8
< X-Content-Type-Options: nosniff
< Date: Mon, 25 Jun 2018 02:00:27 GMT
< Content-Length: 19
<
404 page not found
* Connection #0 to host localhost left intact
服务正在http://10.0.3.192:80(在lxc容器内部)运行,并且如果我直接卷曲: 卷曲http://10.0.3.192 -v
* Rebuilt URL to: http://10.0.3.192/
* Trying 10.0.3.192...
* Connected to 10.0.3.192 (10.0.3.192) port 80 (#0)
> GET / HTTP/1.1
> Host: 10.0.3.192
> User-Agent: curl/7.47.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Mon, 25 Jun 2018 01:58:12 GMT
< Content-Length: 34
< Content-Type: text/plain; charset=utf-8
<
* Connection #0 to host 10.0.3.192 left intact
<snip / garbage out>
我在配置文件上应该做的其他事情吗?
编辑:已解决。查看评论。