From the office of "We do this because we can" comes the ability to run a web server on an Android device. But this isn't just any old web server—this is one powered by Apache. The server in question is HTTP Server powered by Apache and it can be found on the Google Play Store. This server is based on Apache 2.2 and does a great job of serving up websites from your mobile device.
Of course you're asking yourself, "Why do this?" The truth is, there aren't many good reasons, other than to show you can. But there is the idea of having a mobile web server in your pocket that you can test development on. What better way to learn how to build basic websites than with a server-in-a-pocket! Regardless of why you want this, I'm going to show you how to install it and run a basic website on your Android device.
The installation is quite simple. Just follow these steps:
- Open the Google Play Store on your Android device.
- Search for HTTP Server.
- Locate and tap the entry by Tautvydas Andrikys.
- Tap Install.
- Allow the installation to complete.
Once the installation completes, you'll find a launcher for the app on your home screen and/or your App Drawer. Tap the the launcher to open the app. When you first run it, you must download and install a build of Apache (Figure A).
To download the build, tap the download button (downward pointing arrow). Once it has downloaded, tap the name of the download to build it. After the download is built, you will be presented with the main screen.
SEE: Job description: Android developer (Tech Pro Research)
Configuring and starting your server
In the main window (Figure B), tap the change button for Server address and port.
In the resulting popup (Figure C), tap to change the port (if necessary) and tap the Server Address dropdown. From the list of possible addresses, you can select from an IPv4, IPv6, loopback, and an all network address.
After configuring your address and port, tap the Change button and you'll be returned to the main window. Tap the START SERVER button and your web server is now up and running. Point a browser to the IP address you chose (assuming your Android device is on the same network as the desktop machine you'll test it with) and the default index page will appear (Figure D).
When you're ready to add your own pages to the server, place the files in the server document root at /storage/emulated/0/htdocs. If your device doesn't include a file manager, there are quite a few to be found on the Google Play Store. Or you can always install a good text editor (such as anWriter free) and develop right on the device. Either way, your web server is ready to go.
SEE: Serverless architectures: 10 serious security problems (free TechRepublic PDF)
This won't make you more productive on your Android device ... unless your goal is to hone your HTML skills. But no matter your reasons for installing this web server on your Android device, have fun with it.
- 5 Google Assistant tasks that will make your work life easier (TechRepublic)
- How to configure Android folders to auto-sync with Google Drive (TechRepublic)
- The new Google News app is your one-stop portal to stay informed (TechRepublic)
- How to move the Kiwi browser address bar to the bottom of the window (TechRepublic)
- Samsung Galaxy Tab Active2 review: Rugged Android tablet built for business in the field (ZDNet)
Does this sound like an interesting project or will you skip it in favor of more practical tasks? Share your take with fellow TechRepublic members.
Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website jackwallen.com.