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.

SEE: Android Pie is here, coming to Google Pixel phones first (CNET)

Installation

The installation is quite simple. Just follow these steps:

  1. Open the Google Play Store on your Android device.
  2. Search for HTTP Server.
  3. Locate and tap the entry by Tautvydas Andrikys.
  4. Tap Install.
  5. 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).

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.

Figure B

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.

Figure C

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).

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)

Have fun

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.

Also read…

Your thoughts

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.

Subscribe to the Developer Insider Newsletter

From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays

Subscribe to the Developer Insider Newsletter

From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays