#webserver.rb
#! /usr/bin/env ruby
require 'webrick'
include WEBrick
s = HTTPServer.new(:Port => 9090,
:DocumentRoot => Dir::pwd + "/")
trap("INT"){ s.shutdown}
s.start
在浏览器中输入 http://localhost:9090/,就能访问当前目录下文件.
[img]http://dl.iteye.com/upload/attachment/0072/1502/0d76bab9-62ab-30ad-9083-1343381bf6f9.gif[/img]
#! /usr/bin/env ruby
require 'webrick'
include WEBrick
s = HTTPServer.new(:Port => 9090,
:DocumentRoot => Dir::pwd + "/")
trap("INT"){ s.shutdown}
s.start
在浏览器中输入 http://localhost:9090/,就能访问当前目录下文件.
[img]http://dl.iteye.com/upload/attachment/0072/1502/0d76bab9-62ab-30ad-9083-1343381bf6f9.gif[/img]