I have two sites: www.site1.com and www.site2.com. Both have pages that are served securely and so need a binding for https on port 443.
The problem is that only one site can be bound to the https protocol and if I disobey that rule I get strange behaviour such as requests for site1 actually serving the page from site1.
How to host multiple secure sites on your local IIS
First, you should know that sites resolve which site to bind to based on:
- Host header e.g. local.www.site1.com
- Port e.g. 443
- IP adress
In this scenario I really just want to change the host headers of the two https bindings for the different sites
but IIS won't let me. But I have ways of persuading it...
Step 1:
Navigate your way to
C:\Windows\System32\inetsrv\config
where you may or may not see applicationHost.config. This is a very mysterious file, it's there but not, sort of. I've found that it can be edited in NotePad (but nothing else(?))
Step 2:
Ctrl+F your way to "443:" and you should find your attempted 443 http bindings. In my case there are two and they both look like
<binding protocol="https" bindingInformation="*:443:" />
(Oh yeah they are exactly the same, lets change that.
Step 3:
Change them to
<binding protocol="https" bindingInformation="*:443:local.www.site1.com" />
and
<binding protocol="https" bindingInformation="*:443:local.www.site2.com" />
respectively.
Job done
If you check in your IIS UI you will notice that you host headers have indeed been set and your sites should now be able to discriminate between the two.