passengerprestart snippets

PassengerPreStart, PassengerFriendlyErrorPages, and PassengerMinInstances - Three essential configuration parameters in Phusion Passenger 3.0

Tagged passengerprestart, passengermininstances, passengerfriendlyerrorpages, mod_rails  Languages ruby

Apache

This setting will make your users and the Google bot happy by starting your application as soon as Apache/nginx starts:

PassengerPreStart http://aktagon.com/

When combined with the PassengerMinInstances parameter, Passenger will keep at least one instance alive at all times:

PassengerMinInstances 1

This setting makes hackers unhappy by disabling Passenger's default error page, which contains sensitive information:

PassengerFriendlyErrorPages On

Read passenger's Apache documentation for details.

nginx

Passenger's nginx module has a slightly different naming convention:

passenger_min_instances 1
passenger_friendly_error_pages on

Plus you need to put the passenger_pre_start inside an http directive. I just put them all in passenger.conf:

passenger_pre_start http://aktagon.com

If you don't put it where it belongs, you'll get this error:

Starting nginx: [emerg]: "passenger_pre_start" directive is not allowed here in /opt/nginx/conf/sites/xxx.com:7

Read Passenger's nginx documentation for details.