16.1. Introduction

Until now we were working with the development system. Let's have another close look at the output of that development system:
$ rails server
=> Booting WEBrick
=> Rails 4.0.0 application starting in development on
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2013-07-18 10:20:30] INFO  WEBrick 1.3.1
[2013-07-18 10:20:30] INFO  ruby 2.0.0 (2013-06-27) [x86_64-darwin12.4.0]
[2013-07-18 10:20:30] INFO  WEBrick::HTTPServer#start: pid=43853 port=3000
The second line tells us that we are in "development" mode and that the application can be accessed at the URL The web server used here is WEBrick (see http://en.wikipedia.org/wiki/Webrick). WEBrick is a very simple HTTP web server and component of the Ruby standard library. But WEBrick is only suitable for development.
For a production system, you would normally use a standard web server such as Apache, lighttpd or Nginx, to serve as reverse proxy and load balancer for the Rails system. The Rails system is then not run by the slow WEBrick, but by more powerful solutions such as Unicorn (http://unicorn.bogomips.org/), Mongrel (http://en.wikipedia.org/wiki/Mongrel_(web_server)), Thin (http://code.macournoyer.com/thin/) or Puma (http://puma.io/).
This chapter walks you through the setup process of a production server which runs Nginx as a reverse proxy webserver and unicorn as the Ruby on Rails webserver behind the Nginx. We start with a fresh Debian system and install all the software we need. The Rails project will be run with Ruby 2.0.0 which gets installed with RVM and runs for the user deployer. Feel free to customize the directorystructure once everything is up and running.
The example Rails application we use is called blog.

Buy the new Rails 5.1 version of this book.

If you have never set up a Nginx or Apache webserver by yourself before you will get lost somewhere in this chapter. You probably get it up and running but without understanding how things work.

Thank you for your support and the visibility by linking to this website on Twitter and Facebook. That helps a lot!