Hi, On Fri, 17 Dec 2004 23:07:12 +0900, Sarah Tanembaum <sarahtanembaum / yahoo.com> wrote: > Kent Sibilev wrote: > > Oh, This is quite easy. I assume you have Ruby and RubyForApache installed. > > > > 1. Edit Apache's httpd.conf file by adding the following: > > > > LoadModule fastcgi_module modules/mod_fastcgi.so > > > > <IfModule mod_fastcgi.c> > > AddHandler fastcgi-script .fcgi > > </IfModule> > > > > 2. Create test.fcgi file in (for example) c:\Program Files\Apache > > Group\Apache2\cgi-bin directory with this content: > > > > #!c:\ruby\bin\rubyw.exe > > require 'fcgi' > > counter = 0 > > FCGI.each_cgi('html3') do |cgi| > > counter += 1 > > cgi.out { > > cgi.html { > > cgi.body { > > cgi.h1 { "Hello World!" } + > > cgi.p { "Counter: #{counter}" } > > } > > } > > } > > end > > > > 3. Hit http://localhost/cgi-bin/test.fcgi > > > > Cheers, > > Kent. > > > > On Dec 16, 2004, at 1:47 PM, Sarah Tanembaum wrote: > > > >> How do you test if fastcgi is working? I know that the apache loaded > >> the fastcgi modules correctly. Now, how do you configure fastcgi in > >> Apache2 so it will work with ruby. Using just standard cgi, I can run > >> ruby.cgi with no probs, except the startup time a bit longer than usual. > >> > >> Thanks. > >> > > > > > > > May be I did something wrong. I have not been able to run fcgi, and yes, > I did try your sample script. So, I test using 'irb' if there are error ... > > % irb > LoadError: No such file to load -- fcgi > from > c:/apps/ruby/ruby-1.8/lib/ruby/site_ruby/1.8/rubygems/loadpath_manager.rb:5:in > `require__' > from > c:/apps/ruby/ruby-1.8/lib/ruby/site_ruby/1.8/rubygems/loadpath_manager.rb:5:in > `require' from (irb):1 > irb(main):002:0> > > Any idea? > > Sarah Please confirm that the files are where they are supposed to be. For comparision, I'm providing the locations of the files on my system: C:\desenvolvimento\ruby\lib\ruby\site_ruby\1.8\i386-msvcrt\fcgi.so C:\Arquivos de programas\Apache Group\Apache2\modules\mod_fastcgi.so My httpd.conf has this: LoadModule fastcgi_module modules/mod_fastcgi.so <IfModule mod_fastcgi.c> AddHandler fastcgi-script .fcgi </IfModule> LoadModule ruby_module modules/mod_ruby.so <IfModule mod_ruby.c> # for Apache::RubyRun RubyRequire apache/ruby-run # exec files under /ruby as ruby scripts. <Location /ruby> SetHandler ruby-object RubyHandler Apache::RubyRun.instance Options +ExecCGI </Location> # exec *.rbx as ruby scripts. <Files *.rbx> SetHandler ruby-object RubyHandler Apache::RubyRun.instance </Files> </IfModule> And finally, my sample scripts: C:\Arquivos de programas\Apache Group\Apache2\cgi-bin\hm.fcgi #!C:/desenvolvimento/ruby/bin/ruby.exe require 'fcgi' counter = 0 FCGI.each_cgi('html3') do |cgi| counter += 1 cgi.out { cgi.html { cgi.body { cgi.h1 { "Hello World!" } + cgi.p { "Counter: #{counter}" } } } } end And: C:\Arquivos de programas\Apache Group\Apache2\htdocs\ruby\hw.rbx require "cgi" cgi = CGI.new print cgi.header("type"=>"text/plain") print "hello world" I have been able to setup rails using fastcgi on Windows, thanks to Kent. :-) Cheers, Joao