Since mid January this blogs runs on a WordPress installation in an Azure VM. Because I always thought that the subject is quite complicated this blogpost offers a view behind the scenes.
Why this move?
So far this blog (both German and English Version) runs on a hoster somewhere in Germany. The main problem with this hoster was that they didn’t offer Windows Server 2012 R2 and that the contract is only annullable once a year. The annual termination was my mistake when we’ve first signed the contract. There was a monthly alternative but somehow I didn’t choose it. But anyway I wasn’t happy anymore since the communication only works via E-Mail or worse via Fax. Another reason for Azure: I own a MSDN Ultimate Licence including 150€ deposit at the moment. I’m sure I can work with that.
Windows Azure – a VM for Blogs
The migration to Azure had to be very fast and since I worked on the WordPress installation a lot over the past years I wasn’t so sure if the blog will run on Azure websites. Also there was this problem with the databases: the two MySQL databases are not really “small” and therefore I would have to pay more for the MySQL hoster as for the pure VM. That’s why I choose an Azure VM. Otherwise I would always recommend an Azure Website. There is a WordPress alternative that runs with SQL azure but I didn’t have a closer look on it. The creation of the VM was really simple and it only took me some minutes:
WordPress installation with the web platform installer
Like I mentioned before the blog runs on WordPress and I didn’t had any problems with IIS/Windows/PHP/MySQL (besides some WP Plugins don’t get along with windows). The installation is easily done with the Web Platform installer:
Data migration: wp-uploads / database
After the “pure” installation I’ve fetched my data from the old installation including the “wp-uploads” directory and the theme. My MySQL database was generated with a Powershell Script (I use this one as well for the Backup of the MySQL DBs). I’ve integrated the script later via the HeidiSQL on the Azure VM. Just put the information in the suiting wp-config.php and it runs.
DNS migration: code-inside.de/blog on blog.condeinside.eu
With this migration I’ve tried to address the whole domain subject. Until now this blog used to run on “code-inside.de/blog”. For a while I’ve planned to go away from the “Subdirectory” and to an own “Subdomain”. I’ve already blogged about this here. The aim was: Change to subdomains and to the new domain “codeinside.eu” (supporting the European spirit ) The www.code-inside.de just links to the public IP of the Azure VM. “Blog.codeinside.eu”, “blogin.codeinside.eu”, “cdn.codeinside.eu” links via CName to codeinside.cloudapp.net – which in fact links to the Azure VM as well.
The IIS includes the following structure:
- ci-blog answers the hostname “blog.codeinside.eu”
- ci-blogin answers the hostname “blogin.codeinside.eu”
- ci-cdn answers the hostname “cdn.codeinside.eu”
- redirects is my “catchall” application
The main redirect – operated via web.config
The aim of the redirection was to keep all the links alive:
- code-inside.de/blog has to link to blog.codeinside.eu
- code-inside.de/blog-in has to link to blogin.codeinside.eu
- code-inside.de/files has to link to cdn.codeinside.eu
- everything else has to link to the new main page “www.codeinside.eu”
The “redirects” App in IIS includes nothing but a web.config with the following content:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <clear /> <rule name="code-inside.de blog-in" stopProcessing="true"> <match url="blog\-in(.*)" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> <add input="{HTTP_HOST}" pattern="code-inside.de" /> </conditions> <action type="Redirect" url="http://blogin.codeinside.eu{R:1}" redirectType="Permanent" /> </rule> <rule name="code-inside.de blog" stopProcessing="true"> <match url="blog(.*)" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> <add input="{HTTP_HOST}" pattern="code-inside.de" /> </conditions> <action type="Redirect" url="http://blog.codeinside.eu{R:1}" redirectType="Permanent" /> </rule> <rule name="code-inside.de files" stopProcessing="true"> <match url="files(.*)" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> <add input="{HTTP_HOST}" pattern="code-inside.de" /> </conditions> <action type="Redirect" url="http://cdn.codeinside.eu/files{R:1}" redirectType="Permanent" /> </rule> <rule name="catch all" stopProcessing="true"> <conditions logicalGrouping="MatchAll" trackAllCaptures="false" /> <action type="Redirect" url="http://www.codeinside.eu" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
WordPress saves the “public” URL on different places – therefore I was forced to use HeidiSQL for some tasks (because I was constantly redirected to the old Admin Dashboard ) or change the values in the configuration.
Adjust Feedburner configurations
The RSS Feed of this blog is still provided by Feedburner. With the DNS configurations I had to change these values as well.
Misson completed
So far I’m pretty happy with the results. If you recognize an error or if something isn’t working as good as it has worked in the old version please feel free to contact us in the comments below or on E-Mail/Twitter or anywhere else. An improvement from the traditional hoster is the dashboard:
Both blogs are currently running on a small (1 core, 1.75 GB memory) VM (two VMs would be too difficult because of the MySQL installation) and so far it looks really nice. I’m planning on giving you an update after a month to show you the costs of azure with this constellation and with the traffic on the blog. Questions? Go for it