Installation of version 0.1 on Windows 2003

PLEASE NOTE: this setup is only tested on Windows 2003 / IIS6. Instructions for Windows XP and Window 2000 comming soon!

Prerequisites

Before we can start the installation and configuration of RubyForIIS we need:

  • Windows 2003 server with IIS installed.
  • Ruby and Rails setup correctly.

Good instructions on setting up a (basic) Ruby on Rails installation can be found in the article Rolling with Ruby on Rails on the O'Reilly ONLamp site. We also need the following components for this installation:

Installation

Before we start and hookup IIS to a Rails application make sure your application is working properly. It can be though to figure out problems when accesing your application through the fastcgi interface. So first ensure your Rails setup is good in both development and production (ruby script\server -e production) setup.

Step 1

Create / reconfigure a web site in IIS. Link the home directory of your web site to the public folder of your Rails application.

Step 2

There are alternatives to the commercial ISAPI_Rewrite module. In future releases of the RubyForIIS component and installation documentation we will investigate these.

Install ISAPI_Rewrite. Just double click the .msi file you down-loaded and follow the setup wizard. There is a full version which you can try for 30 days and afterwards buy for $69 and a lite version. The lite version does not support a per-virtual-site configuration, so I opted for the trial version (which I bought as it works perfectly).

The rewrite rules are configured per site by placing an .ini file in the root folder of this site (the public folder of the Rails application). To redirect the incoming url’s to the dispatcher I used this set:

[ISAPI_Rewrite]
RepeatLimit 0
RewriteRule ^(/[^.]*)$ /dispatch.fcgi?$1 [L]

As at this point the dispatcher is not configured it will probably give you an IIS error page ore something.

Step 3

Install Ruby for IIS. The Ruby for IIS setup helps you to setup the FastCGI bindings within Ruby that we need. Execute the downloaded RubyForIIS-0.1.exe file.

Press next twice and choose 'finish'.

Step 4

Configure IIS to handle FastCGI. First we need to tell IIS what it should use tot process .fcgi files. First we extract isapi_fcgi.dll from the zip file we downloaded, and place this somewhere we can re find it (for now I used C:\Inetpub).

[tbc: what security settings are required?]

Now we need the IIS Manager. You can reach the Internet Information Services console by clicking “Start”, “Administrative Tools” and selecting “Internet Information Services (IIS) Manager” from the list.
Ror_setup_win2k3_0

Now right-click on “Web Sites” and select “Properties” from the list that appears. Go tot the “Home Directory” tab and click on “Configuration”. A similar screen to this one will appear:
Application Configuration

Click on “Add” to create a new application extension mapping. Use the “Browse” button to find the isapi_fcgi.dll file as your ”Executable”. The extension should be .fcgi, as pictured below.
Application Extension Mapping

We need to set up a “”Web Service Extension” to allow this dll to be executed. Right-click “Web Service Extensions” in the IIS Manager and select “ Add a new Web service extension...” from the context menu. Add the isapi_fcgi.dll file as required file and give the extension a appropriate name
New webservice Extension
Make sure you select the “Set extension status to Allowed” check box.

Finally, the FastCGI extensions require some registry settings, so start regedit and find and expand the HKEY_LOCAL_MACHINE\SOFTWARE\ key.

  • Create a new “Key” named “FASTCGI”
  • Within this new “FASTCGI” key, create a new key and type “.fcgi”.
  • Add a string value named “AppPath” to this new key. The value should be the path to rubyw.exe.
  • Add a string value name “Args”. This should point to your dispatch.fcgi file in your applications public directory.
  • Add a “BindPath” string. “This is the the named pipe FastCGI will use, so rails-fcgi should be a helpful name.

Required Registry Settings

To finish the configuration, restart IIS.

Step 5

There is no step 5. You now should have your Rails application served through IIS.

I love umbraco. Click here to go to the umbraco developer site