Monday, November 27, 2006

Running a web server at home

I've been trying to run a web site from home for a while now. I've had the following issues:

1. Electrical shorts
2. Computer limitations
3. Site outage for a large period of time (for instance because of hardware failure)
4. Network availability
5. The server is running on a dhcp connection from the provider, this means the IP of the connection can change at random.

I've been able to address each of these limitations.

1. Electrical shorts
The server hardware is an old laptop that has a battery that provides about 30 minutes of power. The shorts are usually less than that, and the server stays up.

2. Computer limitations
The old laptop is dedicated to being a server, I've got an uptime of 55 days, and that too because I've had to reboot the machine after kernel updates.

3. Site outage for a large period of time
This was the most critical. If the site goes down a huge blackhole exists which might confuse readers. The least that I wanted for this was a way of notifying anyone trying to reach my site, that the site is temporarily down, while I fix the issue. This is easily solved by changing the DNS entry to point to a site that explains that the site is down for a particular reason, and gives an estimate of when the server will be up again.

4. Network availability
Sharing a network connection at home causes load on the connection, plus port sharing is a problem. Solved by moving in to an apartment of my own, with my own network connection.

5. The server is running on a dhcp connection from the provider, this means the IP of the connection can change at random causing the domain to be unreachable.

I've used no-ip.com, their tools, and a free no-ip domain name for a while now. When I got my own domain, I just created a CNAME entry that pointed to that free no-ip domain name. The no-ip tools notice a change in the IP address of the server, and sync the free domain name to the new IP. This way, my real domain name is always pointing to the right place. Ofcourse their is a short period of time when the DNS servers sync up, but the change in IP doesn't happen often, and I can live with it.

So why am I still at blogspot? Simply because I've put too much time into this site, and it has visibility. But any other site I work on, will be on my own server at home.