Monday, September 13, 2010

Hosting a website at home using IIS 7.5

I wanted to try out hosting a website through Windows 7 (IIS 7.5) (steps would be pretty much the same for windows 2003 and 2008.

The purpose of this is to host your web server at home, for me this is used for Demo purposes or debugging internet based apps that would later be hosted somewhere else.
(other things you could host would be TFS servers, FTP servers etc.)


First would be to register at a DDNS site like www.no-ip.com or www.dyndns.com (for the purpose of this tutorial I'll be using www.no-ip.com).

Now, login to the site and Click on "Manage Hosts",








"Add Host"




















Under Hostname would be your site name, this would become your URL like for this demo would be MySite.zapto.org

IP Address would be auto populated but if not it would be the IP Address your ISP provided you with. in my case having a dynamic IP based DSL Connection, my modem every time it restarts would change it's IP address. (no-ip has a downloadable tool to manage this automatically DDNS Update Client.

click on "Create Host" and we're done.


Second would be to installing IIS on Windows 7.

1. Click Start and then click Control Panel.
2. In Control Panel, click Programs and then click Turn Windows features on or off.
3. In the Windows Features dialog box, click Internet Information Services and then click OK.


Third would be Setting up your site.
1. Run IIS Manager in the start menu and type "IIS"
2. Add a new "Web Site"
3. Enter a Site name like "MySite" or your project name
4. Physical path is the location of the site on your hdd like in my case would be (D:\Sites\Demo\MySite)
5. Host name would be the URL you created at no-ip.com (ex. MySite.zapto.org)

Fourth would be to setup your Windows Firewall to accept Inbound and Outbound traffic for your site. (if you have other firewalls like Norton or Zone Alarm, you'll have to give access to your ports as well).

1. Click the Start Menu and run "firewall"
2. Click Windows Firewall with Advanced Settings.
3. Click Inbound Rules and make a new rule.
4. Start the "New Rule Wizard"
5. Click Port and enter "TCP" and port "80" then click Next
6. Allow the connection then click "Next"
7. Click the rules that apply, then 'Next' (everything is selected)
8. Name the New rule like "WebSite Inbound Rule" and click Finish.
9. Check if the rule has been created and active and then close the firewall.

Fifth would be to setting up your router to allow connections for port 80 to pass through, now depending on your router this can be a bit tricky but the rule of thumb is.

If your router has a firewall, give Inbound access to port 80.
and lastly make sure to port forward port 80 to your server.

If you have trouble port forwarding depending on your router model, this site has been very helpful to me in the past. (www.portforward.com)

Theoretically this should be finished however on my setup when I tried to access my site it went directly to my modem's Web based Config page.

my setup currently is Internet > Modem > Router > Desktops and Laptops.
now, this won't work properly with my modem blocking the connection, so the solution is to "Bridge" my modem to my router making my router as the PPPoe dialer instead of my modem. (again how to go about this depends on your ISP, model of your modem and router).


Enjoy!