WEBrickで簡易Webサーバ
ちょっと実験とか試したいときに便利
使用したパラメータ
- Port: 使用するポート番号
- DocumentRoot: ドキュメントのルートパス
その他のパラメータはこちらを参照
Module: WEBrick (Ruby 2.0.0)
require "webrick" params = { Port: 8888, DocumentRoot: File.expand_path(File.dirname(__FILE__)) } server = WEBrick::HTTPServer.new(params) trap("INT") { server.shutdown } server.start