You may configure Internet Information Services (IIS) to host multiple websites using the same internet protocol (IP) address. This may be done by utilizing separate ports on the same IP address or through the use of host headers. In this example, we will configure host headers as it is a simpler solution than using a separate port.
Before we begin I would like to provide a list of prerequisites:
- Specify the website domain names. In this example, we will use domain.com and website.com.
- Create a folder path for each website. In this example, we will use C:\inetpub\sites\domain.com and C:\inetpub\sites\website.com.
- Create an index.html file, or any other default document of your choice, in each of the directories above.
- Edit the C:\Windows\System32\drivers\etc\hosts file on the local server or remote client to test the host header configuration or create DNS entries to resolve these domain names to the appropriate IP address. If not, the web traffic will be routed to public web servers hosting these domains.
With that said, let’s begin our configuration in IIS.
- On the Internet Information Services (IIS) Manager interface right click Sites and select Add Website….
- In the Add Website dialog box enter the Site name: and Physical path: then click OK.
- On the Add Website dialog box select Yes to add the duplicate binding. NOTE: We will change this next.
- Verify that the new website, domain.com, is not running.
- Right click domain.com and select Bindings….
- In the Site Bindings dialog box select the http binding and click Edit….
- In the Edit Site Binding dialog box enter domain.com in the Host name: field and click OK.
- In the Site Bindings dialog box click Close.
- Right click domain.com and select Manage Website > Start.
- Verify the domain.com website has started.
- Repeat steps 1-10 for website.com.
- Right click domain.com and select Manage Website > Browse domain.com on *:80 (http).
- Verify the web browser returns the index.html file you created for domain.com from the local server and remote client.
- Repeat step 13 for website.com.