Webserver Runs On Android Phone

Android, the popular mobile phone OS, is essentially just Linux with a nice user interface layer covering it all up. In theory, it should be able to do anything a normal computer running Linux could do. And, since most web servers in the world are running Linux, [PelleMannen] figured his Android phone could run a web server just as well as any other Linux machine and built this webpage that’s currently running on a smartphone, with an additional Reddit post for a little more discussion.

The phone uses Termux (which we’ve written about briefly before) to get to a Bash shell on the Android system. Before that happens, though, some setup needs to take place largely involving installing F-Droid through which Termux can be installed. From there the standard SSH and Apache servers can be installed as if the phone were running a normal Linux The rest of the installation involves tricking the phone into thinking it’s a full-fledged computer including a number of considerations to keep the phone from halting execution when the screen locks and other phone-specific issues.

With everything up and running, [PelleMannen] reports that it runs surprisingly well with the small ARM system outputting almost no heat. Since the project page is being hosted on this phone we can’t guarantee that the link above works, though, and it might get a few too many requests to stay online. We wish it were a little easier to get our pocket-sized computers to behave in similar ways to our regular laptops and PCs (even if they don’t have quite the same amount of power) but if you’re dead-set on repurposing an old phone we’ve also seen them used to great effect in place of a Raspberry Pi.

36 thoughts on “Webserver Runs On Android Phone

  1. Why not? Any smartphone outperforms some vCPU single core systems. Having a stable public IP and enough Network Traffic budget is more an issue if a real mobile connection is used.

    For me the page worked :-)

    1. yeah i came here to say the same thing. imagine being surprised that a 2020s cellphone is more powerful than the 386 i was running apache on (counting on my fingers…) 26 years ago

  2. Too bad that many of these smartphones are ending up as e-wastes. Hardware is totally capable, but without the mainline kernel, open-source modules, etc… repurposing is pretty difficult.

      1. I have an android tablet mounted to the wall in the bedroom. It’s main purpose is to display a full screen clock but I also have anag installed on it so it can monitor Nagios and wake us up if certain sensors I built around the house are tripped.

        This has saved our butts multiple times. Furnace failed in the middle of the night. I had an emergency call in to HVAC contractors immediately. Furnace was fixed and the house only lost 5F. We also had the sump pump go out when it was storming. Tablet woke us up when the water level sensor I built went above acceptable level. Queue emergency run to the store at 4am. Got home with a transfer pump with a few inches to spare before the pit overflowed.

    1. yeah i like to continue to use android devices but they are surprisingly single-use. the deep hardware integration needed to miniaturize them tends to make it so that any single failure makes it hard to repurpose them. my nexus 7 that i used as an alarmclock *became too slow to use as an alarmclock*, apparently from a hardware design flaw??? my moto x that i used as an alarmclock had such a severe spicy pillow that it destroyed the power button. and so on. they just don’t last. even if you’re willing to repair them, their failures tend to cascade. if you use one to drive a speaker over the network, you’ll find out its headphone jack fails. if you repair the headphone jack, you’ll find that you destroyed the battery and the wifi antenna during surgery.

      insult to injury, the OS is constantly trying to hurt you as well, so if you are ever forced to endure an upgrade, your old software setup simply won’t work. you can’t simply use a rotating cast of “your previous cellphone”, because the next one when it ages out of daily carry won’t be able to run the same software you used on the previous one. tbh, i feel almost as bad about android today as i did about windows 95 way back then.

      i’m back to using my 1991 sony dream machine.

  3. Last year I wanted to dump a 1.8V flash chip. Because using a level shifter would have been way to easy, I took a Galaxy A3 with broken screen from the drawer, installed postmarketOS, patched the devicetree to use some of the display IO signals as GPIO, patched flashrom to be able to bitbang via gpiod-GPIOs, and then dumped the flash: https://steve-m.de/pictures/galaxy_a3_flashrom.jpg

    Basically a Raspberry Pi with integrated battery.

    1. That is one cool project, how did you pull off the screen io part? Phones are treasure trove of cool sensors that can be reused. Fingerprint, and face sensors. I have Syncthing “NAS” and LAN camera running on mine.

      1. There is a big archive including many Samsung smartphone schematics floating around the web, which was very helpful. On the display connector you have several connections that are not high speed MIPI/DSI signals, like I2C for the touch digitizer and display, PWM for the backlight, as well as some other control signals. I then reconfigured those in he devicetree to be usable as GPIOs from userspace.

    2. I did the same with a broken Allwinner A13 tablet, bought a display connector to 2.54mm breakout, and changed the boot values to use those pins as GPIOs. Allwinner has some tooling to reconfigure the chip pins to other usage. I should write a blog post about it.

    1. The connection has timed out

      An error occurred during a connection to thin.computer.

      The site could be temporarily unavailable or too busy. Try again in a few moments.
      If you are unable to load any pages, check your computer’s network connection.
      If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the web.

      1. I also noticed the timeout. I speculated to some friends that, whereas in the old days some websites would end up being “Slashdotted”, perhaps nowadays the phenomenon should be called “Hackadayed”.

  4. This is hardly unusual. The open source AdAway app on Fdroid can optionally run a local webserver (listening on localhost only!) for rewritten ad links to point to.

    It’s not much of a stretch to put a full webserver listening on an external interface on an android phone from there.

  5. Yeah had to do something similar a few years ago when working with a game engine that would only run with server as host for files. Of course Chrome had some nonsense built in to refuse a local server so just set one up on my phone real quick and bada bing the engine was happy. Not really sure how this is new outside of software, but maybe it is easier and provides more tools.

  6. This is what happens when the editors don’t use Google:
    Digital Ocean has explanation how to do this using the same steps – since 2022.
    And there is AWebServer in Google Play store, which gives Apache + PHP7 + MariaDB. Yes, it has ads, but shows this is not something special.

  7. I used to run a voip service (asterisk) on my Samsung Galaxy S2 back in the day (2011 phone). Used an Ubuntu chroot as it’s waayy more flexible. Asked my ISP to allow inbound traffic to the (data-only) sim card, and used a ddns service to keep my IP info easily available. Was great fun having a live telecom server in mt pocket

  8. Well, Android is still Linux under the hood.
    My current side-project is to get Linux containers (LXC) working on a Galaxy S20+ Exynos phone. My particular unit has minor screen damage and a slightly swollen battery. It’s not economical to repair but still useful as a quite powerful little Linux box with an 8 core CPU and 12 GB of RAM. With charging disabled, the device uses very little power.
    I re-compiled some native Linux tools like OpenSSH and sudo against Android’s native bionic libc.
    With some trickery, I even got regular GNU libc and Debian arm64 binaries running without a chroot.
    But the LXC still doesn’t want to work despite me recompiling the kernel with all the required features enabled. I will get it going eventually, I’m sure about that.

  9. I used an old smartphone as a webcam with built in webserver about ten years ago. As far as I can remember all it took was installing an app for it, perhaps not from the store but side loading it.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.