Thursday, June 24, 2010

Hosting from home

I was recently playing around with apache and my belkin wireless router. I got the hint that I can use my computer at home to host websites over the internet from hanging around in the apache IRC channel and interacting with people there. But I didn’t know what my router was actually capable of.

Stuff you need

You need is a web server. Any web server; it needn’t be apache – what I used.

You will need a broadband connection. The thing to take care here is that your connection should have only one static IP address. It means each time you connect to the internet it should be through this IP address only.

You technically don’t need a router! But having a router is advantageous. Most modern routers have a feature called port-forwarding. If a router is configured for port-forwarding port 8083 to port 80, it will literally “forward” those packets with port address 8083 to port 80, which is the default port most web server programs bind to.

A word about the web server

I did most of my experiments on apache. Once if apache is neatly installed and running on the machine we simply open a browser and type http://localhost , to see if it works. You’d mostly get a default message like “it works” or sometimes you might even get something more colorful. It depends on what is set as the default message for the installation. I am not sure about how all the other web servers work. But there is usually some default message.

Finding your IP

This is the easiest part of this whole exercise. Just browse to

Or you can call your service provider and ask them to find it for you.

That’s it!!!

Instead of typing localhost in your web browser, type the ip address: i.e. http://[your_ip_address]/

You should see the default message here. If you check the server’s log you should find an entry pertaining to what you’ve just typed in your browser.

For those who have configured port-forwarding on your router, simply type http://[your_ip_address]:[port_number]/ in the browser.

Final words

It is actually very simple to use your home computer as a web host. But it is not recommended. There are many reasons for this. Foremost your machine does not have the hardware that most web hosting providers have. Your machine does not have the level of virus protection professional hosting servers have. When I was excited that I was able to make my web server serve something via the internet to some other computer elsewhere, I posted it on twitter. I left it online about for 10 min to do various sorts of testing. I had close to 10-15 hits mostly from search engine crawlers and the like.

Next steps

The next post I am going to explain how you can host your own intranet website with just your router, and also how you can give it a more lovable name instead of an IP address.

No comments: