How to repurpose your old phone into a web server
Recorded: Nov. 26, 2025, 1:03 a.m.
| Original | Summarized |
farphone back to home how to repurpose your old phone into a web server an unused android phone step 1: installing postmarketos when asked for the codename for your device, provide the one listed in your device's page you opened above flash the image then, reboot the device and verify that postmarketos starts-up correctly step 2: setting up your server connect the phone to your wifi network: congrats, you now officially have a little local phone server on a typical home router it will have the form 192.168.1.x step 3: serving a web page write a simple hello world html file: add a nftables rule to allow incoming packets on port 80, in /etc/nftables.d/99_http.nft: then restart nftables: run the following to launch your webserver: test out the server by curling the website from your computer: you should see the <h1>hello world</h1> text from above extra: remote access extra: maintenance next steps setup a domain and https built by louis merlin under the cc by-nc-sa 4.0 license |
This webpage guides the reader through repurposing an older Fairphone 2, running PostmarketOS, into a functional web server. The project aims to reduce e-waste and extend the lifespan of older devices, offering a practical application for technology. The tutorial is broken down into three steps: initial PostmarketOS installation, server setup and configuration, and finally, serving a basic web page. Initially, the user must install PostmarketOS on the phone utilizing the `pmbootstrap` command-line application. This process involves generating an image for the device, followed by flashing it. During the initial setup, critical information like the device’s codename, which must be obtained from the device’s support page, is required. The user is presented with choices for the user interface; a minimal console or the optional on-screen keyboard, although the author recommends using SSH which is the most efficient method. The final step of flashing the image is completed with the command `pmbootstrap flasher flash_rootfs`, followed by a reboot to verify the system's startup. Following the installation, the user is guided through setting up the server. Establishing a connection to the phone’s local network is achieved by logging in via SSH using the default username ‘user’ and password ‘147147’. The phone’s local IP address, typically within the 192.168.1.x range, is then retrieved. The user is instructed to connect the phone to a Wi-Fi network and subsequently connect to it from another device via SSH, effectively establishing the server. The core of the tutorial concentrates on serving a simple web page. The user is prompted to create the directory `/var/www/html/`, then uses the command `sudo sh -c 'echo "<h1>hello world</h1>" > /var/www/html/index.html'` to create a basic “hello world” HTML file. Further configuration involves adding an `nftables` rule to allow incoming traffic on port 80, enhancing the server's ability to handle web requests. Finally, the user initiates the webserver using the command `httpd -h /var/www/html/`, and tests its functionality by accessing the website via `curl`, confirming that the “hello world” content is successfully served. The user is encouraged to appreciate the achievement of creating a tiny local digital garden. The author emphasizes that the webserver will not automatically restart upon reboot, highlighting a potential maintenance concern. Furthermore, the tutorial provides important supplementary sections. A “Remote Access” suggestion recommends against opening port 22 (used for SSH) directly to the internet, advocating for VPN access to the router instead as a security measure. The author also addresses maintenance, detailing the commands for updating package installations via `sudo apk update` and `sudo apk upgrade`. The tutorial also outlines planned advanced features, including domain setup with HTTPS and persistent webserver functionality. This project, conceived and executed by Louis Merlin, demonstrates the feasibility of extending the life of older devices through creative repurposing powered by open-source operating systems. |