In Termux, issue:
pkg upgrade
pkg install cloudflared
After installing Cloudflared, you need to create a Cloudflare tunnel.
-
Navigate to
Networks -> Tunnels -> Create a tunnel
. -
Fill in a name you like and save the tunnel.
-
Find the code block below:
OR run the tunnel manually in your current terminal session only:
-
Make note of the your
<TOKEN>
which comes aftercloudflared tunnel run --token
- Create a folder for logging:
mkdir -p $PREFIX/var/service/cloudflared/log
- Symlink logger:
ln -sf $PREFIX/share/termux-services/svlogger $PREFIX/var/service/cloudflared/log/run
- Create the run file:
nano $PREFIX/var/service/cloudflared/run
- With the following contens:
#!/bin/bash
exec cloudflared tunnel run --token TOKEN
where TOKEN
is from tunnel setup.
- Make it executable:
chmod +x $PREFIX/var/service/cloudflared/run
- Start the Service:
sv up cloudflared
- You can also check the status with:
sv status cloudflared
- And enable service with:
sv-enable cloudflared
Follow simple instructions provided on: