What Server Is That?

You might wonder what server is running your Rails application—after all, nothing so far has required any configuration, despite the fairly complicated usual installs needed to get web programming environments to run. You can continue without knowing (until it’s time for real deployment), but if you’re curious, here are the details.

Note

Heroku doesn’t say which server it’s using, but fortunately that doesn’t matter very much for getting things done.

You may be familiar with Apache or Microsoft’s Internet Information Server (IIS), but neither of those web servers is probably running these Rails programs. (They can run Rails, but unless you took a very different path for installation, they’re not running yet.) Instead, your programs are probably running in Mongrel. The Rails 2.0 command line uses Mongrel. (In earlier versions of Rails, running the application from the command line in the usual way started up an instance of WEBrick.) Instant Rails uses Apache with Mongrel actually interacting with Rails behind it. WEBrick and Mongrel come with slightly different priorities:

WEBrick (http://www.webrick.org/)

WEBrick is written in Ruby and bundled with recent releases of Ruby. It’s very convenient for Ruby development, with or without Rails. It’s an excellent testing server, but not designed for large scale deployment.

Mongrel (http://mongrel.rubyforge.org/)

Mongrel is a highly optimized server written in Ruby that “does the bare minimum necessary to serve a Ruby application.” It’s designed to be as absolutely fast as possible and is often used in conjunction with Apache on production web servers.

For development work, you’ll likely run at least one of these servers on your local machine, probably on an odd port, like 3000, instead of the traditional default web server port of 80. For deployment, as described in Chapter 18, you’ll probably use Apache (with Mongrel or Passenger behind it) or lighttpd. (You can deploy Rails on Windows with Mongrel or IIS, but it’s rarely the most efficient approach.)

Note

If you’ve never used Ruby before, now would be a good time to explore Appendix A, which teaches some key components of the language inside of a very simple Rails application.

Get Learning Rails now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.