How to Turn an Android Device Into a Web Server
Whatsapp Pinterest
Advertisement

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 7 Great Project Ideas for Using a Raspberry Pi as a Server 7 Great Project Ideas for Using a Raspberry Pi as a Server It's not just for simple one-off projects---the Raspberry Pi can run as a server. Check these Raspberry Pi server project ideas and get more out of it. Read More , 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.

Basic HTML code for a simple web page

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.

View a web page hosted on your Android device

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 10 Simple CSS Code Examples You Can Learn in 10 Minutes 10 Simple CSS Code Examples You Can Learn in 10 Minutes Want to know more about using CSS? Try these basic CSS code examples to start with, then apply them to your own web pages. Read More 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 The Best Free Dynamic DNS Providers You Should Try The Best Free Dynamic DNS Providers You Should Try With DynDNS gone, here are the best free dynamic DNS providers, services, and DDNS alternatives to replace it. Read More (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.

  1. Ensure your Android device is online
  2. Install Tiny Web Server
  3. Create HTML file(s)
  4. Upload the file(s) to your Android device
  5. 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 10 Creative Ways to Use Your Old Smartphone 10 Creative Ways to Use Your Old Smartphone Why sell or throw away your old smartphone when there are so many ways for you to reuse it? Some of those reuses might be more creative than you thought. Here are some ideas. Read More .

Explore more about: Android Tips, Web Hosting, Web Server.

Enjoyed this article? Stay informed by joining our newsletter!

Enter your Email

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Sgtevmckay
    October 19, 2019 at 7:51 pm

    Looking for help.

    I want to run the subsonic media server software on my android device.

    Any solutions out there???

  2. tony borner
    June 13, 2019 at 4:08 pm

    tiny web server only worked as local host 127.0.0.1

  3. Mohammad hany
    August 29, 2018 at 7:19 pm

    I really like this tutorial! I got my own website up and running but is the website thati host Local Hosted ? Or anyone from anywhere can access it ?

  4. Saurabh
    July 18, 2017 at 4:09 am

    I have phone with GSM sim. And that's the way I connect to internet.
    Will your solution work in this case? Or do I need broadband internet connection? Remember GSM providers doesnot give public IP to devices(static or dynamic is a different problem)

    • Christian Cawley
      July 18, 2017 at 7:06 am

      You'll need a high speed connection, I'm afraid.

  5. Rams
    May 1, 2017 at 1:48 pm

    I want to know how to create webserve app android like pwa.could please give me some resources to start.
    Thanks

    • Abdus
      February 25, 2018 at 11:15 am

      You can use nodejs to create your own server.

  6. Frank
    February 3, 2017 at 4:47 pm

    Hi new at this but would like to learn how to build a simple website for my business

  7. Anonymous
    November 3, 2015 at 7:14 pm

    Sorry if this is beyond the scope of this discussion. I am trying to set up a webserver on an android device A. Other devices connect to this device via a local hotspot created using the android device by typing 192.168.43.1:9090 in the browser. Is there a way for other devices to connect to the device using a domain name (so the user doesn't have to type the 192.168.43....address). I would like the process to be fully offline (ie no internet dependency)

    Any help or pointers will be highly appreciated...thank you

    Regards

    Neeraj

  8. Anonymous
    August 9, 2015 at 7:37 pm

    I recently did a similar thing with an iPhone 3GS using 'ios-lighttpd-php-mysql'. Most of the setup is found here:http://ios-webstack.tk/install

    I then made a quick wordpress blog and owncloud and have a static IP port forwarded. have not set up NO-IP yet but might conisder if I use it more often. It is a great repurposing of an old iPhone IMO even just as a side-project

  9. Anonymous
    August 8, 2015 at 9:21 am

    Interesting article. I have a few questions though.

    Can I use my domain name with a smatphone hosted website?
    Does the website loading speed depend on the internet connection speed of my phone?

    • Christian Cawley
      August 8, 2015 at 9:12 pm

      You can, if you use the method linked to above with No-IP.com, but speed will depend on ISP and device.