Cloudflare in Termux – Basic Commands & Usage Guide

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 -y

Install Cloudflared from the Termux repository:

pkg install cloudflared -y

Check installed version:

cloudflared --version

Usage Commands

Start a Python localhost server:

pkg install python && python -m http.server 8080

Create a Cloudflare Quick Tunnel:

cloudflared tunnel --url http://localhost:8080

Create tunnel for Apache server:

cloudflared tunnel --url http://localhost:80

Start PHP localhost server:

php -S localhost:8000

Create tunnel for PHP server:

cloudflared tunnel --url http://localhost:8000

Create tunnel for Node.js applications:

cloudflared tunnel --url http://localhost:3000

Create tunnel using IPv4 mode:

cloudflared tunnel --url http://localhost:8080 --edge-ip-version 4

Login to Cloudflare account:

cloudflared tunnel login

Create a named tunnel:

cloudflared tunnel create mytunnel

List all created tunnels:

cloudflared tunnel list

Run a named tunnel:

cloudflared tunnel run mytunnel

Delete a named tunnel:

cloudflared tunnel delete mytunnel

Show Cloudflared version:

cloudflared --version

Show all Cloudflared commands:

cloudflared --help

Stop 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.

SHARE THIS POST: