Download the latest ruby-web_x.x.x.tar.gz. Run the enclosed installer:
% cd ruby-web_x.x.x % ruby install.rb config % ruby install.rb setup % ruby install.rb install
This will compile and install the ruby-web interpreter into the same directory as ruby. If you are running ruby-web as a cgi, all you need to do is swap ruby-web for ruby:
#!/usr/bin/ruby-web puts 'Hello, World'
After configuring ruby-web as the interpreter, you need the library to run fastcgi.
You will still need to do the standard FastCGI config on your webserver. You can find a links to extensions for Apache and other web servers at http://www.fastcgi.com
To use the ruby-web interpreter with mod_ruby, there is a slightly different configuration for http.conf:
<IfModule mod_ruby.c>
RubySafeLevel 0
# for Web::RubyRun
RubyRequire web/sapi/apache
<Location / >
Options Indexes FollowSymLinks ExecCGI
AddHandler ruby-object cgi rb rhtml
RubyHandler Web::RubyRun.instance
</Location>
</IfModule>
ruby-web provides a Web::RubyWebHandler, based on the CGIHandler, to run ruby-web scripts. You will need to add the Web::RubyWebHandler to webrick with a startup script like this, replacing :DocumentRoot with the appropriate value:
#!/usr/local/bin/ruby
$: << File.dirname($0)
require 'webrick'
require 'web/sapi/webrick'
include WEBrick
# These lines configure webrick to handle .rb and .rhtml files with ruby-web
HTTPServlet::FileHandler.add_handler("rb", Web::RubyWebHandler)
HTTPServlet::FileHandler.add_handler("rhtml", Web::RubyWebHandler)
s = HTTPServer.new(:Port => 80,
:DocumentRoot => "./htdocs" )
trap("INT"){ s.shutdown }
s.start