webrick

httpdを動かす

require 'webrick'

#document_root = '/Users/sho/'
document_root = './'

server = WEBrick::HTTPServer.new({
  :DocumentRoot => document_root,
  :BindAddress => '0.0.0.0',
  :Port => 10080
})

['INT', 'TERM'].each {|signal|
  Signal.trap(signal){ server.shutdown }
}

server.start

同じディレクトリの中のcgiも実行できる
http://d.hatena.ne.jp/shokai/20080625/1214375552 をldweather.cgiにしてこれと同じディレクトリに入れて
http://localhost:10080/ldweather.cgi とかで動かせる