Passenger

Crash Course

metadata = {
  created_by: 'Steven Haddox',
  employed_by: 'Synergist Computing, LLC'
}
websites = [ 
  'http://synergistcomputing.com',
  'http://stevenhaddox.com',
  'https://www.phusionpassenger.com',
  'http://www.rubyraptor.org'
]

What is Passenger?

  • A Ruby on Rails web server?
  • A Sinatra web server?
  • A Rack web server?
  • An Express web server?
  • A node.js web server?
  • An IO.js web server?
  • A Meteor web server?
  • A Python web server?
  • A standalone server?
  • An Apache 2 module?
  • An Nginx module?

YES

Why Use Passenger?

  • Integration
  • Simplicity
  • Always Ready Applications
  • Auto-scaling Processes
  • Apps Run as Sandboxed User
  • Statistics
  • Performance

Why Not?

Performance

Overview

  • Installation
  • Web Servers
  • RHEL & CentOS
  • Languages

RHEL & CentOS

# Install EPEL and other other prerequisites
$ sudo yum install -y epel-release pygpgme curl

# Add our el6 YUM repository
$ sudo curl --fail -sSLo /etc/yum.repos.d/passenger.repo \
https://oss-binaries.phusionpassenger.com/yum/definitions/el-passenger.repo

# Install Passenger Nginx
$ sudo yum install -y nginx passenger
# /etc/nginx/conf.d/passenger.conf
passenger_root /some-filename/locations.ini;
passenger_ruby /usr/bin/ruby;
passenger_instance_registry_dir /var/run/passenger-instreg;
$ sudo service nginx restart
$ sudo passenger-config validate-install
 * Checking whether this Phusion Passenger install is in PATH... ✓
 * Checking whether there are no other Phusion Passenger installations... ✓

Web Servers

  • Heroku
  • Standalone
  • Apache
  • Nginx
  • Ruby
  • Python
  • Node.js
  • IO.js
  • Meteor

Nginx Ruby Conf

# /etc/nginx/conf.d/app.conf

server {
    listen 80;
    server_name yourserver.com;

    # Tell Nginx and Passenger where your app's 'public' directory is
    root /var/www/myapp/code/public;

    # Turn on Passenger
    passenger_enabled on;
    passenger_ruby /path-to-ruby;
}
$ sudo service nginx restart

Nginx Python Conf

# /etc/nginx/conf.d/app.conf

server {
    listen 80;
    server_name yourserver.com;

    # Tell Nginx and Passenger where your app's 'public' directory is
    root /var/www/myapp/code/public;

    # Turn on Passenger
    passenger_enabled on;
}
$ sudo service nginx restart

Nginx Node.js Conf

# /etc/nginx/conf.d/app.conf

server {
    listen 80;
    server_name yourserver.com;

    # Tell Nginx and Passenger where your app's 'public' directory is
    root /var/www/myapp/code/public;

    # Turn on Passenger
    passenger_enabled on;
    # Tell Passenger that your app is a Node.js app
    passenger_app_type node;
    passenger_startup_file app.js;
}
$ sudo service nginx restart

Questions?

Passenger Crash Course

By Steven Haddox

Passenger Crash Course

Quick overview of integrating Phusion Passenger with Nginx

  • 352