Turn Your Phone into a Portable Web Server

Wow I got excited tonight. I had this very crazy thought. I have always wanted to run a webserver on android, preferably an entire LAMP stack. Now there I only just realised it when writing this post that there is in fact an android webserver that does this (), however the reliability of this is dependant on the developer. Not to mention you need $2.60. If you however are a Linux enthusiast, don't have $2.60, want to run node.js instead, or just want to roll your own Linux stack, then read on.

So the other night I received my nexus 5, and with it I had plans to run on my nexus 4. I used it a bit, it was quite laggy when just trying to do simple things like browse the web, install new apps. I ran settings once and it froze up. But this isn't a post about Ubuntu Touch as a mobile experience. This is about Ubuntu Touch as a server. So what I decided to do, was log in over adb shell (or ssh, if you have the ssh server running on your device), and try install some common web packages. First of all I installed nodejs (I have fallen in love with it in recent weeks), and downloaded a github repo I have that simply runs a webserver on the localhost and lets you administer terminal commands. Once it was downloaded I checked the ip of my device on my wifi network with 'ip addr show dev wlan0'. I then started my node server with 'node server.js' and then the server was up and running. I could access it from my desktop on the same wifi network via the ip address of my server (and what port it was running on).

Just another note I was also able to install and run a mysql server on the device also.

I will now leave the rest up to you. Make your webserver run on your phone and take it with you wherever you go.

If you want me to do a proper write up of a step by step just ask me, I can't really be bothered writing out each command and everything if no one wants to know it (plus most of it is in the above paragraph, you just might need to use your google-fu).

Ubuntu Touch

Benjamin Kaiser

Benjamin Kaiser

Software Engineer working on the SharePoint team at Microsoft. I'm passionate about open source, slurpess, and Jesus.
Gold Coast, Australia

Post Comments