Need a low-powered device to run your website? Want to reclaim the space your web server is taking up? Would you like to share some information with people, either friends or the public, but don’t have the finances to run a full-scale web server?
You could use this link for a special discount at InMotion Hosting.
Or you could host your web page using an Android smartphone or tablet. Here’s how to build a simple Android web server.
Android: The Low-Cost Web Server in Your Pocket
Websites do not need expensive servers; they don’t even need inexpensive servers. We’re now at the stage where you can host a dynamic, database-driven website on a modest device.
For instance, you might choose to use a standard desktop PC or laptop. But as this takes up a lot of space, you can scale back even further. We’ve already seen how you can use the Raspberry Pi as a server, and it’s also possible to use an Android smartphone or tablet in the same way.
Doing this immediately removes your hosting costs. If the pageviews are low, you should find that your website runs without locking up the device (although you shouldn’t expect to multitask while the site is running!).
Step 1: Install Tiny Web Server for Android
Various server software apps are available for Android. However, many of these are out of date, intended for older versions of Android (such as PAW Server).
We’re using Tiny Web Server for this tutorial. With this, we’ll upload a basic index.html file and browse to it from a PC on the same network to illustrate using Android as a web server.
Similar apps rely on the same principles. Basically, the same concepts and processes are required to serve a web page to a viewing browser.
Download: Tiny Web Server for Android (Free)
Step 2: Configure Tiny Web Server
This tool is a very simplistic way to serve content from your phone. However, it does enable you to access files remotely. For example, you can browse the phone’s storage from your PC’s web browser if both are on the same network.
Because of this simplicity, there’s no configuration option with Tiny Web Server. This means you cannot force it to default to an index.html file. However, this is a minor niggle.
After installing Tiny Web Server, launch the app. On the main screen, you have the option to Change the server path, which is useful if you want to specify a directory to store your web files in.
You can also specify a Default charset (useful if you’re not hosting an English language site) or Server port.
Step 3: Add Index.html to Tiny Web Server
To use Tiny Web Server to serve web pages, you’ll need to create an index.html file and upload it to the preferred folder. You can do this on your desktop using a text editor like Notepad++ or on Android using an HTML or text editor.
Copy the file into the preferred directory (via USB or using an Android file manager) on your Android device. On Android, move the file to /storage/emulated/0.
If you’re copying the file via USB to your phone, browse to your phone’s storage in the file manager. The default location should be the emulated sub-directory. Copy the HTML file to this directory, then safely disconnect your device.
With the file copied to Android, open Tiny Web Server and tap Start server. Navigate in your browser to the default URL, adding /index.html to the end.
Congratulations, you converted your Android device into a basic web server! Of course, the example shown is extremely basic and lacks styling. Fortunately, it’s easy to add CSS with the usual included instruction in the HTML file. We’ve looked at some CSS basics if you’re new. Best of all, you can still use your phone or tablet as normal while hosting the site.
How Do People Visit Your Android Web Server Pages?
It doesn’t matter if you’re hosting your website on a smartphone, tablet, or even an Android TV.
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 need to do is assign your Android web server a static IP address. Unfortunately, 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 Update being a strong option.
Whichever one you choose, simply install it, set a URL as instructed, and select the destination as your HTML page.
Building an Android Web Server, Summarized
We’ve covered the basic steps to create an Android-powered web server. Just in case you missed them, let’s remind ourselves.
- Ensure your Android device is online
- Install Tiny Web Server
- Create HTML file(s)
- Upload the file(s) to your Android device
- Run the Tiny Web Server
If the website is relatively basic, you can use your Android device as a host and save money on powering an expensive server. Similarly, you can retake the space used by a server or PC running as a web server. Perhaps you can use the server for a different purpose.
With Android, building a web server is just one option. Have a look at some more great uses for an old smartphone.