Simple HTTP server with Ruby

Ruby standard library provides a simple HTTP server called WEBrick. It can be used to serve static files from a directory with one-line script:

ruby -run -e httpd

Where:

  • -run stands for require 'un' (un is a small utility library for common UNIX commands)
  • -e httpd means execute httpd method from the un library

The httpd will start WEBrick server to simply serve files from a current directory.