I am using Windows 7 with IIS 7.5. I need to setup local websites on the same IP but on different ports with hostnames which I can access locally by using those hostnames.

For e.g.
Website name: apple website
Path to directory: C:\inetpub\wwwroot\apple
Hostname: applewebsite.com
Port: 44310

Website name: orange website
Path to directory: C:\inetpub\wwwroot\orange
Hostname: orangewebsite.com
Port: 44311

Currently I can access the website with https:// localhost:44310 or https:// localhost:44311, but I would like that my local websites should get resolved with hostnames: https://applewebsite.com and https://orangewebsite.com

I know that hosts name are stored in C:\Windows\System32\drivers\etc\hosts folder but I know that you can't use ports but only ip-name pairs.

In IIS manager when I try to bind a website, when I change from http protocol to https, the text field "hostname" become grayed.
Update: if the Common Name (CN) is typed in this way *.websitename.com the text field "hostname" can be edited.

  • For this you'll need SNI, which came to IIS in version 8. – tobyd Jul 18 '17 at 16:27
  • @tobyd I know, but I have a Windows 7 machine and I can't change it. – Cyr Jul 18 '17 at 23:03
  • I don't think you'll be able to do this with IIS 7.5 and 1 network adapter and HTTPS. SNI solves that particular limitation. You might be able to make a somewhat nasty solution using nginx or apache to provide SNI and SSL offload as a reverse proxy to http local ports (served by IIS) but that isn't pretty and I can't comment on if it would work well or at all. – tobyd Jul 18 '17 at 23:43

do you nee to use different ports for some application reason? if not you can use IIS Host Headers so that you can use the same IP and Port for each of your sites. it makes name resolution a lot easier.

Here is a link: https://technet.microsoft.com/en-us/library/cc753195(v=ws.10).aspx and here is another: https://www.digicert.com/ssl-support/ssl-host-headers-iis-7.htm

I think the reason the GUI greys out the Hostname section when you click HTTPS is that it gets that info from the certificate.

  • As you say if I configure in IIS the same IP:port for 2 websites I have to use the same certificate. I can't do it becouse the first hostname is applewebsite.com and the second is orangewebsite.com. So I can't use the same certificate becouse the name server are different. – Cyr Jul 19 '17 at 11:45
  • About the grey section you are right: it is disabled because I have set the Common Name (CN) as nameserver.com. On the contrary setting CN as *.nameserver.com allows to set the Name host. – Cyr Jul 19 '17 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.