Configuring Multliple Sites On IIS 7
If you're playing along at home since my my last post you should now have the latest and greatest version of ColdFusion installed successfully on IIS.
So now what? Well now we take advantage of the fact that we can create multiple sites under one root. As a refresher here is the example I mentioned in the last post:
- wwwroot
- site1
- components
- myComponent.cfc
- components
- site2
- components
- myComponent.cfc
- components
- site1
In the example above I might have the following code under site1:
Which gives us a major headache when we move site1 to production and it's now lying in the root. What would really be cool is if we could have both site1 and site2 set up as seperate sites on the server so that we could call:
from either site1 or site2 and have both work as expected.
That's where IIS comes in. As previously mentioned I like GUIs. The GUI management console for IIS7 is pretty slick looking. Here's a screenshot of the main console:
So let's add a new site (pay no attention to test1 and test2 in that screenshot above). To add a new site right click on 'Web Sites' and select 'Add New Site'. Wow...that was tough.
This presents us with a simple dialog box of properties for our new site.
This configuration gives us a very nice and easy to use http://test1 URL on our local machine. Now that we've got a site built we can code to our hearts content assuming a simple and easy transition to our production environment.
Oh - almost forgot. You'll also need to modify your hosts file to get your system to recognize the host header you specified in IIS. Here's what it should look like when you're done (assuming you followed my example above and created test1 and test2).
And that is all. As I said in my last post I am under the impression that there is no limitation to the amount of sites you can run on IIS7. This is a nice change from the previous limitations of only being able to run a single site at a time.



Can you also do this (adding multiple sites) for IIS 5.1 on Win XP Pro?
I set it to "mysitetest" and also added the entry for mysitetest aliased to the localhost IP (127.0.0.1) and flushed the dns (ipconfig /flushdns) but when I try http://mysitetest/ on the browser rather than getting my site I get the IIS7 splash screen instead.
If I remove the "hostname" (host header in your figure) and leave it blank then I can access my site using the IP address (http://192.168.0.65/).