Software

How to easily install a web server on an Android device

If you've ever wanted to install a web server on your Android device, you're in luck. This walk-through explains how to install and configure HTTP Server powered by Apache.

androidhero.jpg
Image: Jack Wallen

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

Figure A

Download the Apache build of your choice.

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

Figure B

The HTTP Server main window.

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

Figure C

Configuring your port and IP 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).

Figure D

Figure D

The default index page for HTTP Server powered by Apache.


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.

About Jack Wallen

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.

Editor's Picks

Free Newsletters, In your Inbox