Yesterday I disappeared down a deep hole as I worked to move a handful of low traffic WordPress sites that I maintain over to Windows Azure.
I have been contemplating the move for some time and I know WordPress runs well on Azure as I tested it several months ago.
The big difference with this install was to use the WordPress network setup. It used to be referred to as Multi-Site. The basic premise is that you can host multiple WordPress sites under one installation and use only one database.
I wanted to do this for these low traffic sites because Azure offers one 20MB database for free and I save not spending $9.99 per month on separate databases for the sites. In this case I have four sites setup and that saves me at least $30 per month in database costs.
Now this wrap up of my experience is not intended to be a 100% step by step process of install WordPress Network on Azure and the subsequent setup. I will certainly share some of the sources I used as well as some of the gotcha’s I learned in the process.
I am also not going to delve into the subscription process for Azure. There are many programs with Microsoft that offer access to Azure as part of the subscription so check those options out. Of course, there is always the straight up pay as you go option plus 6 and 12 month subscriptions that offer discounts as well. Check out the Windows Azure subscription page for more info.
So to get started, once you have your subscription or the free 30 day trial of Azure setup, you must add a website to your subscription. There is a menu that walks you through the process and you select a WordPress based site from there. The free database is also setup during this process and you will pick your unique identifier that will be used in the yourname.azurewebsites.net web address for your site. The current version of WordPress being offered is 3.6 so it will require an update to 3.7.1 when you first log in.
Once you install WordPress set things up as you would for a normal WordPress install by going through the initial site setup.
At this point you should have the basic WordPress site with a new user setup. Once you convert the installation over to a WordPress Network this will become your main site and you will access all be able to access the network sites you add through it. Of course, all the network sites you install will also be able to be accessed by other user accounts that are created, etc.
So in order to turn that standard WordPress install into a WordPress Network you need to follow the instructions at http://codex.wordpress.org/Create_A_Network. That page also has additional info about the layout of a WordPress Network site and how you administer the sub sites. Personally I picked the sub-folder option instead of the sub-domain – seemed easier to deal with relating to wildcard domains, etc.
OK so now you have a WordPress Network installed on windows Azure and at least the base site is setup. I recommend that before you add any sub sites to this setup that you go ahead and link this base site with the URL you want to use to access it.
Now if you are happy using site names such as yourname.azurewebsites.net for the base site or yourname.azurewebsites.net/subsitename/ for the network sites then you actually do not need to take any further steps relating to URL’s.
However, if you want to allow visitors to use a proper URL for the site such as we see across the web then you need to take the steps outlined at Configuring a custom domain name for a Windows Azure web site page.
This is where I spent a significant chunk of my day yesterday frustrated and unable to connect the domains I wanted to the network sites I had created. Ultimately, I decided to work the DNS settings from my domains at my current web host because they gave me much finer control over setting the TTL (Time To Live) that enabled my DNS updates to be seen much quicker.
Follow the instructions on the Configuring a custom domain name for a Windows Azure web site page to set up the awverify CNAME options on your domain registrar’s DNS settings page and if you can enter the TTL yourself then put 900 instead of 14400. This will insure your update gets propagated much quicker then once it is propagated and you have verified your domain on Azure you can change it back to the default 14400.
Also, make sure you include an awverify.www that points to your Azure websites domain so that you can also access the domain using the www sub-domain as well. Make sure you add them both (www.yourdomain.com and yourdomain.com) on the Manage Domains page at the Azure Management Portal. I chose to leave the awverify CNAME entries in my DNS settings just in case I need to re-add the domain to Azure in the future. They are not causing any harm by staying there.
Be sure you go back to your DNS settings and enter the IP address of your Azure website in the A record entry. The IP address is available at the bottom of the Manage Domain page in the Windows Azure Management Portal.
So now you have domains pointed to your WordPress Network’s primary site and maybe even to some of your sub-sites in the network. In order to direct visitors to the right network site you need to place a director app in your host site t manage that.
The WordPress plugin you are looking for is WordPress MU Domain Mapping by Donncha O Caoimh. His plugin page explains installation and setup but there is one piece of info missing. If you choose to handle all the domain mapping from the base WordPress Network site then you will need Site ID’s for the networked sites on your install. These were not readily available but I found a way to discover them. Just log into one of the sub sites you have on your install and then upload a single image through the WordPress Media library. That will create a directory related to that website and it will appear under the wwwroot>wp-content>uploads>sites>xx on Windows Azure when you access the site with an FTP program. The last two digits in that location is the Site ID. It typically begins with 11 and then 21, 31, 41 etc. At least that is how they came up for my 5 network hosted sites.
With that info you can go back into you main base WordPress Network site and point your previously verified domains, including both the domain and the www sub-domain, to the right site under your WordPress Network set up.
Let me know in the comments if you have any questions about what I have shared and I can also provide further details and suggestions there as well.