Going further
Installing Termux API (optional)
For more advanced uses, Termux works best in combination with its sister app, Termux API Termux API allows you to control some of the phones’ hardware features, such as vibration, the camera, etc. Find documentation here.
!!! note “Double install We have to install it twice: first the app, via F-DROID (step 1.) gives us access to the phones inner features. Then inside Termux (step 7.) to be able to call the API via the Terminal.
- Go to F-Droid and download Termux API
- Download the stable (suggested) version (not beta) by selecting
Download APK. - Once downloaded, tap the APK on your device. If you don’t find it go to your Files app, under Downloads.
- Click install (with the package manager) and approve authorisations
- Open Termux API: Tap Termux API app on you home screen, you will be redirected to the settings
- In the settings, change the following: - Disable battery optimisation - Allow display over other app

- Leave Termux API and open Termux via the home-screen.
- Type the following, press enter and wait for the download to happen
pkg update && pkg upgrade -y
- Once you can type again, enter the following command, press enter and wait.
pkg install termux-api
If you were successful, you should be able to command your phone to vibrate! Type and enter:
termux-vibrate
Creating a complete website on a computer
Creating a fully fledged webpage might be a bit tricky using a phones’ keyboard and a basic nano editor. Consider switching to a computer and uploading content to your phone remotely using the following instructions.
Code editor
Wip
Downloading a code editor part
A Code Editor to edit HTML (VS codium, Sublime Text, etc.)
Uploading files via SFTP
Whether you want to upload an existing static website (a folder with HTML files, images, CSS files, etc.) or you want to do make a new page, it’s easier to do so on your laptop and transfer the files over SSH via the SSH File Transfer Protocol (SFTP).
Run a SSH server on your phone
We will need an SSH server on our phone, to be able to communicate via ssh to our laptop. 1. In termux, type + enter, to find out your phone username for ssh
whoami
Write down the result for later, it should be similar to: u0_a96
- Set a password with passwd:
- Install termux-auth and then you can use passwd:
pkg install termux-auth -y
passwd
- Type your password + enter / Type again to confirm
- Write it down somewhere to remember it
- If not done already, install OpenSSH:
pkg install openssh -y
- Identify the local IP address of your phone by typing + enter. It’s the one written after _
wlan0: ... inet... and probably looks like: 192.168.XX.XX_
ifconfig
- Write it down the IP address to remember it.
- Start the ssh server:
sshd
Upload via Filezilla
Once your phone is setup to receive ssh connection, head over to your laptop:
- Download FileZilla or another SFTP/FTP client on your laptop.
- In FileZilla, select File > Site Manager > New Site:
- Fill in the following fields in the site manager and hit enter:
- Protocol: SFTP
- Host: the local IP address of your phone server
192.168.XX.XX- User: your ssh username (see SSH section) - Password: your ssh password (see SSH section) - Port: 8022 - Once connected, navigate in the folders on your phone into where nginx hosts the webservers files:
- In the right panel: enter the path in the search bar:
/data/data/com.termux/files/usr/share/nginx/html, or navigate to the same folder using the file manager tree interface. - On the left panel, navigate in your laptop folders to find the website files/folder you’d like to upload.
- You can now drag and drop files and folders into the html folder, or the other way around. Do not delete the html folder.
Alternative reverse-proxy configurations
There are other (commercial) reverse proxy tools, some of them are available in this comprehensive list.
Using localhost.run
- In Termux, type and enter:
shell
$ ssh -R 80:localhost:8080 localhost.run
-
Type yes + enter to connect.
-
You will get a temporary domain name to looks something like https://46dd096d0d85c2.lhr.life. If you want to add a custom domain you will have to pay.
Using ngrok
Ngrok is a US commercial reverse proxy tool, so you have to install it, create and account.
- Install ngrok in Termux, type each command, press enter and continue
shell
pkg update -y
pkg install git -y
git clone https://github.com/Yisus7u7/termux-ngrok
cd termux-ngrok
bash install.sh
- Sign-up to ngrok:
- Visit
- Sign-up and verifiy your email address.
- Copy your auth-token in the relevant section and add it to the config: - Enter the following command, replacing [auth-token] by the auth-token you just copy-pasted.
shell
$ ngrok config add-authtoken [auth-token]
4. under static domain copy and paste the command, changing port 80 to port 8080
$ ngrok http --url=gorilla-champion-tomcat.ngrok-free.app 8080
Check ngrok configuration and paid tiers to get more advanced configuration. For example, to set a custom domain