This article is showing how to install Ruby on Rails on a Debian-based host and configure** WeBrick** server (bundled with Ruby) to allow access from other hosts.

The first thing you have to do is installing Ruby on Rails. It is pretty easy with “apt-get” command in Debian.

(sudo) apt-get install ruby libzlib-ruby rdoc irb rubygems rails eruby

If there are some errors showed in this stage, you may have to install the “build-essential” package with this command

(sudo) apt-get install build-essential

NB: you have to add sudo before the commands if you are not running as “root” user.

If everything goes fine, you could create the very first application followed this tutorial from Ruby on Rails wiki.

Unfortunately, I found a problem as I work with Ruby on Rails installed on a non-GUI server and the WeBrick server always starts with access only for localhost. I means I can only access the server with the URL: http://localhost:3000. In this case, I need to access to server from another host in LAN usign LAN IP address like this:

To change this, you could simply call this command:

cd /path/to/app/directory
ruby ./script/server -b -p 3000

Instead of this by default:

ruby ./script/server

This way, WeBrick server will start with the defined IP address and port

=> Booting WEBrick...
=> Rails 2.1.0 application started on
=> Ctrl-C to shutdown server; call with --help for options
[2010-11-06 15:35:55] INFO  WEBrick 1.3.1
[2010-11-06 15:35:55] INFO  ruby 1.8.7 (2008-08-11) i486-linux
[2010-11-06 15:35:55] INFO  WEBrick::HTTPServer#start: pid=2635 port=3000