Skip to content

traefik config

cc main.yml

yml
# vim middlewares.yml
http: 
  middlewares:
    cc-to-cn:
      redirectRegex:
        regex: "^https://([a-zA-Z0-9-]+\\.)?q123q\\.cc/(.*)"
        replacement: "https://${1}q123q.cn/${2}"
        permanent: true
yml
# vim wanx.yml
http:
  routers:
    wanx:
      rule: "Host(`wanx.q123q.cc`)"
      entryPoints:
        - websecure
      tls: 
        certResolver: le
      middlewares:
        - cc-to-cn
      service: noop@internal

    w25:
      rule: "Host(`w25.q123q.cc`)"
      entryPoints:
        - websecure
      tls: 
        certResolver: le
      middlewares:
        - cc-to-cn
      service: noop@internal

    hlx:
      rule: "Host(`hlx.q123q.cc`)"
      entryPoints:
        - websecure
      tls: 
        certResolver: le
      middlewares:
        - cc-to-cn
      service: noop@internal
yml
# vim fed.yml
http:
  routers:
    fed:
      rule: "Host(`fed.q123q.cc`)"
      entryPoints:
        - websecure
      tls: 
        certResolver: le
      middlewares:
        - cc-to-cn
      service: noop@internal
yml
# vim demo.yml
http:
  routers:
    demo:
      rule: "Host(`demo.q123q.cc`)"
      entryPoints:
        - websecure
      tls:
        certResolver: le
      middlewares:
        - cc-to-cn
      service: noop@internal
yml
# vim show.yml
http:
  routers:
    show:
      rule: "Host(`show.q123q.cc`)"
      entryPoints:
        - websecure
      tls:
        certResolver: le
      middlewares:
        - cc-to-cn
      service: noop@internal
yml
# vim w24.yml
http:
  routers:
    w24:
      rule: "Host(`w24.q123q.cc`)"
      entryPoints:
        - websecure
      tls:
        certResolver: le
      middlewares:
        - cc-to-cn
      service: noop@internal
yml
# vim q123q.yml
http:
  routers:
    q123q:
      rule: "Host(`q123q.cc`)"
      entryPoints:
        - websecure
      tls:
        certResolver: le
      middlewares:
        - cc-to-cn
      service: noop@internal

api.yml

todo

yml
http:
  routers: 
    api:
      rule: Host(`local.q123q.cc`) && PathPrefix(`/api`)
      entryPoints: 
        - websecure
      service: noop
      tls: {} 

  services:
    noop:
      loadBalancer:
        servers:
          - url: http://127.0.0.1

static-nginx.yml

yml
http:
  routers:  
    frontend-http:
      rule: Host(`local.q123q.cc`) && PathRegexp(`^/(panorama|admin|docs)`)
      entryPoints:
        - web
      service: static-nginx

    frontend-https:
      rule: Host(`local.q123q.cc`) && PathRegexp(`^/(panorama|admin|docs)`)
      entryPoints:
        - websecure
      service: static-nginx
      tls: {} 

  services:  
    static-nginx:
      loadBalancer:
        servers:
          - url: http://static-nginx:80

gitea

yml
http:
  routers:
    gitea-http:
      rule: Host(`git.local.q123q.cc`)
      entryPoints:
        - web
      middlewares:
        - redirect-to-https
      service: gitea

    gitea-https:
      rule: Host(`git.local.q123q.cc`)
      entryPoints:
        - websecure
      service: gitea
      tls: {}

  services: 

    gitea:
      loadBalancer:
        servers:
          - url: http://gitea:3000

woodpecker-ci

yml
http:
  routers:
    woodpecker-http:
      rule: Host(`ci.local.q123q.cc`)
      entryPoints:
        - web
      middlewares:
        - redirect-to-https
      service: woodpecker

    woodpecker-https:
      rule: Host(`ci.local.q123q.cc`)
      entryPoints:
        - websecure
      service: woodpecker
      tls: {}

  services:
    woodpecker:
      loadBalancer:
        servers:
          - url: http://woodpecker-server:8000

middlewares.yml

yml
http:
  middlewares: 
    redirect-to-https:
      redirectScheme:
        scheme: https

traefik-dashboard

dashboard 并不建议线上开放,所以仅供参考。

yml
http:
  routers:
    traefik-dashboard:
      rule: PathPrefix(`/dashboard`) || PathPrefix(`/api`)
      entryPoints:
        - web
      service: api@internal
      priority: 100