How to install two websites in IIS
Enjoying this content? Subscribe to the Channel!
IIS Power Play: How to Host Multiple Websites on One Server (The Host Header Trick!)
Welcome back to Darren’s Tech Tutorials!
Running multiple websites efficiently is a critical skill for any server administrator. If you’re managing an environment where IP addresses are limited, or you simply want to consolidate services, you’re in luck! Microsoft’s Internet Information Services (IIS) allows you to host dozens—even hundreds—of different websites using the exact same IP address and the same standard port (Port 80).
How do we do this magic trick? We use something called Host Headers.
In this comprehensive, step-by-step guide, we’re going to walk through how to configure IIS to successfully host two different domains on one server binding. This tutorial uses IIS 10 on Windows Server 2016, but the process is nearly identical for IIS 8 and Server 2012.
Let’s get started!
Setting the Stage: Prerequisites and Preparation
Before we jump into the IIS Manager, there are a few foundational steps you must complete. If you haven’t done these, pause the tutorial and follow the links below:
- Install IIS: Ensure Internet Information Services is properly installed and running on your Windows Server instance.
- Configure Content Folders: For two websites to exist, they need two separate physical locations on the server. We recommend creating two simple folders, for example:
C:\inetpub\wwwroot\WebsiteAC:\inetpub\wwwroot\WebsiteB
- Configure the Hosts File (Local Testing Only): Since you might not have public DNS records for your test domains, you need to manually tell your testing computer which IP corresponds to which hostname. Editing the local hosts file is essential for testing multiple domains locally.
Tip: Make sure to create a simple index.html file in each folder (WebsiteA and WebsiteB) that clearly states which website you are looking at. This ensures easy verification later!
Step-by-Step Guide: Adding the Second Website to IIS
The key to running multiple sites on the same IP and port is defining a unique Host Header for each site. This tells IIS which website directory to deliver based on the domain name (the host header) requested by the user’s browser.
1. Open the IIS Manager
Go to your Start menu, navigate to Administrative Tools, and open the Internet Information Services (IIS) Manager.
2. Verify or Configure the Default Website
Most servers already have a ‘Default Web Site’ configured. Ensure this site is bound to your server’s IP address on Port 80. For this tutorial, let’s assume your Default Site is configured for:
- Physical Path:
C:\inetpub\wwwroot\WebsiteA - Host Name (Header):
websiteA.local(or whatever domain you are using for the first site) - Port: 80
3. Add the Second Website Binding
This is where we introduce the second site (WebsiteB) using the same IP and port.
- In the Connections pane on the left, right-click on the Sites folder.
- Select Add Website…
- Configure the following settings in the dialog box:
- Site Name: Give the site a descriptive name (e.g.,
Second Website - WebsiteB). - Application Pool: Generally, you can leave this as the default or create a new dedicated pool.
- Physical Path: Browse and select the folder you prepared for the second website (e.g.,
C:\inetpub\wwwroot\WebsiteB). - Type:
http - IP Address: Select the specific IP address of your server (or leave as
All Unassigned). - Port: Set this to 80.
- Host Name (The Critical Step!): Enter the specific domain name that this site should respond to (e.g.,
websiteB.local). This is your Host Header.
- Site Name: Give the site a descriptive name (e.g.,
4. Review the Bindings
Once you click OK, both sites are active, sharing the same IP and port!
To see the result of your configuration, click on the Sites folder in the left pane. You should see both site entries listed, and they should both show that they are running on the same IP and Port 80, differentiated only by their Host Header.
Testing the Configuration
It’s time for the moment of truth! We need to verify that your IIS server correctly directs traffic based on the domain name provided by the browser.
- Open your web browser on the machine where you edited the Hosts file.
- Test Website A: Type the first hostname into the address bar:
http://websiteA.localYou should see the unique default page you created for Website A. - Test Website B: Type the second hostname into the address bar:
http://websiteB.localYou should see the unique default page you created for Website B.
If both sites load correctly, you have successfully configured IIS to use Host Headers to run multiple websites on a single IP address and Port 80! Congratulations—you’ve just made your server management far more efficient.
Conclusion: Mastering IIS
Mastering IIS bindings using Host Headers is a fundamental skill that saves resources and simplifies server topology. Whether you’re a developer testing multiple application environments or an administrator consolidating small client sites, this technique is a game-changer.
If this tutorial helped you unlock more power from your Windows Server, please do us a favor! Like this post and subscribe to Darren’s Tech Tutorials for more practical, straightforward guides just like this one. If you have any questions about advanced bindings or host header issues, drop a comment below!
Happy hosting!