Moving WordPress Blog to Custom VM hosted on Windows Azure

Some months ago I migrated my blog from blogger to self hosted WordPress on Windows Azure. My initial experience was good, having a website hosted on azure standard instance with MySQL database somewhere in cloud. All good, I started doing some WordPress optimization.

One day I got an alert from “ClearDB” that my database storage is about to reach limit and then I realized that MySQL database for my blog was actually hosted by ClearDB which by default gives you only 20 MB free space plus with the option to get 1 GB for $9.99 per month. So they expect me to pay for both website hosted on Azure and then MySQL database as well. Yes as MSDN subscriber I do get $150 credit for Azure but I don’t want to waste them plus pay an additional amount to ClearDB. This does not make sense to me as I can get complete WordPress hosting on $9-$13 per month, why would I pay 9 dollars just for database 😐

I also cleaned up DB to reduce its size by removing revisions, spasms etc. but I kept getting the annoying alerts from ClearDB. Therefore I decided to get rid of this model and create my custom VM to host WordPress website with MySQL database.

I end up creating a Ubuntu virtual machine on Windows Azure (yes we are fortunate to see this day) and thereby creating a complete LAMP environment. I followed an article “How to setup rock solid VM on Windows Azure for your WordPress blog” and it worked smoothly. So I mapped the domain to this new VM and satisfied so far.

Another benefit I see of having custom VM is that you can save the snapshot as backup or later host it somewhere else as well.

How is your experience of hosting blog, dear reader?

Tips to Optimize WordPress on Azure

Few months ago, I moved my blog to WordPress on Azure. I am not a WordPress expert, not even near to it but as hosting is charged or free for limited configuration, it is better to optimize and leverage the current resources first before scaling out on cloud.

So I would like to share few tips based on my experience. Just a bit background, I mostly blog for technical stuff so I used a lot of images and code snippets to transfer my message.

1. Utilize free online storage for Images

Content like images can take relatively large percentage of your space and bandwidth. Instead of adding media to WordPress, try utilizing online service like Flickr, DropBox, SkyDrive etc. They provide sufficient free storage to start with and reduce your site storage space and bandwidth as well. Simply add images by linking URL in your blog posts. The only issue is that it might be a bit tedious to upload elsewhere and then embedding the URL but I believe you can come up with smart way to do this like using a client application to upload content online.

2. ClearDB database size near quota limit

So when you host WordPress on Azure, the MySql database is hosted to a Azure partner i.e. ClearDB. It’s a bit weird and I was surprised to see a sudden email from ClearDB that my database size is near quota limit. First of all I never knew that my blog database was hosted their and then I didn’t know about the limit earlier and ClearDB apparently offer 9.99/month for just 1 GB and 49.99/month for just 5 GB. Makes me thing are we living in 2013 or 2003, well I don’t blame them but giants like Google, Microsoft, Yahoo, DropBox has raised the bar high for me in terms of storage.

Anyways, my 2 cents here are that before upgrading to any paid package, try installing WordPress Database optimization plugins. I tried a plugin ‘Optimize Database‘. It basically remove revisions, spams etc. Worked really well, saved more than 50% storage for my poor 20 MB free database storage.

3. Use GitHub Gist to share code

Code snippets for any programming language requires a little more attention then just text. You may have to format it well like code are formatted in development environments and you may need to update it over time. I have started using Github Gist.

Gist is a simple way to share snippets and pastes with others. All gists are Git repositories, so they are automatically versioned, forkable and usable from Git.

4. Leverage Caching

Caching can prove to be really handy for performance and saving bandwidth, provided it is properly configured. On WordPress, I have installed a plugin “W3 Total Cache“, have started using it yet I am still exploring its configuration. It looks promising though. Comes with features like page caching, HTML/JS/CSS minify, database caching, browser caching etc. Highly recommended.

Well those were some tips from my end for optimize hosting, what are yours?

My Experience of Migrating blog from Blogger to WordPress on Azure

You may have noticed the new look of my blog with a bit difference in URLs, as I have migrated from Blogger to WordPress that is hosted on IIS deployed on Microsoft Windows Azure.


  • Migrate all posts from Blogger to WordPress
  • Don’t end up with broken links for blog posts
  • New home page, simple and improved responsive layout
  • Update DNS settings to set to new site

Migrating Earlier Blog Posts

After creating a new WordPress site from Websites gallery in Windows Azure Portal, migrating earlier posts was very easy and straight forward, a tool comes out of box with WordPress, just utilize the tools to import blogger post and comments on WordPress

There is a great tutorial on how to create a WordPress website on Azure in few clicks

Dealing with Broken Links

First, I wanted to move all my blog post with URL like {domain}/blog/{year}/{month}/{title} which is not really default in WordPress, however you can set it under Settings -> Permalinks. The thing I was worried about is that earlier my URL were of scheme {domain}/{year}/{month}/{title}.html and I don’t want to break any URL previously linked blog post. So for this I need to create a custom structure under Permalinks.

However, after setting custom structure, you would end up in URL like:

To kick out index.php, you need to do some URL rewriting in your web.config, if hosted on IIS. This is pretty much explained in an article “Enabling Pretty Permalinks in WordPress“. Also refer to gist, code snippet, below containing “Main Rule”.

Second, blogger has convention of url scheme ending with .html. I want to get rid of .html but at the same time if I don’t want to break any previous linked blog post. For instance, a blog post link

should take me to new URL

Restoring NuGet Packages for External Dependencies

Therefore I have to add another rewrite rule. “Remove html” rule demonstrates the same in gist below:

<?xml version="1.0" encoding="UTF-8"?>
<rule name="Remove html" stopProcessing="true">
<match url="(.*).html$" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<action type="Redirect" redirectType="Permanent" url="{R:1}" />
<rule name="Main Rule" stopProcessing="true">
<match url=".*"/>
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
<action type="Rewrite" url="index.php"/>
<rule name="wordpress" patternSyntax="Wildcard">
<match url="*"/>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
<action type="Rewrite" url="index.php"/>

view raw
hosted with ❤ by GitHub

It took a little time to figure this out but I believe that was the most important thing. Another thing I want to preserve was social media interaction like Facebook Likes, Tweeted etc. But that is something I was not able to achieve that as such they don’t work on redirection… however what matter most was done.

Home Page and Improved Layout

Previously my home page was merely list of posts, I wanted to add a new home page with a good snapshot of everything like recent blog post, recent talks etc… and that was one of the reason I went for a separate /blog link setting. WordPress and a custom theme gives me flexibility of adding a static page with as home page. I would like to dive deep into the PHP thing to make most of it, but that’s a thing to do later.

DNS Settings

Well that was a bit tricky for me. For DNS settings, first you need to set A (Host) and CNAME (Alias) with Host @ pointing to your IP of server on Azure.

You can find the IP of your server in “Manage Domain” under “Configure” section of your Web site on Windows Azure Management Portal

Second, you need to add CNAME entries to awverify.{website_name} as screenshot depicts below:

Then all you have to do is to add your domain name in “Manage Domain” section

and that’s it. I am done! Enjoy reading my new blog and feel free to provide any feedback. If you are already hosting your blog/site somewhere else, try hosting it on Azure, it has it’s own benefits.