Ruby on Rails/Getting Started/Running the Server

Previous: Getting Started/Creating the application Index Next: Built-In Rails Tools/Generators

Running the Rails server


The bundled WEBrick server


As you already know, Rails comes with an integrated server: WEBrick. WEBrick is a Ruby-written server to get you started right from the beginning. There are alternatives such as Mongrel or Phusion Passenger (formerly known as mod_ruby, a module for Apache). For local(!!) development WEBrick is a good choice.

To start up the server, simply open up a console, navigate to your Rails application and type

  • On Windows, OS X and Linux:
    ruby script/server 

After some seconds, WEBrick has been initialized and you are ready to go. The console with the web server needs to stay open, otherwise the server will shut down. To see if everything is working as expected, open up your web browser and navigate to

Ruby on Rails Welcome aboard

You should see the default Rails start page saying that everything is working correctly. You can view the details page (name) for the current version of your environment and some other variables. The server console not only runs the server, but shows how the requests by the browser are processed, including the amount of queries, the used SQL syntax or the data from your submitted forms.

There are several options, including but not limited to:

  • -p port: Specify the port to run on
  • -b ip: Bind to a specific IP address
  • -e name: Use a specific Rails environment (like production)
  • -d: Run in daemon mode
  • -h: Display a help message with all command-line options



To start a single mongrel instance:

  • On all platforms:
mongrel_rails start

This should be executed in the root directory of the Rails app you wish to run on Mongrel. There are numerous options you can specify, including:

  • -p port: run on a specific port
  • -e environment: execute with a specific Rails environment, like production
  • -d: run in daemon mode