Multiple SSL sites using host headers in IIS 6

Use 443 for all, but use host file configured headers to distinguish (your host file lives at c:\windows\system32\drivers\etc\host)

To setup run this from your command prompt (if fails try the Visual Studio command prompt).

cscript.exe adsutil.vbs set /w3svc/1/SecureBindings ":443:siteonedomain.localhost.com"
cscript.exe adsutil.vbs set /w3svc/726940114/SecureBindings ":443:anotherdomain.localhost.com"

In the above the id listed between “w3svc” and “SecureBindings” (i.e. 1 and 726940114) is the ID of the website in IIS. You can see this in the IIS admin console when you view all sites – or you can use the below script to print all in the command prompt:

To list all bindings (save as .vbs file):

strComputer = "."
 
Set objWMIService = GetObject _
    ("winmgmts:{authenticationLevel=pktPrivacy}\\" _
        & strComputer & "\root\microsoftiisv2")
 
Set colItems = objWMIService.ExecQuery _
    ("Select * from IIsWebServerSetting")
 
For Each objItem in colItems
    For i = 0 to Ubound(objItem.SecureBindings)
        Wscript.Echo "Port: " & _
            objItem.SecureBindings(i).Port
    Next
Next

See http://www.sslshopper.com/article-how-to-configure-ssl-host-headers-in-iis-6.html for details and explanation.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: