IIS is Microsoft’s Role – Based web server, and is relatively easy to set up. However most people assume that you can’t host multiple websites on one 1 IP address, similar to Apache and it’s famous virtual hosts functionality. That couldn’t be further from the truth fortunately! Read more to find out how to configure Microsoft IIS to host multiple domains with 1 IP address. I’m starting out with a freshly installed and fully patched Server 2008 machine – you can use an existing server if you have one ready to go as well, or you can follow along and start from scratch. Let’s jump into it.
Step 1.) Install the IIS Role With The Server Manager Snap In
Open up the server manager snap in and click on Roles, Add Roles, Web Server ( IIS.) Stick with default role options until you know for sure that you need additional functionality down the road. You may or may not need additional role services depending on what type of web applications you’re hosting, so it’s best to start off slow and add as needed.
Step 2.) Check Your Default IIS Site
Open up a web browser and enter in the default site by entering the host name or IP address to check that IIS is running and working as intended. Keep in mind that since we’re going to be using virtual hosting, also known as name based hosting, we’ll need to hit the server by domain name down the road. If you see the IIS7 banner in your browser, you’re good to go.
Step 3.) Configure Your Host Headers
The host header is what allows IIS to host multiple websites on 1 IP address, since it’s examining GET requests based on name, and not the IP address. Expand the IIS Management tool and open up Selections, Sites. From this point you’re simply going to right-click on the sites in question and go to the “host headers” option – fill in your desired FQDN as shown in the image. Set the IP address to either “All Unassigned” or explicitly set the IP address. This part is especially important if you are using a public IP address to serve the websites. If you’d like to learn more about configuring a network card to listen on multiple IP addresses, you can check out this tutorial here.
And that concludes our basic tutorial on hosting multiple domains with IIS and name based headers. While it’s not as elegant as virtual hosting with Apache, it does get the job done. What do you guys think? Do you prefer IIS or Apache for name based virtual hosting?