Android platform can be easily altered to meet most of our specifications. Today we'll launch a web server from an Android phone. We need
- Rooted Android Phone
- Android Terminal Emulator app by
- Internet connection on your phone (not through wifi)
- or ability to host Wi-Fi hotspot on phone
- Android SDK on the system
- "lophttpd" binaries from
Use winrar in windows or if you are on terminal emulator, navigate to the folder where you have downloaded the binaries
$tar -x -f lhttpd-android-bin-0.tar
Incase it doesn't work try
#tar -x -f lhttpd-android-bin-0.tar
#busybox tar -x -f lhttpd-android-bin-0.tar
Now we have to get the binaries into the phone. Use adb push if you are on Command Prompt
C:\<path-to-android-sdk>\platform-tools>adb.exe push C:\<path-to-decompressed-binaries-folder>\lhttpd /data/local/tmp
Or else if you already have path variable pointing to Android SDK
C:>adb.exe push C:\<path-to-decompressed-binaries-folder>\lhttpd /data/local/tmp
or else cp it using Terminal Emulator.
#cp lhttpd /data/local/tmp
#cp /sdcard/<path-to-decompressed-binaries/lhttpd /data/local/tmp
If you are on Command Prompt get adb shell. Connect your phone to computer using usb cable. Make sure you have enabled USB debugging. you'll find it under Settings > Applications > Development
or if path variable exists
you must now get $ prompt. Enter root by typing
Now whatever you are using you have access to the root shell. Change to the directory /data/local/tmp
Now lets run our web server
#./lhttpd -u root -i -R /sdcard -p 8000 -q
Now got to your browser on mobile and type
You must see this screen
Now if you are connected to internet on a data pack. Go to http://www.whatsmyip.org/ and copy down your IP.
Or enable Wi-Fi hotspot on your phone. You must find it in Settings > Wireless and Networks > Tethering & portable hotspot
Now open Terminal Emulator and type
Copy down IP address against wl0. Now connect your computer to the hotspot or Get it online and type in the IP address in the address bar.
Now that you have your own webserver. This thing is safe as it runs in a chroot ed environment. But I wouldn't recommend running it for long times as it isn't safe.
Incase you want to take a look at the source