Tuesday, April 26, 2011

Hosting from home: Part 2

This post seems to be making a comeback after a long time. It is a followup of this post, where I experimented with hosting my webserver over the internet. Here I am going to try to explain the things I did so I can serve a page off my computer, but access that page from my a laptop running windows vista. This exercise sort of kind of gave me an idea how web hosting providers work. I hosted a page of my apache server. Apache was the web server of my choice. Very complicated to do stuff in it. But you have to take care of a few things:
  1. You have to provide a server name configuration to your website:
    Till date I don't understand this feature, but all I know is if requests come in with the host address saying this, then apache will not what website it belongs to and will process
  2. Apache should be listening to a particular port:
    Usually any web server by default will listen to 8080. This is where host http traffic will enter/exit the system. If you are using anything other than 8080 you'd have to specifically mention it in the url via the browser
  3. Make note of the IP address:
    Your router will assign an IP address unique to your machine. It is this IP address you are going to make public
That said lets go to the windows machine. All you have to do is add an entry into your hosts file (%system32%\drivers\etc\hosts). It has to be in the form: [web site domain name] [IP address] E.g. deostroll.media.com 192.162.2.4 Once this is done and the config is saved. You can startup internet explorer type in the website page giving the domain name you've entered above, and you are good. I've leave you to figure how websites over the internet now work.