In the latest episode of XDA TV [Adam Outler] turned his Android phone into a webserver. At first this might sound comical, but the ever-increasing power of our handhelds makes it a pretty legitimate option. It’s hard to come up with concrete uses off the top of our head, but we’re sure there’s value in being able to pull the phone out of your pocket and serve some content.
The app BotBrew Basil makes the installation process nearly automatic. It gives you point-and-click access to install the lighttpd webserver package and set the daemon to run automatically at boot time. That’s it! Of course you need to supply your own HTML to be served. [Adam] used an HTML5 website template for this.
Next you also need a way to resolve the address of the phone. In this case it’s assigned a static IP from the router, and a dynamic DNS service provides a link that maps to the router’s location. But since these phones are running Linux (at least on the lowest level) it should be pretty easy to add a cron job which will send IP address updates to the service if you want to take the ‘webserver’ out in the world with you. You can watch the entire video after the break.
Ironically this is a big hardware upgrade for [Adam’s] webserver. The previous version was running from an Evalbot.
Cool! Mobile and embedded devices becoming Web servers (in addition to Web clients) is the future and in my opinion quite important to enable an open Internet of Things. REST APIs for physical objects FTW!
Cool! With all the cheap android devices out there this could come in handy. Not sure how it would cope with a lot of traffic though.
Beowulf cluster
Strong bad, dude, strong bad.
So what? Even busybox has an httpd applet. And it’s actually running on my: TVs, Bluray Players, Android Phone and ADSL Router. (My washing machine is next) :D
Thats the convoluted method mentioned at the beginning of the video.
I could see something like this being used if one wants full control over content (to the physical level) yet allow access from anywhere in the world. Having the server on your person with a UI showing who is requesting what (along with reasonable timeouts) would allow the content owner to manage requests. The requests could even come in over SMS or Twitter and then get handed over to the web server if the intents were structured correctly.
I have lighttpd running on my Nokia N900 for about 2 years now. It was just an apt-get install away.
That this article is presented as “news” is just sad.
That OS is based on Debian. That’s not a hack when it comes with the OS. This is about an Android device which is not intended to be able to install command-line packages.
Nokia! What the heck happened there? Those guys had the best phones bar none, but they made more stupid strategic mistakes than even Novell. Insanity.
For a while, I figured Microsoft was secretly paying the CEO’s and boards of these firms to screw up their companies. The Maemo experience was a terrible mistake – people prefer lack of crashing and “it works as a phone” to every other aspect. And the guys doing the dev work for them to get that linux package going… such a loss!
It had so much promise – debian on a phone.
Google just took it way from them.
I know the carriers want total control, but given the rich feature set of the underlying hardware, I wish someone would have grabbed that guy by the throat and said “we’re going to build a very simple fixed-time-slot multitasking OS, and then gone all apple OS circa 1984 on it.
There is nothing people are doing with android or ios that couldn’t have been accomplished much more easily by providing a simple python/your language here/basic style scripting language and a simplified permissions model.
It’s a shame that all the spying on the user base and locking them down so that they can monetize features has shifted the market so much. We could be building cooler apps and getting them out much more quickly had they just taken the more obvious approach to raising revenues.
But Nokia… – I feel so jilted.
Also: “Tank, I need an opening!”
The Maemo experience was a terrible mistake – people prefer lack of crashing and “it works as a phone” to every other aspect. And the guys doing the dev work for them to get that linux package going… such a loss!
It had so much promise – debian on a phone.
Nokia did exactly that. Nokia N9 is the phone that “just works” as a phone (it even “just works” much more than any non-Linux (Android, iOS, WinXXX) phone) and have nearly Debian inside. And yes, you can “apt-get install apache” to it.
Just a note for IP discovery: don’t forget avahi/zeroconf. It’s a great solution if you’re on the same LAN (or on a bridged VPN etc.) with the device in question.
When Nokia released OpenC for Symbian, they ported Apache, MySQL and PHP. I had that running on my 5800 for a while, until the novelty wore off.
Fun stuff.
Now if only Android did proper hostnames so we wouldn’t have to rely on ddns or ip addresses.
If you really want to go simple..
python -m SimpleHTTPServer
My phone (Razr XT912) shipped with this preloaded. All I needed to make it work was a terminal emulator app that allowed me to get to a shell. Didn’t even need to be root. Its not full featured or anything, and probably not secure enough to use for hosting pages to the public internet, but for simplicity, it can’t be beat.
How’s the RAZR working for ya? I’ve had my eye on it as I am looking to finally get a smartphone this fall and have always loved em. Sounds good so far. Thanks :)
My Samsung Galaxy S2 does this – even runs PHP as well.
Piracy. You can use it for private filesharing with your friends. There, I said it.
I actually did this with an old jailbroken iPhone for a while, because I needed something I could leave on all the time, and it worked out rather well, after getting apache (yes, proper apache), PHP and ftpd loaded onto it. No MySQL though.
Pretty neat, this was one of the first things people would try out once they rooted their phones. There is a neat ssh server app so you can ssh into your phone, there is a neat web server app that enables file transfer between phone and pc through the browser – didn’t think it was too new, but cool nonetheless!
As far as being able to take this outside the home, I faced an issue that may be carrier dependent. My phone IP is actually not public when I’m using data. It’s behind some kind of carrier NAT, which sucks but oh well
This is interesting to me. Why do I need it
and what can I do with it exactly?
Gotta love Android. Not so much Google lol.
Running a web server on the device would allow browser-based apps to run when the device is offline — no network — instead of having a different native app for each type of device.
At the end of the video, it was mentioned that the sensors on the Android phone could be used as well? Can they be controlled through the desktop browser? How can that be accomplished?
I run a full RSS feed script. Useful ain’t it?