Thursday, 2 January 2014

Taking back the web

Back in the good old days when your modem only supported 28.8kbps and accessing the local BBS didn't allow you to 'like' posts, there weren't the rich services that we no benefit from such as free mail, cloud storage, hosting etc.  If you wanted any of the above you had to build a server yourself.  These servers were big grey boxes with large monitors.

Now in 2014 I have decided to build a server myself and use it to host 'something'.  This is itself isn't a real technical challenge.  Most modern linux distributions allow the user to install a preconfigured LAMP stack with a single command.  Neither is building a web site, thats just a bunch of HTML, CSS and other scripting languages.  I however want to do this for NO MONEY!  I will only use hardware and services that I have either had donated or have free options.  The point of this is that to prove that anyone with a bit of knowledge can 'take back the web'  by building the infrastructure and hooking it up to the rest of the internet. This post consists of 2 parts:

  1. The web server
  2. Domains / DNS and port forwarding.
At the end I will have a basic HTTP server running on some hardware and available on the internet.  Future posts will discuss the services I will build on this stack.

The web server

I like my smartphones, for the past 2 years I have had a Samsung Galaxy Nexus.  I love this device.  It was my email, calendar, music, communication device and it went everywhere with me.  Over Christmas I upgraded to a Nexus 5 and for the first time felt a pang of pain as I removed the SIM from my old device and turned it off for the last time.  I have never felt like that before with some electronics.  Deciding to turn it into a web server somehow eased the pain and is a nice example of upcycling a device.  In some ways it is a great choice:
  • Silent running
  • low power consumption
  • Small physical footprint
It's not going to be able to serve the next facebook or wikipedia. but to host some personal stuff it works absolutely fine.  If I ever require something with a bit more capacity then I can always find some other devices and use them as database servers or content servers to lighten the load.

I am using a web server called kWS which is free in the play store.  it is just a basic HTTP server with pro features in the paid version.  Right now it fits my requirements as in it serves basic HTML and is free.  Later on I might need to change to a different server.

Because I have not rooted my android device I am not allowed to bind to any port running <= 1024 so therefore I am using port 8080.

Domains / DNS and port forwarding

I don't have my own domain and buying one would be outside of the rules so I have used the free service of: which provide a free dynamic DNS service.  They host the domain and I am allowed to update the associated IP address using a small client running either on my ADSL modem router or on my web server.  

My router (provided by sky) only supports dynamic dns updating if you are using the dyndns product.  However this is no longer free.  I am using a small client that sits on my android web server and uses the api to update the DNS record.  I am not expecting the external DNS to change much, but if it does I am covered.

Finally I just needed to reserve an IP address for the MAC address of my phone ensuring that my new web server always gets allocated the same IP address.  One small hole in the firewall allowing inbound traffic on port 8080 to go to the IP address on my phone and I was all ready.

The site is now live and running from my smartphone!
Post a Comment