How to Turn an Android Device into a Web Server

Need a low-powered device to run your website? Need the space your web server is taking up? Want to share some potentially controversial information with a select group of people but don’t have the financial resources to run a full-scale web server?
The solution to all of these problems — and some others — is to host your web page on an Android device, turning your smartphone or tablet into a web server.

The Inexpensive Way to Power a Website

Websites do not need expensive servers; they don’t even need inexpensive servers. We’re now at the stage where a dynamic, database-driven website can be hosted on a modest device. For instance, it might be a common desktop PC or laptop, but as this takes up a lot of space, you can scale back. We’ve already seen how the Raspberry Pi can be used as a web server, and it’s also possible to use an Android smartphone or tablet in the same way.
Your hosting costs are immediately removed, and as long as the page views are low, you should find that your website runs without locking up the device (although you shouldn’t be expecting to be able to multitask while the site is running!).

Installing Your Server Software on Android

Various server software apps are available for Android. These range from the straightforward PAW Server for Androiddesigned to run basic, non-dynamic sites (although a PHP plugin is available for PAW) to Ulti Server: PHP, MySQL, PMA, which, as the name suggests, supports the use of database driven websites written in PHP.
We’re using PAW Server for this tutorial, with which we’ll upload a basic index.html file and browse to from a PC on the same network to illustrate using Android as a web server. Other apps rely on all of the same principles — the same concepts and processes are required to serve a web page to a viewing browser.

Configuring PAW Server

muo-android-webserver-paw-start
With PAW Server installed on your device, run the app, pressing the start button as instructed. A URL will be displayed, so browse to this on your desktop computer. Here you’ll be invited to login, using the displayed credentials, and open the server console.
This is a useful app with a variety of features, from making phone calls and sending messages to viewing media. Basically, you can use PAW Server as a remote access console to your phone or tablet as well as serving web pages.
Here’s a look at what it can do:

Adding Index.html to PAW Server

To use PAW Server as a web server, you’ll need to create an index.html file and upload it to the correct folder. You can do this on your desktop using a text editor like Notepad++ (one of our favorite Windows applications) or on Android using a HTML or text editor.
muo-android-webserver-paw-html
With your file created, copy it into the /paw/html/ directory on your Android device — this is easily done by expanding the Media section in the PAW Server console and selecting File Manager. From here, browse to sdcard/paw/html, click Choose File, select the HTML file you just created and click Upload.
To view the file in your PC browser, you’ll need to restart PAW. On your tablet, tap the Stop button in PAW Server, thenStart again. Navigate in your browser once again to the displayed URL, this time adding /index.html to the end.
muo-android-webserver-paw-live
Congratulations, you converted your Android device into a web server! The example shown is basic and lacks styling; CSS can be easily added (and is simple to learn) with the usual included instruction in the HTML file.

Receive External Hits On Your Android Powered Website

As you may have discerned from the screenshots, I’ve used a tablet for this tutorial. However, there is no reason why you shouldn’t use a smartphone.
Whichever Android device you select, when used in conjunction with a dynamic DNS update client (of these, No-IP.com has an Android app), you’ll be able to serve web pages to computers beyond your home or corporate network. These apps link your device’s dynamic IP address to a dedicated URL, via the client app that you install.
(Of course if your ISP provides you with a static IP, all you will need to do is assign your Android web server a static IP address, but this may prove unworkable with some routers, so the No-IP.com app is the better option. Various unofficial No-IP.com clients are available, with Dynamic DNS Client a strong option.

Uses for an Android Web Server

We’ve covered various ways in which you might employ an Android-powered web server throughout this feature, but just in case you missed them, let’s remind ourselves.
To begin with, you can use an Android web server to host test versions of websites. This is useful for ironing out bugs and tweaking the design before the site goes live, and saves you installing development websites locally which then have to be painstakingly migrated to your server when ready.
If the website is relatively basic, you can use Android as a host and save money on powering an expensive server. Similarly, the space taken up by a server or PC running as a web server can be reclaimed, perhaps using the server for a different purpose. The space occupied with a PC running a web server could now be taken by a person, doing a job.
Have you build an Android-powered web server? Curious and want to know more? Leave a comment below, and we’ll talk.

0 Comments

Leave a Comment

Login

Welcome! Login in to your account

Remember me Lost your password?

Don't have account. Register

Lost Password

Register