How to Set Up Site Bindings in Internet Information Services (IIS)
Here I’m going to discuss some scenarios for setting up bindings using Internet Information Services (IIS). This information will help you host multiple sites on a single Dedicated Windows Server.
If IIS is installed in the machine, you can access it by typing ‘inetmgr’ in run as shown in the image below:
By right clicking the Default Website (which is automatically created while installing IIS) you can select the Edit Bindings option. This will open a window just like the image shown below.
There are three values that can be used in a site binding: IP Address, Port and Host Name. In the default website you can see that the only values specified are Port and IP Address. The default site is bound to port 80 on any IP address that does not have another binding. This gives you a “fallback” website for all requests that come to your server on port 80 and do not match any other site bindings. In a situation where you need to set up an SAAS based application (website) you can use this. If we are not specifying any host name, for all requests coming to your server on port 80 that do not match any other site bindings, this website will get executed.
Below are some common situations and how you can set up your site bindings.
Example 1: Web server with multiple IP addresses
In this situation, we are going to assign a separate IP address for each website.
|Site Name||Assigned IP Address||Port|
|Joby & Co.||192.168.1.201||80|
Any web request coming to 192.168.1.200 on port 80 will be served by this website. It does not matter what host header is used. It could be abcltd.com or www.abcltd.com or any other host that is configured in DNS to go to this IP address.
We will similarly assign site bindings for Jobby & Co. so that requests going to 192.168.1.201 on port 80 will go to their site.
Example 2: Web server with one IP address using host name bindings
This situation is common at low-cost web hosting companies or in a situation where you run a server from your house or have a small business and only have one IP address to allocate to your web server. Since we do not have enough IP addresses to assign to each site, we will use host headers to differentiate which websites to serve requests to. In this case, the only IP address on the server is 192.168.1.200.
ABC Ltd would like their site to respond to requests for abcltd.com and www.abcltd.com. Since we have multiple sites on the server using the same IP address and port combination, we must use the host name to differentiate this site from others. We will set up two site bindings, one for each host name that we want this site to respond to.
Jobby & Co. would like their site to respond to Jobbyco.com, www.Jobbyco.com and blogs.Jobbyco.com. We will add three bindings to this site.
As you can see, both sites are using the same IP address and port. The hostname is the only value that differentiates the two sites. If we try to add a binding for jobbyco.com to the ABC Ltd. site, we will get a warning that the same binding already exists.
If we allow IIS to add this binding, we will have an issue the next time IIS is started. It will start the first website with this binding but the second site will not be started.
Example 3: Web server with one IP address using port number bindings
In this example we are going to use different port numbers to identity the site that should respond to a request. Both sites will use the IP address 192.168.1.200. Acme Products will be configured to use port 80 as shown below.
Jobby & Co. will be configured to use port 8080.
There is one downside to configuring your sites this way. Web browsers use port 80 by default. In the case of our two websites, the ABC Ltd. site will work fine but the Jobby & Co. website will not come up in a browser with a standard URL. In order to get to the Jobby & Co website, you will have to enter the URL like this: http://www.jobbbyco.com:8080. The colon and port number must be added at the end of the URL for non-standard ports.
- App Development
- Power BI
- Problem Solving
- Source Control
- System Administration