Home Web Server on Raspberry Pi Zero

One of my favourites things to fiddle with are home web servers. In fact the oldest post from this site (ported from previous websites) was about this very subject. This has always been a “minimal cost” hobby, in that I have tried to use old hardware I already have, and free services for things like domain names. The only thing I wasn’t getting for free with these setups was the electricity. So I wondered, by accepting a small initial outlay, whether it was possible to create a server with zero ongoing running costs.

Just recently I purchased a Raspberry Pi Zero and used it to create my latest web server. At the moment it is running from the mains electricity, but I am planning in the near future to try and run the thing on solar power alone. Anyway, I will probably write more about the project on the site being run by the Raspberry Pi at some point. You can check out the site here.


Bitcoin Prices

After playing around with Bitcoin exchange rate APIs today, I’ve created a website that displays exchange rate information from blockchain.info. I still need to add some more functionality to the site so it provides all the information I typically need relating to Bitcoin prices in one place. The site can be found here.



I had been thinking about rebranding for a while, as my old domain name was far from unique. A quick Google search showed I shared my name with, amongst others, a large Pakistani bank and a Viennese band that describe their genre as “funk funk funk”.

So after nearly a year of using a different domain, I have changed to johnskdev.com. Whilst it doesn’t exactly roll of the tongue, it is descriptive and more importantly it was not taken as a username on any of the major social networks or forums I frequent. This meant I could have one consistent name across all these sites.

It was particularly satisfying to Google my new name, shortly after I had registered the domain:

Screenshot from 2014-11-07 17:22:57

That’s about as unique as you can get!

Of course, I needed to move my WordPress installation from my old domain. I had transferred WordPress sites between servers before (keeping the same name), but not moved to a new domain. It turned out to be fairly straightforward, however, and WordPress themselves provide a useful guide on this subject.

I have retrospectively changed names in previous blog posts to try to ensure consistency, but you may find the odd reference to the previous domain on here.


.NET on johnskdev

As I explained in my last post, I am currently learning all there is to know about the .NET Framework.

I can get a bit bored creating test sites on my local machine and much prefer to see things working and live on the internet. As such I’ve created a new sub-domain, net.johnskdev.com, that points to an Amazon server where I have deployed a test MVC 5 site.

This is going to be my testbed for everything I’m learning in .NET, so don’t expect it to look like a polished website. In due course, a lot of examples and experiments will appear here, but at the time of writing this, the site is just the default one you get when you create a new MVC project.

I would write a guide on how I set this up, but I don’t think I could improve on this great article that takes you through all the steps, from setting up an EC2 instance to uploading your .NET project. The only problem I encountered was that Web Deploy didn’t seem to install correctly on my server, so I would suggest also reading through this IIS article on installing and configuring Web Deploy. It’s written for IIS 7, but it worked fine with IIS 8.


Five Minimalist WordPress Themes

I’m a big fan of minimalist web design. Here are five of my favourite free WordPress themes that have a clean, minimalistic look. They don’t rely on big photos to make an impact (although most look good with photos too) and so are ideally suited to individual blogs that have a lot of text.



Spring Theming

When I started this site I wanted a clean, simple, flat design which, of course, also had to be responsive.  I picked Tiny Theme as it fitted this criteria and looked great on mobile devices. The only real gripe I had with it was that on a full size computer screen, it looked a bit too simple.



Consolidation of Web Hosting

Over the years I have registered many domain names and accumulated a number of web hosting accounts. Most of these sites were created for my own tinkering and receive very little traffic; even on the smallest hosting packages they don’t get anywhere near the limit for storage space or bandwidth.  Historically I have taken the easy option and just renewed the services but this year I decided to try and save some money by moving all my sites to one web hosting account.



Home Web Server 2

As I am currently unable to run a web server due to my broadband connection and lack of suitable hardware, I thought I’d get started by setting up a virtual server. I’ve used VirtualBox for a number of years now, to install and test various Linux distributions and other operating systems.

1. Install Debian

I downloaded the 40MB “Smaller CD” Net Install ISO of Debian 6 from here. The Net Install means you start with a very small ISO file and then download only the packages you need for your installation.

For the virtual machine, I selected minimal specs: 256MB RAM and 8GB dynamically expanding hard drive. Installing Debian on VirtualBox is very straighforward and I won’t go into all the details here. The only thing worth noting is when you are asked what collections of software you want installed on top of your core system. I chose the following options:


This, amongst other things, installs Apache HTTP Server, PostgreSQL and OpenSSH, just what we need for a web server. You can run tasksel after installation to bring up these options again and of course you can install individual packages as needed. When Debian boots, it starts these services automatically without need for further configuration.

2. Configure VirtualBox Networking

VirtualBox has a number of options for how the virtual network adapter attaches to the real network of the host operating system. The default is NAT, which means that the host and the virtual machine cannot see each other on the network. However, you can setup port forwarding so that certain ports on the host connect to ports on the virtual machine. I setup the following:

Port Forwarding

You can use any port numbers that are above 1024 and not in use for the Host Port. For the virtual machine, you need to use port 80 for HTTP (to connect to Apache) and port 22 for SSH. Whilst SSH is not strictly necessary for administering the virtual machine, it’s worth doing to more closely replicate a real server environment.

To check Apache is running and view the default homepage type the following into your host web browser:


3. Setup SSH

To SSH to the new server type the following from the host command prompt:

ssh -p 9010

Now log out of the remote computer and back in the host command prompt generate a key by typing:

ssh-keygen -t dsa

You will now want to copy the key to the remote computers folder ~/.ssh/authorized_keys. If the .ssh folder does not already exit on the remote machine, you need to create it and give it the correct permission. On the remote computer type:

mkdir ~/.ssh
chmod 700 ~/.ssh

Note that, although you will be copying into authorized_keys, you do not need to create this folder, it will be generated for you.

Now, back on the host machine, copy the public key over to the remote machine with:

scp -P 9010 ~/.ssh/id_dsa.pub

Note that while the -p switch for ssh is lowercase, it is uppercase for scp.

Now, reconnect to the remote machine. This time you should be asked for the passphrase you used when you set up your key. Type it in and connect to the remote machine again.

Most modern linux distributions start the ssh-agent program on boot up, which means that once you’ve typed in your passphrase once, future connections will connect without asking for your password or passphrase. This was the case with my host machine, which runs Ubuntu. For further information about setting up SSH, see this site.

Finally, the default Document Root directory for web pages is in /var/www, so to copy your own index.html file type:

scp -P 9010 ~/broohn.org/index.html root@

Because of the default permissions, you need to connect as root to copy this file over. Now when you refresh your web browser you should see your own home page.



Home Web Server

It’s worth noting that I used Apache’s Tomcat server for this installation, which is primarily a container for Java Servlets and Java Server Pages (JSPs). Tomcat can be used as a stand-alone server (as I have done here), however if you are not going to be using Java on your website, you’ll probably want to use the Apache HTTPD server instead.

1. Install Debian

Perform a Net Install. Only select ‘Standard Install’ on tasksel.

2. Install Java (Only necessary if you intend to run Java Servlets/JSP)

First you need to edit /etc/apt/sources.list file. To open in vim (text editor):

Add the following lines:

Save and close, then from the command prompt run:

Check you have the latest version of java:

3. Install Tomcat

4. Configure Tomcat

Get Tomcat to start on boot-up by creating an init file:

Add the following to the init file:

Then run:

Change Permissions:

Open the tomcat-users.xml file:

Add the following:

Now restart Tomcat for changes to take affect:

You can start and stop Tomcat when you need to with:

In your web browser go to http://localhost:8080, you should see Tomcat’s default home page.

5. Set up a domain name and configure your router

I created a free subdomain with dyn.com.

Setting up your router will vary, however my router had an option to include details of my Dyndns account, so it would update itself when my dynamic IP address changed.

Tomcat runs on Port 8080 by default and whilst you can change this, it’s probably easier to modify your router settings to requests to Port 80 get forwarded to 8080. Portforward.com has instructions for how to set up port forwarding on a huge array of different routers.

6. Create your website

Start by putting your home page here:

Now, go somewhere that is not on your local network, open a browser and typehttp://yourdomainname.com. You should see your new website in all its splendour!