Cloudflare is a popular web security and networking service that helps protect websites, improve performance, and create secure tunnels for local servers. It can also be used on Android devices to expose localhost servers to the internet, create temporary public URLs, and manage Cloudflare tunnels directly from the Termux terminal application.
Usage of Cloudflare in Termux
Cloudflared in Termux is mainly used to create secure tunnels between your Android device and the internet. For example, if you run an Apache, Python, PHP, Node.js, or any local web server inside Termux, Cloudflared can generate a public URL so other people can access your website or application from anywhere. Here is a short list of Cloudflare usage in Termux:
- Share localhost servers online.
- Create secure public tunnels.
- Test web applications from anywhere.
- Share Apache, PHP, and Node.js servers.
- Temporary website hosting.
- Secure HTTPS access to local servers.
- Learn networking and tunneling in Termux.
Installation Commands
First update and upgrade Termux packages:
pkg update && pkg upgrade -yInstall Cloudflared from the Termux repository:
pkg install cloudflared -yCheck installed version:
cloudflared --versionUsage Commands
Start a Python localhost server:
pkg install python && python -m http.server 8080Create a Cloudflare Quick Tunnel:
cloudflared tunnel --url http://localhost:8080Create tunnel for Apache server:
cloudflared tunnel --url http://localhost:80Start PHP localhost server:
php -S localhost:8000Create tunnel for PHP server:
cloudflared tunnel --url http://localhost:8000Create tunnel for Node.js applications:
cloudflared tunnel --url http://localhost:3000Create tunnel using IPv4 mode:
cloudflared tunnel --url http://localhost:8080 --edge-ip-version 4Login to Cloudflare account:
cloudflared tunnel loginCreate a named tunnel:
cloudflared tunnel create mytunnelList all created tunnels:
cloudflared tunnel listRun a named tunnel:
cloudflared tunnel run mytunnelDelete a named tunnel:
cloudflared tunnel delete mytunnelShow Cloudflared version:
cloudflared --versionShow all Cloudflared commands:
cloudflared --helpStop a running tunnel:
Press
CTRL + C
Cloudflare in Termux is a useful way to share localhost servers, test websites online, and create secure public tunnels directly from Android devices. It is simple to use and helps beginners learn web hosting, networking, and remote access using the Termux application.

