Introduction to configuring Passenger + Apache

Passenger in its Apache integration mode is to be configured via the Apache configuration file. There is no configuration file that is specific to Passenger only.

If you have used Passenger Standalone, then you may be familiar with Passengerfile.json. Passenger for Apache does not consult Passengerfile.json, only the Apache configuration file.

Configuring Passenger for Apache works as follows:

  1. During the Passenger installation process, Apache is setup to load the Passenger Apache module.
  2. The Passenger Apache module registers Passenger-specific configuration options inside Apache.
  3. You, the administrator, configure Passenger by adding Passenger-specific configuration options to the Apache configuration file.
  4. Restart or reload Apache to apply any configuration changes.

Here is an example of an Apache configuration file which also configures Passenger:

PassengerRuby /usr/bin/ruby2.0

<VirtualHost *:80>
    DocumentRoot /var/www/myapp/code/public
    PassengerStickySessions on

    <Directory /var/www/myapp/code/public>
        Allow from all
        Options -MultiViews
        Require all granted

Essential configuration

For Passenger to work, only a few configuration options need to be setup in Apache. If you have already gone through the installation process, then these configuration options are already set.

  1. The LoadModule passenger_module ... option must exist in the Apache configuration. This option tells Apache to load the Passenger module from the given filename. If this option does not exist, then Passenger is not loaded into Apache at all, and Apache will complain about syntax errors whenever it encounters Passenger configuration options.
  2. The PassengerRoot option must exist in the Apache configuration. This option tells Passenger where to find its own resource files. Without this option, Passenger is still loaded, but will not be able to operate.
  3. The PassengerDefaultRuby option does not have to exist, but it is strongly recommended that you set it.

Start configuring Passenger

Passenger provides a wide range of features and customization options. Some of them are for improving or tweaking the application's performance characteristics, some of them influence application or connection handling behavior, etc. Please visit the configuration index page to learn what you can configure.