Welcome to the Future of Mobile Server Farms

by steve on November 27, 2013

I’ve turned my old iPhone 3G into a mobile Web server running MySQL, PHP and lighttp with WordPress!  (see screenshot)

Here’s how I did it:localhost

Step 1: Jailbreak

Jailbreak the thing. You need the freedom to fiddle deeper into the phone than Apple is interested in you fiddling.  As of November 2013, an iPhone 3G running iOS 4.2.1 is fairly old and finding a web page with instructions and working links to software isn’t so easy.  In fact, this was the hardest part of the process!

The jailbreak process uses a piece of software to get around Apple roadblocks and allow you to install non-Apple Store software on your phone.  Doing this will VOID THE WARRANTY on your phone, if you still have one.  You only want to do this if you’re the kind of a person who takes things apart and doesn’t mind if you break them while doing so.

Thoroughly warned???  Ok then, let’s get started.

First off, you’ll need a piece of software called “redsn0w“.

Where to download Redsn0w: http://www.iphonehacks.com/download-redsn0w

For my phone I chose Redsn0w 0.9.10b8b.  It’s possible a newer version would work, but I couldn’t seem to get a definitive answer.  This one worked for me.  You also need a file that describes the hardware of your particular device.  (It appears newer versions of Redsn0w now download this directly from Apple, but older versions require you have it on hand.)

I found a copy linked from this page: http://osxdaily.com/2010/11/22/ios-4-2-direct-download/


  1. Plug your phone into your computer.
  2. Now run Redsn0w.
  3. Choose “Jailbreak and install Cydia” and follow the instructions.

If all goes well your phone will reboot and you’ll see you have a new app called Cydia that lets you install non-Apple software.

Note: if you want to “unlock” your phone from your provider network, there’s another tool called Ultrasn0w which does this.  I haven’t tried it.

Step 2: SSH

First, let’s SSH from your computer to your iPhone.

 Here’s everything you need to know about setting that up.

In short:

  1. open Cydia
  2. install OpenSSH
  3. find your phone’s IP address
  4. SSH to that address with user: root and password: alpine

Now you rule your phone!

Step 3: Get all the softwares

Fortunately, someone’s done the real work for you.  You can get it all in one package: PHP, MySQL and Lighttpd through Cydia.

  1. Tell Cydia where to find the software by giving the following command in SSH:
  2. echo ‘deb http://ios-webstack.tk/cydia/ ./’ > /etc/apt/sources.list.d/ios-webstack.list
  3. Start Cydia
  4. Search for “touch-lighttpd-php-mysql” (for iPad or Apple TV see here)
  5. Install
  6. Heck, why not reboot the phone

Now when you point your browser to your phone’s IP address you’ll get a message letting you know it’s working.  Here’s what it looks like:

LAMP stack on iPhone screenshot


To actually *do* anything with this you’ll need a text editor.  Both of these you can install through Cydia:

  1. A version of Emacs called Mg: http://en.wikipedia.org/wiki/Mg_(editor) (I had trouble with this crashing)
  2. Nano: http://forums.macrumors.com/showthread.php?t=1061129
  3. Once you start looking, a surprising amount of *nix software is available through Cydia – check it out!

If you’ve gotten this far you can probably take it from here.  Some other things I’ve learned in the short time I’ve had this up and running:

  1. Web root is /var/www
  2. http://your_ip_addr/adminer.php?server=localhost will give you a web GUI for running MySQL commands if you don’t like to do that from the command line.  You can also use Cydia to install phpmyadmin.
  3. scp is a handy way to get files to and from your new phone-based server.
  4. If you let your phone go into one of the sleep modes, your server stops responding.  Oops.  Watch your battery.
  5. I setup a working WordPress server, and then changed networks.  Different IP, WordPress stops working.  Oops.  Another thing to watch out for.

Step 4: Now what?

That was very gratifying, but what to do with this new portable, battery powered web server?  My suggestions:

  1. Location based, pirate inter-webs.  Perhaps you can’t get permission at work to run a server and you have no place to hide a beige box.  Well, pretty easy to hide your phone!  Share the IP with your work chums and you can post funny photos of the boss on your own private Facebook.
  2. Off-the-net inter-webs.  Perhaps say, you’re at Burning Man.  You can’t get out to the greater network anyway, but you could have your own, without even needing a generator to run the equipment!  The iPhone has no moving parts – nothing to get gummed up with playa dust.  Now you’ve got your electronic camp info-hub.  Post the address and give the kiddies something to do with their smart phones.
  3. Run your own off-the-grid instant messaging service.  This is one of the things I’m personally working on setting up using this: https://www.erlang-solutions.com/products/mongooseim-massively-scalable-ejabberd-platform
  4. More ideas?  Send them to me here at sbp@tikimojo.com!



Comments on this entry are closed.

Previous post:

Next post: