Posted on October 18, 2017 · Posted in Windows Server 2012 R2

Run Multiple Websites on the Same Port and IP Address on IIS

By default, during IIS (Internet Information Services) server installation an empty website, “Default Web Site”, that responds on the default TCP 80 web port is created. In the IIS terms, it means that this website bind to port TCP/80. To open the website, just enter the name of the IIS server (“http://web-srv1”) or its IP address (“”) in your browser. The same IIS server can support dozens or even hundreds of websites, and it is possible to run multiple websites that listen and respond on the same port (80 or 443). However, the interface of IIS Manager does not make it evident that you can host another website without binding it to some other port (e. g., 8080). In this article, we’ll show how to host multiple websites on the same IIS server and bind them to the same port and IP address.

iis web server

As we said earlier, a single IIS server can host multiple websites, but in order IIS to distribute HTTP requests correctly, each website has to be identified with some unique value. In case of an IIS website, it consists of three attributes that make up a unique combination for each website. These are:

  1. a TCP port number
  2. an IP address
  3. a host header

The information about the hosted websites is stored in the ServerBindings attribute of the IIS metabase in the following format: IP:Port:Hostname. Thus, if you want to host multiple websites on the same port and IP address, you will have to use a unique Host header. What is it? Host header is a part of an HTTP request to the server sent by a client that specifies which website it is addressed to. Accordingly, this host header must be specified on the side of the web server, and the DNS contains the correct entry that matches the hostname and the ip address of the web server.

Let’s suppose that you have a website running on IIS and listening 80 port. And you need to bind second website to the same port.

In the IIS Manager, create another website (Add Website) with the name TestSite, which files will be located in c:\inetpub\TestSite (do not specify the hostname yet).

add new web site on iis

After you click OK, a warning appears that you cannot use the binding *:80 for both sites. At the same time only one of them can work.

the binding 80 is assigned to another site

Agree to this warning. So you have got another site bound to port 80, you can not start it without stopping the first site.

second site on iis

To create a unique binding, specify another name (Host Name) for the second website. Right-click TestSite and select Edit Bindings. Select the binding you need and click Edit.

Specify the unique host name the users will address to, like TestSite, in the Host Name field.

iis site binding

You can configure the binding in the command prompt. In this case, for IIS 7 or higher the command to configure the binding looks like this:

C:\Windows\System32\inetsrv\appcmd.exe set site /"TestSite" /+bindings.[protocol='http',bindingInformation='*:80:TestSite']

Now you can start the second website as well.

start second iis site

All you have to do is to add an alias for the server (A or CNAME) to DNS that specifies the IP address or the name of your web server.

You can create a CNAME entry for the name TestSite in the DNS console (dnsmgmt.msc) and specify the domain name of your IIS server as FQDN target host.

add alias (cname) in dns

This entry can be also created using PowerShell:

Add-DnsServerResourceRecordCName -HostNameAlias web-srv1.contoso.loc -Name testsite -ZoneName contoso.loc

Try to open http://TestSite in your browser. It should open successfully.

multiple site on 80 tcp port on iis

Here are some useful notes worth to be mentioned.

If you are using a local IIS server, the mapping of site names to the server’s IP address is done via  the  file C:\Windows\system32\drivers\etc\hosts

The bind settings are stored in the IIS configuration file <sites> section of the IIS config file C:\Windows\System32\inetsrv\config\applicationHost.config

In our case, this section contains the following data:

<site name="Default Web Site" id="1">
<application path="/">
<virtualDirectory path="/" physicalPath="%SystemDrive%\inetpub\wwwroot" />
<binding protocol="http" bindingInformation="*:80:" />
<site name="TestSite" id="2" serverAutoStart="true">
<application path="/" applicationPool="TestSite">
<virtualDirectory path="/" physicalPath="C:\inetpub\TestSite" />
<binding protocol="http" bindingInformation="*:80:TestSite" />
<logFile logFormat="W3C" directory="%SystemDrive%\inetpub\logs\LogFiles" />
<traceFailedRequestsLogging directory="%SystemDrive%\inetpub\logs\FailedReqLogFiles" />
<applicationDefaults applicationPool="DefaultAppPool" />
<virtualDirectoryDefaults allowSubDirConfig="true" />

Likewise, you can host and run several hundreds sites on the same port of your IIS web server.

Related Articles