Installing Koken on a Windows Azure website.

2014-01-29

Koken is a free publishing CMS system designed around publishing photos and other media. Since this software has been designed around uploading and displaying media, it has a great interface and theme system.

I wanted to get a Koken site set up and running on an Azure website instance, and ran into a few snags, so I decided to document them here.

Installing

Installing Koken is very easy and worked without issue. You may want to refer to the offical installation instructions, but all you need to do is download the installation package from their site. Unzip it. Then upload to your empty Azure website. The package is just a single file. When you first hit the web page after uploading, this file will run it’s own installation process on the webserver. You will also need to set up a MySql database in Azure and let Koken know the

At this point, you can use the site somewhat. I was able to upload photos and change settings in the admin control panel. However, when I tried to access the homepage of the actual website, I recived a 403 error. After some trobleshooting, I figured out what was causing the access issue. Koken is written in PHP. PHP sites control access and settings through a .htaccess file in the root of the website. Although the site will partially run as is, and although Azure will run PHP websites, it does not know how to read an .htaccess file. IIS needs a web.config file in order to run.

Creating a web.config

The following is current to version 0.11.

Most of the .htaccess file is easy to convert. Most of the file is url rewritting rules, which is what was causing the 403 error. This part of the file can actually be converted, using the IIS manager. I was able to follow this guide, which walks through how to convert the rewrite rules. Note that you will need to have IIS installed, and you will need to install the Url Rewrite IIS module through the Web Platform Installer.

The rest of the file can be converted by hand. This guide had some good information.

This section is to add the file types for the .woff font, and the .lens css file. Note that the woff type isn’t actually in the .htaccess file, but it is needed for IIS.

1
2
3
4
5
<staticContent>
<mimeMap fileExtension=".lens" mimeType="text/css" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff"/>
</staticContent>

And the cache section.

1
2
3
4
5
6
7
8
<caching enableKernelCache="true" enabled="true">
<profiles>
<add extension=".php" kernelCachePolicy="DisableCache" policy="DisableCache"/>
<add extension=".mp4" kernelCachePolicy="DisableCache" policy="DisableCache"/>
<add extension=".js" kernelCachePolicy="CacheUntilChange" policy="CacheUntilChange"/>
<add extension=".css" kernelCachePolicy="CacheUntilChange" policy="CacheUntilChange"/>
</profiles>
</caching>

I did not convert the gzip section, since this is turned on in Azure by default. The default document settings are also already configured in the Azure configuration section. I also did not convert the commented out SSL section of the .htaccess file. This could also be done with the Url Rewite converter.

You can download complete file I ended up using. However, if you are setting up something similar, you probably want to ensure that any settings needed in the current version of Koken are converted.