Tuesday, December 26, 2006

QA - Setting up IIS Virtual Host

Question:

I am a web developer and I would like to setup IIS to do this:
1. My physical structure:
d:/www/company1
d:/www/company2
...
d:/www/companyN
Each folder is a website for that company
2. On my local system, I would like to access to a company's website as:
http://company1/index.php
http://company2/index.php

Before using IIS, I was using Apache and we can setup httpd.conf as:

DocumentRoot "d:/www/company1"
ServerName company1


DocumentRoot "d:/www/company2"
ServerName company2


and define domain company1, company2 in
c:/windows/system32/drivers/etc/hosts as:
127.0.0.1 company1
127.0.0.1 company2

How do I setup this feature in IIS. Thanks very much for your help.

Answer:

In general, one can set up similar web server configuration on IIS and Apache, given comparable customization module(s) and configuration. In this case, the desired configuration can be performed in a couple of ways using the scriptable administration interface of IIS.

With IIS6, there is a commandline tool, iisweb.vbs, which uses the scriptable administration interface and illustrates how to perform and automate the task:

iisweb.vbs /create D:\www\company1 Company1 /d:company1

The same configuration can be set more manually on prior IIS versions with a more generic tool, adsutil.vbs, located in %systemdrive%\inetpub\adminscripts. The following command sequence works on all IIS versions and is equivalent to what iisweb.vbs performs:

adsutil.vbs CREATE W3SVC/1000 IIsWebServer
adsutil.vbs SET W3SVC/1000/ServerBindings "127.0.0.1:80:company1"
adsutil.vbs CREATE W3SVC/1000/ROOT IIsWebVirtualDir
adsutil.vbs SET W3SVC/1000/ROOT/Path "D:\www\company1"

Note it is important to use a unique ID # for each website (i.e. I chose 1000) and the proper KeyType (case sensitive) for each configuration node needs to be provided on the CREATE - and iisweb.vbs takes care of that amongst other features and details.

You can use this script to check your website configuration.

//David

6 comments:

- said...

There is a step by step guide giving the details on Accessing Local IIS Web Sites via Name using the Hosts File

Cheers,
Blogging Developer
http://www.bloggingdeveloper.com

Anonymous said...

At one time or another, I do not have the Atlantica online Gold ; at the first time, I am not willing to buy Atlantica Gold . But I do not wonder I buy the Atlantica online money , my friend thinks that I am ill. But when I have it, it carries the magic from such a group, such a link in the world, cheap Atlantica online Gold , it is the key bring you to this world. But buy Atlantica online Gold is the best desire that I make.

Without thinking I buy some dofus kamas . I use some kamas and want to find a good group. We often buy cheap kamas together on Monday. As if it is a rule. I think it is the real friendship. buy dofus kamas is already become the essential thing in my life. So I will introduce my friends have the dofus gold , we can be consist of a group, it must be very interesting.

Anonymous said...

Do you know eve isk? I like it.
My brother often go to the internet bar to buy eve online isk and play it.
After school, He likes playing games using these buy isk with his friend.
I do not like to play it. Because I think that it not only costs much money but also spend much time. One day, he give me many cheap eve isk and play the game with me.
I came to the bar following him and found buy eve online isk was so cheap. After that, I also go to play game with him.
Do you know 2moons dil? I like it.
My brother often go to the internet bar to buy 2moons gold and play it.
After school, He likes playing games using these 2moon dil with his friend.
I do not like to play it. Because I think that it not only costs much money but also spend much time. One day, he give me many buy 2moons dil and play the game with me.
I came to the bar following him and found cheap 2moons gold was so cheap. After that, I also go to play game with him.

gurgaonindustry said...

Schools In Gurgaon | Hotels In Gurgaon | Hospitals in Gurgaon | Jewelers In Gurgaon


i like your blog

Anonymous said...

The online Gossip Master of College ACB-watchestoo.com
http://www.watchestoo.com
replica watches
Men’s watches
Fake watches
watches
IWC
IWC Portuguese AUTOMATIC 5001 IW500101
IWC Portuguese AUTOMATIC 5001 IW500107
IWC Portuguese Automatic 7days IW500106
IWC Portuguese Automatic 7Days IW500109
IWC Portuguese Automatic 7days IW500114
IWC Portuguese Automatic 7days Limited Edition

Laureus IW500112

IWC Portuguese CHRONO AUTOMATI IW371438
IWC Portuguese CHRONO AUTOMATIC IW371401
IWC Portuguese CHRONO AUTOMATIC IW371404
IWC Portuguese CHRONO AUTOMATIC IW371417

Anonymous said...

Why the replica louis vuitton handbags are so popularity? Because of lv handbag original from France and are created by the top designer louis vuitton bag , the meaning of the label “LV” .