2

我正在尝试用 Traefik 做一个反向代理,比如 Nginx。要恢复,我想要从某个端点到本地网络端口的代理请求,这恰好是带有 Traefik 的 SSH 隧道。

实际上它适用于 Nginx,但想停止使用 Nginx 而不是 Traefik。

我已经测试了一些配置,但是 Home Assistant Add-on (Autossh) 没有连接到它。(它在同一台服务器上与 Nginx 一起工作就像一个魅力)。

在这里,我的 Traefik 配置:

码头工人-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.api.rule=Host(`dashboard.domain.com`)"
    - "traefik.http.routers.api.service=api@internal"
    - "traefik.http.routers.api.entrypoints=http"

    - traefik.http.routers.nas.entrypoints=https
    - traefik.http.routers.nas.rule=Host(`home-assistant.domain.com`)
    - traefik.http.routers.nas.service=nas@file
    - traefik.http.routers.nas.tls=true
    - traefik.http.routers.nas.tls.certresolver=letsencrypt

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.letsencrypt.acme]
  email = "contact@domain.com"
  storage = "acme.json"
  [certificatesResolvers.letsencrypt.acme.httpChallenge]
    entryPoint = "http"

服务.toml

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

0 回答 0