我按照this tutorial中的说明将Traefik v1.7.6作为Docker容器安装。
一切正常,该网站访问:https://proxy.hostname.com
我想添加一个UniFi控制器容器来运行这个反向代理,但需要帮助我的配置。
在this tutorial之后,我能够创建一个功能容器并访问此站点:https://unifi.hostname.com:8443
端口8443是UniFi运行的本机Web管理端口,但这是我需要帮助的地方。
根据我的理解,我应该可以通过https://unifi.hostname.com的Traefik访问这个站点,然后被引导到后端正确的8443端口。其次,使用Let的加密的好处是丢失,因为它只向端口443上的子域提供证书。
这是我的docker-compose.yml
文件:
version: "3.6"
services:
unifi:
hostname: unifi
image: linuxserver/unifi:latest
restart: always
container_name: "unifi"
volumes:
- /docker/unifi:/config
ports:
- target: 3478
published: 3478
protocol: udp
mode: host
- target: 10001
published: 10001
protocol: udp
mode: host
- target: 8080
published: 8080
protocol: tcp
mode: host
- target: 8081
published: 8081
protocol: tcp
mode: host
- target: 8443
published: 8443
protocol: tcp
mode: host
- target: 8880
published: 8880
protocol: tcp
mode: host
- target: 6789
published: 6789
protocol: tcp
mode: host
networks:
- proxy
environment:
- PUID=1000
- PGID=1000
- TZ=America/New_York
labels:
- "traefik.enable=true"
- "traefik.tags=frontend"
- "traefik.frontend.passHostHeader=true"
- "traefik.admin.backend=unifi"
- "traefik.admin.frontend.rule=Host:unifi.hostname.com"
- "traefik.admin.port=8443"
- "traefik.admin.protocol=https"
networks:
proxy:
external: true
根据我自己的经验,代理UniFi控制器一直很痛苦,因为它使用了一个自带的自签名证书。通常,您必须指示代理在连接到其后端时忽略无效证书。
我建议你想要的是InsecureSkipVerify
选项,必须在traefik.toml
中启用。
insecureSkipVerify:如果设置为true,则接受后端无效的SSL证书。注意:这会禁用对中间人攻击的检测,因此只应在安全后端网络上使用。 - https://docs.traefik.io/configuration/commons/