Skip to content

Instantly share code, notes, and snippets.

@SwagDevOps
Last active February 13, 2025 15:13
Show Gist options
  • Save SwagDevOps/cecb0ca0b4c62e4fd65dff2829f7b920 to your computer and use it in GitHub Desktop.
Save SwagDevOps/cecb0ca0b4c62e4fd65dff2829f7b920 to your computer and use it in GitHub Desktop.
vim /etc/systemd/system/traefik.service
systemctl daemon-reload
useradd -r -s /bin/false -U -M traefik
mkdir -pv /etc/traefik/storage
mkdir -pv /var/log/traefik/
chown -Rfv traefik:traefik /etc/traefik/ /var/log/traefik/
# file: /etc/systemd/system/traefik.service
[Unit]
Description=Traefik
Documentation=https://doc.traefik.io/traefik/
After=network-online.target
[Service]
User=traefik
AmbientCapabilities=CAP_NET_BIND_SERVICE
Type=notify
ExecStart=/usr/local/bin/traefik
Restart=always
WatchdogSec=1s
ProtectHome=true
PrivateDevices=true
ProtectKernelTunables=true
ProtectControlGroups=true
ProtectSystem=strict
ReadWritePaths=/var/log/traefik/ /etc/traefik/storage/
InaccessibleDirectories=/boot /home /media /mnt /opt /root
ReadOnlyDirectories=/bin /etc /lib -/lib64 /sbin /usr /var
[Install]
WantedBy=multi-user.target
# file: /etc/traefik/traefik.yml
entryPoints:
glug:
address: ":258"
web:
address: ":80"
http:
redirections:
entryPoint:
to: "web-sec"
scheme: "https"
permanent: true
web-sec:
address: ":443"
certificatesResolvers:
letsencrypt:
acme:
email: [email protected]
storage: /etc/traefik/storage/acme.json
httpChallenge: { entryPoint: web }
api:
dashboard: true
debug: true
insecure: false
providers:
file:
directory: "/etc/traefik/providers/"
watch: true
log:
filePath: "/var/log/traefik/messages.log"
level: "DEBUG"
noColor: true
compress: true
maxAge: 7
maxSize: 500
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment