How to Run Keystone.js within IIS

2015/7/312 min read
bookmark this
Responsive image

A instruction of how to install node.js keystone at windows 7 IIS as web application.

  1. Install MongoDB
    • Install mongodb as windows service.
  2. Install Node.js
    • keystone.js is running on top of node.js, so you'll need to install node.js for windows.
  3. Setup keystone.js
    1. Now it's time to setup keystone web application run by node.js, go to the keystone home page and look throught their instruction or you can do as following.
    2. open command promt as Administrator and go to the folder where you want to add keystone.js
    3. type npm install -g generator-keystone
    4. type yo keystone
    5. above two command you'll setup your keystone.
    6. open node.js command promt and type node keystone
    7. If you can hit localhost:3000 then you're ready to setup keystone.js at IIS with IISnode.
  4. Install IIS(7 or 8) 
    1. how to install IIS(IIS7 at Windows 10, Windows 8, Windows 7)
      1. windows + c, open Programs and features as command or go to control panel to open Programs and features.
  5. Install IISNode
    • installed iisnode for iis 7/8 (x64)
    • do a test to make sure iisnode installed correctly
      • go to /Program Files/iisnode
      • click setupsamples.bat, this batch file will tell you how to setup a sample website at IIS by using iisnode.
  6. Install Url Rewrite module
    1. Install URL Rewrite 2.0
  7. Create WebSite at IIS and point to your keystone.js folder
  8. Add IUser, local login user to have modify permission to all the keystone.js folder
  9. Add Web.config to root folder or keystone
    1. this is very important to use node.js, keystone.js at IIS. Following is working web.config you can reference.
    2. 
      <configuration>
        <system.webServer>
          <handlers>
            <add name="iisnode" path="keystone.js" verb="*" modules="iisnode" />
          </handlers>
      	<rewrite>
            <rules>
              <rule name="Catch All">
                <match url="/*" />         
                <action type="Rewrite" url="keystone.js" />
              </rule>
            </rules>
          </rewrite>
        </system.webServer>
      </configuration>
  10. IIS Bindings
    1. Now, you can setup IIS bindings, you can map your mydomain.com to this iis website.