LmCast :: Stay tuned in

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
this webpage is hosted on a drawer-bound fairphone 2 from 2015, running postmarketos
in this tutorial you will be guided through the steps taken to get there
you will end up with a small home server, able to run basic services
we aim to reduce e-waste, encourage reuse and give a second life to forgotten chips
you will need

an unused android phone
a charger and power source
a wifi connection
a computer running linux (natively or in a virtual machine)

step 1: installing postmarketos
first step is installing postmarketos on your phone
find your device in the devices page and verify that your device is properly supported
keep that page open throughout the installation
install pmbootstrap, the main command-line application for postmarketos
we'll first generate the image, then flash it to the device
generate the image
update the ports and initialize your device information:
$ pmbootstrap pull
$ pmbootstrap init

when asked for the codename for your device, provide the one listed in your device's page you opened above
when asked for which user interface to use, you can choose console (which should be the most minimal option) or fbkeyboard to have a minimal keyboard on-screen (which you shouldn't have to use thanks to ssh, but just in case, it's fun)
generate the image:
$ pmbootstrap install

flash the image
check your device's page for how to boot your device in flash mode
usually this means powering the device on with the "volume down" button pressed
connect the phone into your computer and boot it in flash mode
next, check the Installation section of the page and follow any instructions listed there
finally, if you have not already, flash the image to the device:
$ pmbootstrap flasher flash_rootfs

then, reboot the device and verify that postmarketos starts-up correctly

step 2: setting up your server
now that your phone is postmarketos'ed, let's log into it
the default postmarketos username/password combination is user/147147
keep the phone connected to your computer and ssh into it:
$ ssh user@172.16.42.1

connect the phone to your wifi network:
$ nmcli device wifi connect your_wifi_network --ask

congrats, you now officially have a little local phone server
running this command should show you the phone's local ip address:
$ ip -4 addr show wlan0 | grep inet | awk '{print $2}' | cut -d'/' -f1

on a typical home router it will have the form 192.168.1.x
you can now plug the phone somewhere safe and connect to it via wifi:
ssh user@192.168.1.x

step 3: serving a web page
create the /var/www/html/ directory:
sudo mkdir -p /var/www/html/

write a simple hello world html file:
$ sudo sh -c 'echo "<h1>hello world</h1>" > /var/www/html/index.html'

add a nftables rule to allow incoming packets on port 80, in /etc/nftables.d/99_http.nft:
inet filter input tcp dport 80 ct state new accept

then restart nftables:
$ sudo systemctl restart nftables

run the following to launch your webserver:
$ httpd -h /var/www/html/

test out the server by curling the website from your computer:
$ curl 192.168.1.x

you should see the <h1>hello world</h1> text from above
now type the ip address in the web browser of any device connected to the same wifi network, and marvel at your own tiny local digital garden
note that this http server will not be automatically restarted if your phone reboots for any reason

extra: remote access
as a preemptive security measure, i would recommend not to open port 22 (used for ssh) to the wider internet
instead you should set up a vpn access to your router box (most support this on their web interfaces) if you need remote access
once you are connected to your local network, access the phone using ssh as before
if you know what you are doing and still want to open up port 22 to the internet, remember to disable password login and set up ssh keys

extra: maintenance
to update the packages on your server, run:
$ sudo apk update
$ sudo apk upgrade

next steps
In the advanced part of this tutorial (still under construction), you will learn how to:

setup a domain and https
make the http server persist after reboot

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.