Files
testvue/traefik-example/docker-compose.yml
Carmine Savino 2eddd152d7
Some checks failed
Build and Deploy / deploy (push) Has been cancelled
Build and Deploy / build (push) Has been cancelled
first commit
2026-01-23 09:59:19 +01:00

67 lines
2.1 KiB
YAML

# Esempio di configurazione Traefik
# Da usare come riferimento per configurare Traefik sul server di produzione
version: '3.8'
services:
traefik:
image: traefik:v2.10
container_name: traefik
restart: unless-stopped
security_opt:
- no-new-privileges:true
command:
# Dashboard
- "--api.dashboard=true"
# Provider Docker
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--providers.docker.network=traefik-network"
# Entrypoints
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
# Redirect HTTP to HTTPS
- "--entrypoints.web.http.redirections.entryPoint.to=websecure"
- "--entrypoints.web.http.redirections.entryPoint.scheme=https"
# Let's Encrypt
- "--certificatesresolvers.letsencrypt.acme.email=tua-email@example.com"
- "--certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json"
- "--certificatesresolvers.letsencrypt.acme.httpchallenge=true"
- "--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web"
# Logs
- "--log.level=INFO"
- "--accesslog=true"
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./letsencrypt:/letsencrypt
networks:
- traefik-network
labels:
# Dashboard (opzionale, rimuovi in produzione se non necessario)
- "traefik.enable=true"
- "traefik.http.routers.dashboard.rule=Host(`traefik.tuodominio.com`)"
- "traefik.http.routers.dashboard.entrypoints=websecure"
- "traefik.http.routers.dashboard.tls=true"
- "traefik.http.routers.dashboard.tls.certresolver=letsencrypt"
- "traefik.http.routers.dashboard.service=api@internal"
# Autenticazione basic per dashboard
# Username: admin, Password: changeme (genera il tuo con: htpasswd -nb admin password)
- "traefik.http.routers.dashboard.middlewares=dashboard-auth"
- "traefik.http.middlewares.dashboard-auth.basicauth.users=admin:$$apr1$$8EVjn/nj$$GiLUZqcbueTFeD23SuB6x0"
networks:
traefik-network:
external: true