Windows 2008 Server Web Editoin x86 の IIS7 の FastCgi を利用し、Ruby on Rails 2.2.2/2.3.2 を動かす。
IIS7 での Rails はリンク切れの情報が多いが、以下の最近(2009/03)の回答から
http://forums.iis.net/t/1156239.aspx
すると、 IIS7 でも問題なく稼動していると考えられる。
当初 Error 500 にて動作しなかったのは、log ファイルなどへの書き込み権限が不足していたのが原因であった。
しかし、実際に稼動させることができたが、他の PHP アプリケーションと同じサイトでそのまま稼動させることはできないことに気がついた。
Root / 以下の URL が Rails の管理下になるため、 このサイトに仮想ディレクトリを作成した他の PHP などアプリケーションなどの利用はできない。 ( router.rb により対応可能か(?) )
1. 仮想ディレクトリでの対応でなく、サイトを追加により対応する。

2. 以下の資料を参考に作業をすすめる
10 steps to get Ruby on Rails running on Windows with IIS FastCGI
http://mvolo.com/blogs/serverside/archive/2007/02/18/10-steps-to-get-Ruby-on-Rails-running-on-Windows-with-IIS-FastCGI.aspx
上記の資料は IIS6 の環境の例であるため、 IIS7固有の部分の以下の示す。


3. RubyforIIS についてはここより取得
Where is RubyforIIS (rubyforiis.sosukodo.org) has disappeared!
http://forums.iis.net/p/1154234/1889560.aspx#1889560
4. URL Rewiter を設定
Ruby on Rails in IIS 7.0 with URL Rewriter
http://blogs.iis.net/ruslany/archive/2008/08/07/ruby-on-rails-in-iis-7-0-with-url-rewriter.aspx
・ c:/InstantRails/rails_apps/myapp/publick/web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="ROR" path="dispatch.fcgi" verb="*" modules="FastCgiModule" scriptProcessor="C:\ruby\bin\ruby.exe|C:\InstantRails\rails_apps\myapp\public\dispatch.fcgi development" resourceType="Unspecified" requireAccess="Script" />
</handlers>
<rewrite>
<rules>
<rule name="Imported Rule 1">
<match url="^$" ignoreCase="false" />
<action type="Rewrite" url="index.html" appendQueryString="true" />
</rule>
<rule name="Imported Rule 2">
<match url="^([^.]+)$" ignoreCase="false" />
<action type="Rewrite" url="{R:1}.html" appendQueryString="true" />
</rule>
<rule name="Imported Rule 3" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
</conditions>
<action type="Rewrite" url="dispatch.fcgi" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="ROR" path="dispatch.fcgi" verb="*" modules="FastCgiModule" scriptProcessor="C:\ruby\bin\ruby.exe|C:\InstantRails\rails_apps\myapp\public\dispatch.fcgi development" resourceType="Unspecified" requireAccess="Script" />
</handlers>
<rewrite>
<rules>
<rule name="Imported Rule 1">
<match url="^$" ignoreCase="false" />
<action type="Rewrite" url="index.html" appendQueryString="true" />
</rule>
<rule name="Imported Rule 2">
<match url="^([^.]+)$" ignoreCase="false" />
<action type="Rewrite" url="{R:1}.html" appendQueryString="true" />
</rule>
<rule name="Imported Rule 3" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
</conditions>
<action type="Rewrite" url="dispatch.fcgi" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
5. 組み合わせにより動作しない
msvcrt-ruby18.dllがAPPCRASHとなる
http://home-mg.que.ne.jp/20080216.html
今回の稼動環境
Ruby version 1.8.6 (i386-mswin32)
RubyGems version 1.3.1
Rails version 2.2.2
Active Record version 2.2.2
Action Pack version 2.2.2
Active Resource version 2.2.2
Action Mailer version 2.2.2
Active Support version 2.2.2
6. 権限が不足している場合、500 エラーとなる
http://forums.iis.net/t/1156239.aspx
その他
以上
0 件のコメント:
コメントを投稿