Skip to content

Instantly share code, notes, and snippets.

@moocluck
Last active April 2, 2024 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moocluck/67e858895fd103b60c9866b3fae0bdb9 to your computer and use it in GitHub Desktop.
Save moocluck/67e858895fd103b60c9866b3fae0bdb9 to your computer and use it in GitHub Desktop.
Traefik and 3x-ui configuration
version: "3"
services:
3x-ui:
image: ghcr.io/mhsanaei/3x-ui:latest
container_name: 3x-ui
volumes:
- $PWD/db/:/etc/x-ui/
- $PWD/cert/:/root/cert/
environment:
XRAY_VMESS_AEAD_FORCED: "false"
restart: unless-stopped
networks:
- traefik
labels:
- "traefik.enable=true"
# Web panel
- "traefik.http.routers.xui-web.service=xui-web"
- "traefik.http.routers.xui-web.entrypoints=https"
- "traefik.http.routers.xui-web.rule=Host(`reality.{mydomain}.io`)"
- "traefik.http.services.xui-web.loadbalancer.server.port={myport-1}"
# Subscriptions
- "traefik.http.routers.xui-sub.service=xui-sub"
- "traefik.http.routers.xui-sub.entrypoints=https"
- "traefik.http.routers.xui-sub.rule=Host(`sub-reality.{mydomain}.io`)"
- "traefik.http.services.xui-sub.loadbalancer.server.port={myport-2}"
# Reality
- "traefik.tcp.routers.xui-reality.service=xui-reality"
- "traefik.tcp.routers.xui-reality.entrypoints=https"
- "traefik.tcp.routers.xui-reality.rule=HostSNI(`microsoft.com`)"
- "traefik.tcp.routers.xui-reality.tls=true"
- "traefik.tcp.routers.xui-reality.tls.passthrough=true"
- "traefik.tcp.services.xui-reality.loadbalancer.server.port=443"
networks:
traefik:
external: true
version: '3'
services:
traefik:
container_name: traefik
image: traefik:v2.11
ports:
- 80:80
- 443:443
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./data/traefik.yml:/etc/traefik/traefik.yml:ro
- ./data/logs/:/var/log/traefik/:ro
- ./data/acme.json:/etc/traefik/acme.json:ro
- ./data/config/:/etc/traefik/config/:ro
networks:
- traefik
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.entrypoints=https"
- "traefik.http.routers.traefik.rule=Host(`traefik.{mydomain}.io`)"
- "traefik.http.routers.traefik.service=api@internal"
- "traefik.http.middlewares.traefik-auth.basicauth.users={login}:{password}"
- "traefik.http.routers.traefik.middlewares=traefik-auth"
restart: unless-stopped
networks:
traefik:
name: traefik
global:
checkNewVersion: true
sendAnonymousUsage: false
api:
dashboard: true
entryPoints:
http:
address: ":80"
http:
redirections:
entryPoint:
to: https
scheme: https
https:
address: ":443"
http:
tls:
options: default
certResolver: letsencrypt
providers:
docker:
watch: true
network: traefik
exposedByDefault: false
certificatesResolvers:
letsencrypt:
acme:
email: {myemail}
storage: acme.json
httpChallenge:
entryPoint: http
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment