<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Bloggitation comments on Webserver with Mongrel</title>
    <link>http://typo.onxen.info/</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Bloggitation comments</description>
    <item>
      <title>"Webserver with Mongrel" by stoyan</title>
      <description>&lt;p&gt;After seen a small webservers in &lt;a href="http://naoya.g.hatena.ne.jp/naoya/20061113/1163418064"&gt;Perl&lt;/a&gt; and &lt;a href="http://subtech.g.hatena.ne.jp/secondlife/20061113/1163419442" title="webrick"&gt;Ruby&lt;/a&gt; here is my try with using &lt;a href="http://mongrel.rubyforge.org/"&gt;Mongrel&lt;/a&gt; :&lt;/p&gt;


&lt;em&gt;Start an webserver on all interfaces (0.0.0.0), port 3002, serving static pages from ./html/ directory:&lt;/em&gt;
&lt;pre&gt;
require 'mongrel'

config = Mongrel::Configurator.new :host =&amp;gt; "0.0.0.0", :port =&amp;gt; 3002 do
  listener { uri "/", :handler =&amp;gt; Mongrel::DirHandler.new("html/") }
  trap("INT") { stop }
  run
end

config.join
&lt;/pre&gt;

And with adding some statistics (on &lt;em&gt;http://.../status/&lt;/em&gt; &lt;span class="caps"&gt;URL&lt;/span&gt;):
&lt;pre&gt;
#!/usr/bin/env ruby
require 'rubygems'
require 'mongrel'
require 'yaml'

stats = Mongrel::StatisticsFilter.new(:sample_rate =&amp;gt; 1)

config = Mongrel::Configurator.new :host =&amp;gt; "0.0.0.0", :port =&amp;gt; 3002 do
  listener do
    uri "/", :handler =&amp;gt; Mongrel::DirHandler.new("html/")
    uri "/", :handler =&amp;gt; stats
    uri "/status", :handler =&amp;gt; Mongrel::StatusHandler.new(:stats_filter =&amp;gt; stats)
  end

  trap("INT") { stop }
  run
end

puts "Mongrel running on 0.0.0.0:3002 with docroot ./html/" 
config.join
&lt;/pre&gt;

	&lt;p&gt;I&amp;#8217;m using it for serving static pages, generated with &lt;a href="http://rote.rubyforge.org/"&gt;Rote&lt;/a&gt; &amp;#8211; pretty fast ;)&lt;/p&gt;

</description>
      <pubDate>Mon, 13 Nov 2006 21:49:00 PST</pubDate>
      <guid>&lt;a href="/articles/2006/11/13/webserver-with-mongrel"&gt;Webserver with Mongrel&lt;/a&gt;</guid>
      <link>&lt;a href="/articles/2006/11/13/webserver-with-mongrel"&gt;Webserver with Mongrel&lt;/a&gt;</link>
    </item>
  </channel>
</rss>
