Skip to content

Instantly share code, notes, and snippets.

@44uk
Created August 20, 2012 15:34
Show Gist options
  • Save 44uk/3405192 to your computer and use it in GitHub Desktop.
Save 44uk/3405192 to your computer and use it in GitHub Desktop.
Ruby Simple Local Server
#!/usr/bin/env ruby
require 'webrick'
srv = WEBrick::HTTPServer.new(
:BindAddress => '127.0.0.1', # '0.0.0.0' allow remote access
:Port => (port = ARGV[0].to_i) === 0 ? 3000 : port,
:DocumentRoot => './',
:DoNotReverseLookup => true
)
trap(:INT){srv.shutdown}
srv.start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment