Hosting a website based on your local network

mazeMany people like to do web development and production on a local machine before bringing it “live” on a real space. Often they want other people to be able to view and use the site in this development stage. In fact, this site was hosted on a computer in my basement for a while until I worked up the nerve to actually make it official and get a domain name.

But how do you make your site work through the maze of firewalls, routers, and IP addresses that home networks typically have?

While everyone’s set up is slightly different, here I will describe what it took to have my site running.

It starts with a computer. This might be your production machine or a system that is just lying around, but it is whatever is hosting your site. Mine was a basic machine running the Apache web server. The only requirement is that this system has a connection to your network.

In home networks, the connection is done through a basic router. There are many available, but almost all use a web interface to make changes. My home network has a D-Link router, which I configured to forward port 80 to the host computer. To test it, I accessed the router by going to its public IP address, and it promptly redirected me to my site. Perfect.

While this IP setup works OK, it is not easy to use when your internet provider uses a dynamic address. This means that your IP changes periodically, turning your memorized IP useless until you find out the new one. To remedy this, I used a service from that takes my current network IP and translates it into something more human-friendly. On top of this, another computer on my network is set up to detect when the IP address changes, and updates my DynDNS records. It works very well, and gives my site a somewhat professional look.

So there you go! That’s how my site works behind the scenes, and I hope some of this information is useful for setting up a site on your own.
[tags]Websites, hosting, firewall, network[/tags]