簡體   English   中英

讓Dockerised站點在Traefik反向代理后面運行

[英]Getting a Dockerised site to run behind Traefik reverse proxy

我按照本教程中的說明將Traefik v1.7.6安裝為Docker容器。

一切正常,該網站訪問: https//proxy.hostname.com

我想添加一個UniFi控制器容器來運行這個反向代理,但需要幫助我的配置。

按照本教程 ,我可以創建一個功能容器並訪問該站點: https//unifi.hostname.com8443

端口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啟用traefik.toml

insecureSkipVerify:如果設置為true,則接受后端無效的SSL證書。 注意:這會禁用對中間人攻擊的檢測,因此只應在安全后端網絡上使用。 - https://docs.traefik.io/configuration/commons/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM