Self-hosted web server on an Android STB
Turning an unrooted ZTE B860H Android TV box into a production web server with public HTTPS, a WAF, daily backups, and WhatsApp alerts — at zero hosting cost.
Tech stack
PHPMySQL / MariaDBLinuxNginxCloudflare
Problem
I wanted to run a real website and database without renting a VPS, using only inexpensive hardware I already had: a ZTE B860H Android TV box. The constraints were serious: no root access, small internal storage, a home connection behind CGNAT so ports cannot be opened, and no systemd.
Solution
Everything runs inside Termux: nginx, PHP-FPM 8.5, and MariaDB. An SD card serves as adoptable storage for more capacity and write endurance. Public access goes through a Cloudflare Tunnel, which provides HTTPS with no port forwarding and no public IP.
Architecture
- The Cloudflare Tunnel carries inbound HTTPS traffic to the local nginx, so no ports are open on the home network.
- Security layers: a Cloudflare WAF country rule and rate limit, plus pma-ban, a custom fail2ban-style script that blocks phpMyAdmin probing.
- Operations: auto-start through Termux:Boot, boot and health notifications over WhatsApp, daily database backups, and a netlink-based traffic monitor.
Results
- A public HTTPS site running 24/7 at zero hosting cost.
- The server recovers on its own after a power cut and sends a notification once it is back online.
- Daily database backups run automatically, and attack attempts are blocked before they reach the application.
- The project became a lab for networking, hardening, and server operations under tight resource limits.