I've successfully set up multiple sites on my server, and as they are all assigned to port 80, I have assigned each a unique host name in the IIS Site Bindings.
Firstly, is this the correct way of doing things?
Secondly, is there any way in which I can now access these using my server IP? I have tried various combinations of 'http://ServerIP:80/HostName.com' and I just can't get it to work.
Thank you in advance.
1) Yes
2) You can access only one of your websites via
http://ServerIP/
orhttp://ServerIP:80/
, which is the same (to be precise, one site perip:port
combination). To access it this way select the site and create new binding, but leave "Host Name" field blank. This will instruct IIS to treat this site as "catch all" (will be used as the last one in a queue when IIS is unable to match domain name).To access your local sites via domain names, you can "fake" them by using
hosts
file, for example (C:\Windows\System32\drivers\etc\hosts
).Your setup does mimic that of a production web server hosting multiple domains, so it is correct if that is your goal.
As for accessing those (virtual) domains, normally that would be via separate DNS records (either directly through A Records or indirectly via CNAME Records) for each domain. The web server would use the URL from the web browser to determine which domain/site is being accessed and then steer the web exchange accordingly.
In your case, for testing, you can manually "fake" the DNS aspects via the local HOSTS file of the client machine running the web browser with the multiple host combinations referring back to your web server. That will allow the URLs entered on the web browser to resolve correctly back to your web server where the URL can then be read by the server to steer the web exchange to the correct site - http://mytestdomain1.com vs. http://mytestdomain2.net, etc., etc...