gem version

Migrating from Passenger 4 to 5

Relevant selection for this article:

Nginx

Passenger 5 comes with many major improvements and is mostly compatible with Passenger 4. This section highlights important and incompatible changes.

APT repository changed to 5.0

Our main APT repository switched to Passenger 5. If there is a pressing need to remain on Passenger 4, use the legacy Passenger 4 APT repository.

Full web server restart required

To avoid a broken st.ate where half of Passenger 4 is running and half of Passenger 5, you must fully restart the web server after upgrading to Passenger 5.

If you upgraded using APT, you must invoke the web server restart manually. APT does not do this for you!

Minimum Rails version: 2.3

We've dropped support for Rails version older than 2.3.

To make Rails 2.3 apps work with Passenger 5, the app must have a config.ru file. For example:

# Require your environment file to bootstrap Rails
require ::File.dirname(__FILE__) + '/config/environment'

# Serve static assets from RAILS_ROOT/public directory
# use Rails::Rack::Static
# Dispatch the request
run ActionController::Dispatcher.new

Restart mechanism changed

Using restart.txt to restart the app is still supported, but with the new default settings, Passenger won't notice any changes until after max 10 seconds. We recommend using the passenger-config restart-app command.

If you want to revert to the old restart.txt behavior (where any change is noticed immediately on the next request), set passenger_stat_throttle_rate (using the Nginx configuration template) to 0.

Feature and configuration changes

  • If you use out-of-band garbage collection, beware that the X-Passenger-Request-OOB-Work header has now been renamed to !~Request-OOB-Work.
  • When using Rack's full socket hijacking, you must now output an HTTP status line.
  • The minimum required Nginx version is now 1.6.0.
  • The passenger_set_cgi_param option has been removed and replaced by passenger_set_header and passenger_env_var.
  • passenger_show_version_in_header is now only valid in the http context.
  • The passenger_enabled on directive is now inherited across location blocks. This wasn't the case previously, so you had to re-specify it inside location blocks. Now the opposite holds: if you specified passenger_enabled on in the server block, then you have to explicitly specify passenger_enabled off in all location blocks where you disabled Passenger.
  • The passenger_temp_dir option has been replaced by two config options: passenger_instance_registry_dir and passenger_data_buffer_dir.
light mode dark mode
Passenger 6 Passenger 6