Skip to content

Instantly share code, notes, and snippets.

@herry13
Created September 19, 2013 11:51
Show Gist options
  • Select an option

  • Save herry13/6622295 to your computer and use it in GitHub Desktop.

Select an option

Save herry13/6622295 to your computer and use it in GitHub Desktop.
Simple Ruby HTTP Server
#!/usr/bin/env ruby
require 'webrick'
server = WEBrick::HTTPServer.new :Port => 80
dir = (ARGV.length > 0 ? ARGV[0] : './')
server.mount "/", WEBrick::HTTPServlet::FileHandler, dir
trap('INT') { server.stop }
server.start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment