Creating a Bash-based web server on my new Raspberry Pi

Recently I decided to correct my oversight of not having obtained a Raspberry Pi, so I purchased the Model B version along with the nice clear case and named it “Colossus”.

Never having owned an Acorn Archimedes (I was an Amiga man) the first thing I did was play with RISC OS for a while. Having got that out of the way, I installed Raspbian Linux and decided to have some fun creating a demo web page showing continuously updating statistics from the Pi.

I ended up using a Bash script to generate a single page of HTML incorporating an embedded image (a lovely iPhoneography photo I took of Colossus). I then piped this script through Netcat to create a single-threaded web server. And I then ran all of that several times, each instance on a different port, to create a multithreaded web server which I named “Hydra”.

I needed something at the front end to distribute incoming HTTP request on port 80 to Hydra’s multiple ports, and a very simple command utilising the handy Pen load balancer did the trick for that.

The finished web site can be seen in all its geeky glory at colossus.mattbrock.co.uk.