Multi-sites Umbraco setup in a load-balanced enviornment

This post is about how to configure multiple Umbraco sites in a load-balanced enviornment. We will be setting up our sites in AWS behind the Elastic Load Balancer.
I have found the Carbon Powershell extension and SysinternalsSuite tool quite useful, and I will be using those to setup our boxes. You can get the extentions from here along with the script to setup boxes.
In order to properly setup Umbraco behind a load-balancer, you will need a dedicated Admin only site that sits outside the load balancer and has its own DNS record. Here is our DNS configuration for this example.

  • Admin Only:
  • Website: ("A" record is pointing to the load-balancer)

I am assuming you have setup either your Domain Controller(DC) or configured windows share properly, so that the Servers are accessing Media and ExamineIndex folders that are created in the Admin box. In this tutorial, we are using windows share. If you haven't configured the Windows share, you can do that below.
Here is an overview of the steps we would have to take:

  • Configure Umbraco to enable cache clearing
  • Setup Admin box and configure Windows Share
  • Setup Windows Share for ELB Servers.
  • Setup ELB Servers

The first step is to configure Umbraco to clear the cache. We are going to setup the clear cache in a generic way so that we don't have to modify this file per publishing profile. We can just set it once and create Virtual Hosts for mapping the servers. Let's modify the umbracoSettings.config file in config folder to the following.

  <distributedCall enable="true">

Server*.MyCompany.MyBrand.Web are basically the virtual hosts for ELB servers that you set in the Hosts file. In this example we are configuring Umbraco to Maximum of 4 Servers. MyCompany.MyBrand.Web will always point to If we don't list the localhost, Umbraco doesn't clear the self cache.

The github repo has a BoxSetup.ps1 file which will help you setup your boxes easily. The script assumes that you have the Carbon extensions installed at C:\Utilities\Carbon\Import-Carbon.ps1. Please update the location if yours is different. Let's login to the Admin EC2, and run the script

powershell.exe -ExecutionPolicy Bypass -NoLogo -NoProfile -File BoxSetup.ps1 -Admin -AppUrl "" -MediaFolder "D:\MyCompany.MyBrand.Web.Media"  -ExamineIndexesFolder "D:\MyCompand.MyBrand.Web.ExamineIndexes" -ConfigureShare  

This will setup an IIS site with proper bindings, and will add the virtual folders for Media and ExamineIndexes. If you haven't configured the windows share, it will do so. You will be asked for the IP-Address of the Servers, enter them in the order that you would like to configure your servers. This script will also asign the IP-Address of the servers to a host entry, so that the cache clearing machenism is able to pick them up.

Next let's setup our ELB Servers. Login to the the Server1 EC2, and configure the windows share for Media folder and ExamineIndexes folder.

powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -File BoxSetup.ps1 -Web -AppUrl "" -ServerNumber 1 -MediaFolder "\\MyCompanyMyBrandWebMediaConnection\MyCompanyMyBrandWebMedia"  -ExamineIndexesFolder "\\MyCompanyMyBrandWebExamineIndexesConnection\MyCompanyMyBrandWebExamineIndexes" -WindowsShareIP XX.XX.XX.XX  

Now copy the same command, switch the ServerNumber from 1 to 2, and let's login to the second box and after configuring the Windows share folders, run:

powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -File BoxSetup.ps1 -Web -AppUrl "" -ServerNumber 2 -MediaFolder "\\MyCompanyMyBrandWebMediaConnection\MyCompanyMyBrandWebMedia"  -ExamineIndexesFolder "\\MyCompanyMyBrandWebExamineIndexesConnection\MyCompanyMyBrandWebExamineIndexes" -WindowsShareIP XX.XX.XX.XX  

The following script will create and install an IIS site and add the approprite binding for clearing the cache for the virutal hosts that was added in the umbracoSettings.conf file. Each IIS site in ELB needs to be uniquely addressable by a hostname from the admin box. This is how we can install multiple Umbraco sites in the same box, and find the appropriate Umbraco node at the time of publishing.

In summary, we added the Virtual Hosts mapping to the umbracoSettings.conf. We then mapped Hosts entry in the Admin Box with the approprite IP-Address. Finally, we added IIS binding to the specific ELB servers to receive the clearing cache message from Admin.

You are all set. Your Umbraco Admin box is now hosted in its own DNS record, and you can now optionally disable /umbraco in your ELB servers for security reason. After you publish any changes, the Admin box will automatically clears the cache for the ELB server through the configured Virtual hosts. If you are using Courier for your deployments, everything should work properly. Courier can publish your media and content as long as they are being published to a single server, and since we have setup a seprate box for Admin to share the Media and ExamineIndexes folder to the ELB Web Servers, everything will work as expected.

If you are looking to install another Brand for your company. Open the SetupBox.ps1 script and just replace every instance of "MyBrand" with "MyOtherBrand" and just change the drive mapping for the Media and ExamineIndex folders. Re-run the scripts again and you should have two Umbraco sites running side by side in the same box.

comments powered by Disqus