Install Node.js, iisnode module and Ghost on Windows Server / IIS

This post describes the steps necessary to install Node.js and Ghost on Windows Server IIS. Ghost is a Node.js web application, specific for just blogging. To run Node.js applications in IIS, you need iisnode as a module. Here is how to install all of this.

Ghost and Node.js on Windows IIS

Ghost is a simple, powerful publishing platform, developed in Node.js. Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

After reading about installing and running node.js applications within IIS on Windows, I wanted to run Ghost on IIS. Tomasz Janczuk developed the iisnode module for IIS to run node.js on IIS, so this should work for Ghost too..

Getting and installing Node.js, iisnode and Ghost on IIS – step 1

First you need all the software:

  1. Grab a copy of node-v0.10.26.x86.msi (node-v0.10.26.x64.msi)
  2. Grab a copy of iisnode-full-iis7-v0.2.7-x86.msi (iisnode-full-iis7-v0.2.7-x64.msi – choose the right flavor for your architecture)
  3. Grab a copy of ghost-0.4.1.zip from https://ghost.org
  4. Install the software on your IIS web server and verify iisnode is registered as a module.
  5. Unzip ghost-0.4.1.zip and place it in your webroot. Ghost cannot be installed in a subdirectory called ‘ghost’, be aware of that.

Set 2 – Set up and configure iisnode and Ghost Rewrites

Create a web.config file to configure iisnode. It needs to contain a handler for iisnode:

<handlers>
  <add name="iisnode" path="index.js" verb="*" modules="iisnode" />
</handlers>

Add a Rewrite directive for Ghost in your web.config:

<rewrite> <rules> <rule name="Ghost"> <match url=" (function() { var dropdown = document.getElementById( "archives-dropdown-5" ); function onSelectChange() { if ( dropdown.options[ dropdown.selectedIndex ].value !== '' ) { document.location.href = this.options[ this.selectedIndex ].value; } } dropdown.onchange = onSelectChange; })();   

    Loading time: 111 queries, 0.304 seconds using 15027120 bytes memory. Peak memory usage: 15778608 bytes.