我设法使用我的域(https://MY-DOMAIN.COM)设置反向代理,我认为我读到它也可以访问我本地网络上的服务( http://192.168.0.5:8123或http://my-server.local:8123),而不仅仅是外部通过https。
任何人都知道这是否属实,如果是,我该怎样设置?
这是我的docker-compose.yml代码:
version: '3'
networks:
proxy:
external: true
services:
reverse-proxy:
container_name: ReverseProxy
image: traefik
restart: always
command: --web --docker
ports:
- 8080:8080
- 80:80
- 443:443
networks:
- proxy
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ~/docker/traefik/traefik.toml:/traefik.toml
- ~/docker/traefik/acme.json:/acme.json
homeassistant:
image: homeassistant/home-assistant
container_name: home-assistant
restart: unless-stopped
networks:
- proxy
expose:
- 8123
volumes:
- ~/docker/homeassistant:/config
- /etc/localtime:/etc/localtime:ro
labels:
- "traefik.backend=home-assistant"
- "traefik.docker.network=proxy"
- "traefik.frontend.rule=Host:MY-DOMAIN.COM"
- "traefik.enable=true"
- "traefik.port=8123"
- "traefik.default.protocol=http"
这是我的traefik.toml代码:
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]
[web]
address = ":8080"
[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "MY-DOMAIN.COM"
watch = true
exposedbydefault = false
[acme]
email = "MY-EMAIL-ADDRESS"
storage = "acme.json"
entryPoint = "https"
OnHostRule = true
[acme.httpChallenge]
entryPoint = "http"
[[acme.domains]]
main = "MY-DOMAIN.COM"
答案 0 :(得分:0)
在您的家庭辅助docker-compose配置中,更改以下内容,以允许主机将8123映射到容器。
来自:
expose:
- 8123
收件人:
ports:
- "8123:8123"
来源:What is the difference between docker-compose ports vs expose