3

我正在寻找使用 Traefik 的解决方案来做我自己的 Ngrok 替代方案。我在另一台服务器上安装了多个带有 Autossh 插件的家庭助理,并希望通过输入 url 来访问它:home-assistant.server.com

Authssh 在 ssh 端口 (22) 上配置了远程转发端口:44400:localhost:8123。

我找到了这个 Traefik 配置(Traefik V1),但想使用 Traefik V2。我使用新的 Traefik 配置获得了一个错误网关。

你有什么解决办法吗?谢谢。

在这里,我的 Traefik V2 配置:

traefik.toml

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

[api]

[providers.docker]
  endpoint = "unix:///var/run/docker.sock"

[providers.file]
  filename = "/etc/traefik/services.toml"

[certificatesResolvers.mycertificate.acme]
  email = "contact@server.com"
  storage = "acme.json"
  [certificatesResolvers.mycertificate.acme.httpChallenge]
    entryPoint = "http"

服务.toml

[http]
  [http.services]
    [http.services.nas]
      [http.services.nas.loadBalancer]
        [[http.services.nas.loadBalancer.servers]]
          url = "http://localhost:44400"

码头工人-compose.yml

version: '3.7'

services:
  reverse-proxy:
    restart: always
    image: traefik:chevrotin
    ports:
    - "443:443"
    - "80:80"
    volumes:
    - /srv/traefik.toml:/etc/traefik/traefik.toml
    - /srv/services.toml:/etc/traefik/services.toml
    - /var/run/docker.sock:/var/run/docker.sock
    - /srv/acme.json:/acme.json
    labels:
    - traefik.http.routers.nas.entrypoints=https
    - traefik.http.routers.nas.rule=Host(`home-assistant.server.com`)
    - traefik.http.routers.nas.service=nas@file
    - traefik.http.routers.nas.tls=true
    - traefik.http.routers.nas.tls.certresolver=mycertificate
4

0 回答 0