Steps#
- login to cloudflare
- create tunnel
cloudflared tunnel create <tunnel-name>
- copy from config.yml
nano ~/.cloudflared/config.yml
- copy from cloudflared.service
nano ~/.cloudflared/cloudflared.service
- start cloudflared service
cp ~/.cloudflared/cloudflared.service ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now cloudflared
- set dns record for gatus,nvim,olivetin,ttyd
cloudflared tunnel route dns <tunnel-name> git-server
cloudflared tunnel route dns <tunnel-name> nvim
cloudflared tunnel route dns <tunnel-name> olivetin
cloudflared tunnel route dns <tunnel-name> ttyd
cloudflared tunnel route dns <tunnel-name> uptime-kuma
config.yml#
# tunnel-uuid can be known from ~/.cloudflared/<tunnel-uuid>.json
tunnel: <tunnel-uuid>
credentials-file: /home/<username>/.cloudflared/<tunnel-uuid>.json
ingress:
- hostname: "git-server.example.com"
service: http://localhost:1344
- hostname: "*.example.com"
service: http://localhost:1080
- service: http_status:404
cloudflared.service#
[Unit]
Description=cloudflared
Wants=network-online.target
After=network-online.target
[Service]
Restart=always
ExecStart=cloudflared tunnel run <tunnel-name>
[Install]
WantedBy=default.target