Thursday, 22 May 2008

Host headers on IIS with SSL

Do you wish to serve multiple web sites on the same IIS 6.0 server over SSL, using the same IP and the same 443 port? From the Windows 2003 server pack 1 you can.

Get a wildcard ssl certificate (i.e. with the common name *.yourwebsite.com), assign that wildcard ssl certificate to any website in your IIS, then ran the following commands for each website from C:\Inetpub\AdminScripts:

cscript.exe adsutil.vbs set /w3svc/<site identifier>/SecureBindings ":443:<host header>"

In example, if you wish to publish 3 websites called web, blog and mail identified in IIS as 1, 2 and 3, you have to run the following commands:

cscript.exe adsutil.vbs set /w3svc/1/SecureBindings ":443:web.yourwebsite.com"

cscript.exe adsutil.vbs set /w3svc/2/SecureBindings ":443:blog.yourwebsite.com"

cscript.exe adsutil.vbs set /w3svc/3/SecureBindings ":443:mail.yourwebsite.com"

More infos here.

No comments: