What Web Server Does Ruby on Rails Use?


Heather Bennett

Ruby on Rails is a popular web framework that allows developers to build dynamic and powerful web applications. One crucial aspect of running a Ruby on Rails application is the choice of a web server.

A web server handles the HTTP requests coming from clients and serves the appropriate responses. In this article, we will explore the different web servers that can be used with Ruby on Rails.

What is a Web Server?
A web server is a software application that listens for incoming HTTP requests and responds with the corresponding HTTP responses. It acts as an intermediary between the client’s browser and the Ruby on Rails application, handling tasks such as routing, processing requests, executing code, and sending back the generated HTML or JSON responses.

The Built-in Web Server: WEBrick
By default, when you create a new Ruby on Rails project using the `rails new` command, it comes bundled with a built-in web server called WEBrick. WEBrick is written entirely in Ruby and does not require any additional installation. It is simple to use and suitable for development purposes or small-scale applications.

While WEBrick provides basic functionality for serving your application locally during development, it may not be suitable for production environments due to its limited performance capabilities.

Apache: The Battle-Tested Web Server
Apache HTTP Server, often referred to simply as Apache, is one of the most widely used web servers in production environments. It has been around since 1995 and has proven its stability and reliability over time.

To use Apache with your Ruby on Rails application, you need to set up an Apache module called Passenger (also known as mod_passenger). Passenger integrates seamlessly with Apache and provides support for running Ruby applications.

Setting Up Apache with Passenger

Here are the general steps to set up Apache with Passenger:

  • Install Apache if you haven’t already.
  • Install the Passenger gem by running the command gem install passenger.
  • Run the Passenger installation script using the command passenger-install-apache2-module.
  • Edit your Apache configuration file to enable Passenger. Add the following lines:

LoadModule passenger_module /path-to-passenger-module/passenger_module.so
   <IfModule mod_passenger.c>
     PassengerRoot /path-to-passenger-gem-directory
     PassengerDefaultRuby /path-to-ruby-executable

Nginx: The Performance-Oriented Web Server

Nginx (pronounced “engine-x”) is a high-performance web server known for its ability to handle a large number of concurrent connections efficiently. It is often used as a reverse proxy server, load balancer, or for serving static assets.

To use Nginx with Ruby on Rails, you also need to install the Passenger gem and configure Nginx to work with it. The setup process is similar to Apache’s setup, with minor differences in the configuration syntax.


In conclusion, Ruby on Rails can be deployed using various web servers depending on your requirements. The built-in WEBrick server is suitable for development purposes but may not be performant enough for production environments. Apache and Nginx are battle-tested web servers that offer better performance and scalability when combined with the Passenger module.

Consider your application’s specific needs and choose the web server that best fits your requirements. Whether you go with Apache or Nginx, both options provide solid support for running Ruby on Rails applications in production environments.

Discord Server - Web Server - Private Server - DNS Server - Object-Oriented Programming - Scripting - Data Types - Data Structures

Privacy Policy