+ All Categories
Home > Documents > Phusion Passenger Users Guide

Phusion Passenger Users Guide

Date post: 04-Jun-2018
Category:
Upload: gteodorescu
View: 228 times
Download: 0 times
Share this document with a friend

of 70

Transcript
  • 8/13/2019 Phusion Passenger Users Guide

    1/70

    Phusion Passenger users guide, Nginx

    version

    Phusion Passenger is an application server which can directly integrate into Nginx. It isdesigned to be easy to use, fast, stable and reliable and is used by hundreds of thousands ofwebsitesall over the world.

    Phusion Passenger is a so-called polyglot application server because it supports applicationswritten in multiple programming languages. At this time, Ruby and Python are supported.

    his users guide will teach you!

    "ow to install Nginx with Phusion Passenger support.

    "ow to configure Phusion Passenger.

    "ow to deploy Ruby and Python applications.

    "ow to solve common problems.

    his guide assumes that the reader is somewhat familiar with Nginx and with using thecommand line.

    #able of $ontents#. %upport information#.#. %upported operating systems#.&. 'here to get support&. Installation

    &.#. %ynopsis&.&. (eneric installation, upgrade and downgrade method! via Ruby(ems&.). (eneric installation, upgrade and downgrade method! via tarball&.*. $ryptographic verification of installation files&.+. Installing or upgrading on ebian or buntu&.. Installing or upgrading on Red "at, /edora, $ent0% or %cientific1inux&.2. pgrading from open source to 3nterprise&.4. Non-interactive, automatic, headless installs or upgrades&.5. $ustomi6ing the compilation process&.5.#. %etting the compiler&.5.&. Adding additional compiler or lin7er flags

    &.5.). /orcing location of certain command line tools&.#8. Installing as a normal Nginx module without using the installer

    #

    http://trends.builtwith.com/Web-Server/Phusion-Passengerhttp://trends.builtwith.com/Web-Server/Phusion-Passengerhttp://trends.builtwith.com/Web-Server/Phusion-Passengerhttp://void%280%29/http://www.modrails.com/documentation/Users%20guide%20Nginx.html#_support_informationhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_supported_operating_systemshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_where_to_get_supporthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_installationhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_synopsishttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#rubygems_generic_installhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#tarball_generic_installhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_cryptographic_verification_of_installation_fileshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_installing_or_upgrading_on_debian_6_or_ubuntuhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_installing_or_upgrading_on_red_hat_fedora_centos_or_scientificlinuxhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_upgrading_from_open_source_to_enterprisehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_non_interactive_automatic_headless_installs_or_upgradeshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_customizing_the_compilation_processhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_setting_the_compilerhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_adding_additional_compiler_or_linker_flagshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_forcing_location_of_certain_command_line_toolshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_installing_as_a_normal_nginx_module_without_using_the_installerhttp://www.phusion.nl/http://trends.builtwith.com/Web-Server/Phusion-Passengerhttp://trends.builtwith.com/Web-Server/Phusion-Passengerhttp://void%280%29/http://www.modrails.com/documentation/Users%20guide%20Nginx.html#_support_informationhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_supported_operating_systemshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_where_to_get_supporthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_installationhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_synopsishttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#rubygems_generic_installhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#tarball_generic_installhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_cryptographic_verification_of_installation_fileshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_installing_or_upgrading_on_debian_6_or_ubuntuhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_installing_or_upgrading_on_red_hat_fedora_centos_or_scientificlinuxhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_upgrading_from_open_source_to_enterprisehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_non_interactive_automatic_headless_installs_or_upgradeshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_customizing_the_compilation_processhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_setting_the_compilerhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_adding_additional_compiler_or_linker_flagshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_forcing_location_of_certain_command_line_toolshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_installing_as_a_normal_nginx_module_without_using_the_installer
  • 8/13/2019 Phusion Passenger Users Guide

    2/70

    &.##. $reating an Nginx init script&.#&. isabling without uninstalling&.#). ninstalling&.#*. 9oving to a different directory). eploying a Ruby on Rails #.x or &.x :but N0 Rails ;< )= application

    ).#. eploying to a virtual host>s root).&. eploying to a sub RI).). Redeploying :restarting the Ruby on Rails application=).*. 9igrations).+. $apistrano integration*. eploying a Rac7-based Ruby application :including Rails ;< )=*.#. utorial?example! writing and deploying a "ello 'orld Rac7 application*.&. eploying to a virtual host>s root*.). eploying to a sub RI*.*. Redeploying :restarting the Rac7 application=*.+. Rac7up specifications for various web framewor7s

    *.+.#. $amping*.+.&. "alcyon*.+.). 9ac7*.+.*. 9erb*.+.+. Rama6e*.+.. %inatra+. eploying a '%(I :Python= application+.#. utorial?example! writing and deploying a "ello 'orld '%(I application+.&. eploying to a virtual host>s root+.). Redeploying :restarting the '%(I application=. $onfiguring Phusion Passenger.#. passenger@root directory;.&. passenger@ruby filename;.). passenger@python filename;.*. passenger@app@root path?to?root;.+. passenger@spawn@method string;.. passenger@rolling@restarts onBoff;.2. passenger@resist@deployment@errors onBoff;.4. passenger@temp@dir directory;.5. Important deployment options.5.#. passenger@enabled onBoff;

    .5.&. passenger@base@uri uri;.#8. $onnection handling options.#8.#. passenger@ignore@client@abort onBoff;.#8.&. passenger@set@cgi@param $(I environment name; value;.#8.). passenger@pass@header header name;.#8.*. passenger@buffer@response onBoff;.#8.+. passenger@buffer@si6e.#8.. passenger@buffers.#8.2. passenger@busy@buffer@si6e.##. %ecurity options.##.#. passenger@user@switching onBoff;

    .##.&. passenger@user username;.##.). passenger@group group name;

    &

    http://www.modrails.com/documentation/Users%20guide%20Nginx.html#nginx_init_scripthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_disabling_without_uninstallinghttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#uninstallinghttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#moving_phusion_passengerhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#deploying_a_ror_apphttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_deploying_to_a_virtual_host_8217_s_roothttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#deploying_rails_to_sub_urihttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_redeploying_restarting_the_ruby_on_rails_applicationhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_migrationshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_capistrano_integrationhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#deploying_a_rack_apphttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_tutorial_example_writing_and_deploying_a_hello_world_rack_applicationhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_deploying_to_a_virtual_host_8217_s_root_2http://www.modrails.com/documentation/Users%20guide%20Nginx.html#deploying_rack_to_sub_urihttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_redeploying_restarting_the_rack_applicationhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_rackup_specifications_for_various_web_frameworkshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_campinghttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_halcyonhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_mackhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_merbhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_ramazehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_sinatrahttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_deploying_a_wsgi_python_applicationhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_tutorial_example_writing_and_deploying_a_hello_world_wsgi_applicationhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_deploying_to_a_virtual_host_8217_s_root_3http://www.modrails.com/documentation/Users%20guide%20Nginx.html#_redeploying_restarting_the_wsgi_applicationhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_configuring_phusion_passengerhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_root_lt_directory_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_ruby_lt_filename_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_python_lt_filename_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerAppRoothttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerSpawnMethodhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerRollingRestartshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_resist_deployment_errors_lt_on_off_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerTempDirhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_important_deployment_optionshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_enabled_lt_on_off_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerBaseURIhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_connection_handling_optionshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_ignore_client_abort_lt_on_off_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_set_cgi_param_lt_cgi_environment_name_gt_lt_value_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_pass_header_lt_header_name_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_buffer_response_lt_on_off_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_buffer_sizehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_buffershttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_busy_buffer_sizehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_security_optionshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerUserSwitchinghttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_user_lt_username_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_group_lt_group_name_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#nginx_init_scripthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_disabling_without_uninstallinghttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#uninstallinghttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#moving_phusion_passengerhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#deploying_a_ror_apphttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_deploying_to_a_virtual_host_8217_s_roothttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#deploying_rails_to_sub_urihttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_redeploying_restarting_the_ruby_on_rails_applicationhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_migrationshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_capistrano_integrationhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#deploying_a_rack_apphttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_tutorial_example_writing_and_deploying_a_hello_world_rack_applicationhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_deploying_to_a_virtual_host_8217_s_root_2http://www.modrails.com/documentation/Users%20guide%20Nginx.html#deploying_rack_to_sub_urihttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_redeploying_restarting_the_rack_applicationhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_rackup_specifications_for_various_web_frameworkshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_campinghttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_halcyonhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_mackhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_merbhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_ramazehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_sinatrahttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_deploying_a_wsgi_python_applicationhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_tutorial_example_writing_and_deploying_a_hello_world_wsgi_applicationhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_deploying_to_a_virtual_host_8217_s_root_3http://www.modrails.com/documentation/Users%20guide%20Nginx.html#_redeploying_restarting_the_wsgi_applicationhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_configuring_phusion_passengerhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_root_lt_directory_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_ruby_lt_filename_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_python_lt_filename_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerAppRoothttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerSpawnMethodhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerRollingRestartshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_resist_deployment_errors_lt_on_off_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerTempDirhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_important_deployment_optionshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_enabled_lt_on_off_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerBaseURIhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_connection_handling_optionshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_ignore_client_abort_lt_on_off_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_set_cgi_param_lt_cgi_environment_name_gt_lt_value_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_pass_header_lt_header_name_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_buffer_response_lt_on_off_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_buffer_sizehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_buffershttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_busy_buffer_sizehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_security_optionshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerUserSwitchinghttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_user_lt_username_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_group_lt_group_name_gt
  • 8/13/2019 Phusion Passenger Users Guide

    3/70

    .##.*. passenger@default@user username;.##.+. Passenger@default@group group name;.##.. passenger@show@version@in@header onBoff;.##.2. passenger@friendly@error@pages onBoff;.#&. Resource control and optimi6ation options

    .#&.#. passenger@max@pool@si6e integer;.#&.&. passenger@min@instances integer;.#&.). passenger@max@instances integer;.#&.*. passenger@max@instances@per@app integer;.#&.+. passenger@pool@idle@time integer;.#&.. passenger@max@preloader@idle@time integer;.#&.2. passenger@concurrency@model processBthread;.#&.4. passenger@thread@count number;.#&.5. passenger@max@reCuests integer;.#&.#8. passenger@max@reCuest@time seconds;.#&.##. passenger@memory@limit integer;

    .#&.#&. passenger@pre@start url;.#). 1ogging and debugging options.#).#. passenger@log@level integer;.#).&. passenger@debug@log@file filename;.#).). passenger@debugger onBoff;.#*. Ruby on Rails-specific options.#*.#. rails@env string;.#+. Rac7 and Rails ;< ) specific options.#+.#. rac7@env string;.#. eprecated options.#.#. rails@spawn@method2. Analysis and system maintenance2.#. Inspecting memory usage2.&. Inspecting Phusion Passenger>s internal status2.). ebugging fro6en applications2.*. Accessing individual application processes2.+. Attaching an IRD console to an application process4. ips4.#. ser switching :security=4.&. Reducing memory consumption of Ruby on Rails applications by ))E4.). $apistrano recipe

    4.*. Dundler support4.+. Installing multiple Ruby on Rails versions4.. 9a7ing the application restart after each reCuest4.2. "ow to fix bro7en images?$%%?Fava%cript RIs in sub-RI deployments4.4. 0ut-of-Dand (arbage 'or7 and 0ut-of-Dand (arbage $ollection5. nder the hood5.#. Page caching support5.&. "ow Phusion Passenger detects whether a virtual host is a web application#8. Appendix A! About this document##. Appendix D! erminology##.#. Application root

    ##.&. Idle process##.). Inactive process

    )

    http://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerDefaultUserhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerDefaultGrouphttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_show_version_in_header_lt_on_off_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_friendly_error_pages_lt_on_off_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_resource_control_and_optimization_optionshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerMaxPoolSizehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerMinInstanceshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_max_instances_lt_integer_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_max_instances_per_app_lt_integer_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerPoolIdleTimehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_max_preloader_idle_time_lt_integer_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerConcurrencyModelhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerThreadCounthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerMaxRequestshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerMaxRequestTimehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerMemoryLimithttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerPreStarthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_logging_and_debugging_optionshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_log_level_lt_integer_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_debug_log_file_lt_filename_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_debugger_lt_on_off_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_ruby_on_rails_specific_optionshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#RailsEnvhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_rack_and_rails_gt_3_specific_optionshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#RackEnvhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_deprecated_optionshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_rails_spawn_methodhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_analysis_and_system_maintenancehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_inspecting_memory_usagehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_inspecting_phusion_passenger_8217_s_internal_statushttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#debugging_frozenhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_accessing_individual_application_processeshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_attaching_an_irb_console_to_an_application_processhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_tipshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#user_switchinghttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#reducing_memory_usagehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#capistranohttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#bundler_supporthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_installing_multiple_ruby_on_rails_versionshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_making_the_application_restart_after_each_requesthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#sub_uri_deployment_uri_fixhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_out_of_band_garbage_work_and_out_of_band_garbage_collectionhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_under_the_hoodhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_page_caching_supporthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#application_detectionhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_appendix_a_about_this_documenthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_appendix_b_terminologyhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#application_roothttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#idle_processhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#inactive_processhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerDefaultUserhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerDefaultGrouphttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_show_version_in_header_lt_on_off_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_friendly_error_pages_lt_on_off_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_resource_control_and_optimization_optionshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerMaxPoolSizehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerMinInstanceshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_max_instances_lt_integer_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_max_instances_per_app_lt_integer_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerPoolIdleTimehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_max_preloader_idle_time_lt_integer_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerConcurrencyModelhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerThreadCounthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerMaxRequestshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerMaxRequestTimehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerMemoryLimithttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerPreStarthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_logging_and_debugging_optionshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_log_level_lt_integer_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_debug_log_file_lt_filename_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_debugger_lt_on_off_gthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_ruby_on_rails_specific_optionshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#RailsEnvhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_rack_and_rails_gt_3_specific_optionshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#RackEnvhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_deprecated_optionshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_rails_spawn_methodhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_analysis_and_system_maintenancehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_inspecting_memory_usagehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_inspecting_phusion_passenger_8217_s_internal_statushttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#debugging_frozenhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_accessing_individual_application_processeshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_attaching_an_irb_console_to_an_application_processhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_tipshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#user_switchinghttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#reducing_memory_usagehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#capistranohttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#bundler_supporthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_installing_multiple_ruby_on_rails_versionshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_making_the_application_restart_after_each_requesthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#sub_uri_deployment_uri_fixhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_out_of_band_garbage_work_and_out_of_band_garbage_collectionhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_under_the_hoodhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_page_caching_supporthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#application_detectionhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_appendix_a_about_this_documenthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_appendix_b_terminologyhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#application_roothttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#idle_processhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#inactive_process
  • 8/13/2019 Phusion Passenger Users Guide

    4/70

    #&. Appendix $! %pawning methods explained#&.#. he most straightforward and traditional way! direct spawning#&.&. he smart spawning method#&.&.#. "ow it wor7s#&.&.&. %ummary of benefits

    #&.). %mart spawning gotcha G#! unintentional file descriptor sharing#&.).#. 3xample #! 9emcached connection sharing :harmful=#&.).&. 3xample &! 1og file sharing :not harmful=#&.*. %mart spawning gotcha G&! the need to revive threads#&.+. %mart spawning gotcha G)! code load order

    1. Support information

    1.1. Supported operating systems

    Phusion Passenger wor7s on any P0%IH-compliant operating system. In other words!practically any operating system on earth, except 9icrosoft 'indows.

    Phusion Passenger is confirmed on a large number of operating systems and 1inuxdistributions, including, but not limited to, buntu, ebian, $ent0%?/edora?R"31, (entoo,9ac 0% H, /reeD% and %olaris. 0penD% is supported since version +.&. Doth )&-bit and*-bit platforms are supported.

    Please report a bugoroin our discussion forumif it doesn>t wor7 on your P0%IH-compliantoperating system.

    1.2. Where to get support

    Issue trac7er - report bugs here.

    iscussion forum - post a message here if you>re experiencing problems. %upport on

    this forum is provided by the community on a best-effort basis, so a :timely= response

    is not guaranteed.

    3mail supportJphusion.nlif you are a Phusion Passenger 3nterprisecustomer. Please

    mention your order reference. If you are not an 3nterprise customer, we 7indlyredirect you to the community discussion forum instead.

    $ommercial support contracts are also available.

    Report security vulnerabilities tosupportJphusion.nl. 'e will do our best to respond

    to you as Cuic7ly as we can, so please do not disclose the vulnerability until then.

    Please consult the Phusion Passenger websitefor a full list of support resources.

    *

    http://www.modrails.com/documentation/Users%20guide%20Nginx.html#spawning_methods_explainedhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_the_most_straightforward_and_traditional_way_direct_spawninghttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_the_smart_spawning_methodhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_how_it_workshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_summary_of_benefitshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_smart_spawning_gotcha_1_unintentional_file_descriptor_sharinghttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_example_1_memcached_connection_sharing_harmfulhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_example_2_log_file_sharing_not_harmfulhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_smart_spawning_gotcha_2_the_need_to_revive_threadshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_smart_spawning_gotcha_3_code_load_orderhttp://code.google.com/p/phusion-passenger/issues/listhttp://groups.google.com/group/phusion-passengerhttp://code.google.com/p/phusion-passenger/issues/listhttp://groups.google.com/group/phusion-passengermailto:[email protected]://www.phusionpassenger.com/enterprisehttps://www.phusionpassenger.com/commercial_supportmailto:[email protected]:[email protected]://www.phusionpassenger.com/supporthttps://www.phusionpassenger.com/supporthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#spawning_methods_explainedhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_the_most_straightforward_and_traditional_way_direct_spawninghttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_the_smart_spawning_methodhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_how_it_workshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_summary_of_benefitshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_smart_spawning_gotcha_1_unintentional_file_descriptor_sharinghttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_example_1_memcached_connection_sharing_harmfulhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_example_2_log_file_sharing_not_harmfulhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_smart_spawning_gotcha_2_the_need_to_revive_threadshttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#_smart_spawning_gotcha_3_code_load_orderhttp://code.google.com/p/phusion-passenger/issues/listhttp://groups.google.com/group/phusion-passengerhttp://code.google.com/p/phusion-passenger/issues/listhttp://groups.google.com/group/phusion-passengermailto:[email protected]://www.phusionpassenger.com/enterprisehttps://www.phusionpassenger.com/commercial_supportmailto:[email protected]://www.phusionpassenger.com/support
  • 8/13/2019 Phusion Passenger Users Guide

    5/70

    2. Installation

    2.1. Synopsis

    he Phusion Passenger installation process consists of two steps!

    #. he obtainment step, where you download the Phusion Passenger files puts themsomewhere on your system. his can be done through downloading the source tarball,installing the Ruby gem or installing a native 0% pac7age via AP or K9.

    &. he integration step, where you configure Phusion Passenger so that it wor7sproperly with other system components such as Apache, Nginx, Ruby, Python, etc.

    Decause Phusion Passenger is designed to run in a wide variety of operating systems andconfigurations, both steps can be done in multiple ways. 9ost users Lespecially first-timeusersLwill be satisfied with thegeneric installation instructionswhich covers both steps."owever some users may prefer OS-specific installation instructions, which allow PhusionPassenger to better integrate into the operating system. Detter integration is characteri6ed byfollowing 0%-specific conventions.

    If you are not familiar with system administration and do not understand all the choices, then

    we recommend you to go with the Ruby(ems generic installation method:if you>re a Rubyuser= or the tarball generic installation method:if you>re not a Ruby user=.

    he steps for upgrading or downgrading Phusion Passenger is almost the same as the stepsfor installing. All the installation guides in this section will also teach you how to upgradeand downgrade.

    2.2. Generi installation, upgrade and do!ngrade method" via #ubyGems

    Ruby(ems is only used as a method to obtain the Phusion Passenger files, so in case youhave multiple Ruby versions it does not matter which Ruby>s Ruby(ems you use forinstallation. 0nce installed, Phusion Passenger can wor7 with all other Ruby versions on yoursystem.

    Step 1" figuring out !hether your #uby is installed the home diretory or system$!ide

    Ruby may either be installed in the home directory, or system-wide. If it>s installed system-wide then we will want to install gems system-wide as well, so you need to switch to a root

    prompt first. If Ruby is installed in the home directory then we will want to install gems to

    the home directory as well, as a normal user.

    +

    http://www.modrails.com/documentation/Users%20guide%20Nginx.html#rubygems_generic_installhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#tarball_generic_installhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#rubygems_generic_installhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#tarball_generic_install
  • 8/13/2019 Phusion Passenger Users Guide

    6/70

    o find out which case applies, run the following command to find out where the rubycommand is!

    which ruby

    o you see a filename that references/homeor/UsersM If so then your Ruby interpreter isinstalled in your home directory and you can proceed to step &. 0therwise, you need to switchto a root prompt by running one of the following commands!

    Are you using R9M Run rvmsudo -s

    Are you not using R9, or do you not 7now what R9 isM Run sudo -s

    Issudonot installed on your systemM Run su -c bash

    Kou must maintain this root prompt throughout this installation guide.

    Step 2" install the gem

    0pen %ource

    Install the latest gem to obtain the files for the latest stable version of the open sourcePhusion Passenger!

    gem install passenger

    %ometimes you will want to obtain the latest beta version of Phusion Passenger. Detaversions are not normally selected by gem install, so to opt-in for beta versions you have to

    add the --pre argument!

    gem install passenger --pre

    If you want to obtain a specific version of Phusion Passenger, e.g. because you aredowngrading, then specify the version number with --version!

    gem install passenger --version 3.0.0

    If you want to obtain a specific betaversion of Phusion Passenger then you must also pass--pre!

    gem install passenger --version 3.9.1.beta --pre

    3nterprise

    he gem install command only installs the open source version of Phusion Passenger.Phusion Passenger 3nterprisecustomers should obtain the gem from the $ustomer Areainstead. 1ogin with your order reference and password. he $ustomer Area will show you alist of files.

    /irst, download the liense %eyand save it as/etc/passenger-enterprise-license.

    Next, download the gem filefor the version you want :passenger-enterprise-server-x.x.x.gem= and install it with!

    https://www.phusionpassenger.com/enterprisehttps://www.phusionpassenger.com/ordershttps://www.phusionpassenger.com/enterprisehttps://www.phusionpassenger.com/orders
  • 8/13/2019 Phusion Passenger Users Guide

    7/70

    gem install passenger-enterprise-server-x.x.x.gem

    Step &" add the #ubyGems bin diretory to your 'P()*

    If you all of the following are applicable to you!

    Kou are on ebian or buntu,

    and you installed Ruby(ems through AP,

    and your Ruby interpreter is installed system-wide,

    Othen you must ensure that the Ruby(ems bin directory is in your PA", which is theenvironment variable that dictates where your command prompt will loo7 for commands. Ifany of the above conditions do not apply to you, then you can s7ip this step.

    0pen/etc/bash.bashrcor/etc/bashrc:whichever is available= and add the following to the

    end of the file. Also run this command in your terminal.

    export PATH!PATH"#var#lib#gems#1.$#bin"#var#lib#gems#1.9#bin

    Step +" loosen permissions

    If in step # you determined that your Ruby interpreter is installed in your home directory,then you need to ma7e sure that the Phusion Passenger gem directory is accessible by yourweb server. o do that, you must ensure that the Phusion Passenger gem directory, as well asall parent directories, have the world-executable permission.

    o find out where the Phusion Passenger gem directory is, run!

    passenger-con%ig --root

    %uppose that the above command outputs/home/phusion/.rvm/gems/ruby-1.9.3-p36/gems/passenger-!.!.!. hen you chmod oQx the directory itself and all parentdirectories up until/home/phusion!

    chmo& o'x #home#phusion#.rvm#gems#ruby-1.9.3-p3()#gems#passenger-x.x.xchmo& o'x #home#phusion#.rvm#gems#ruby-1.9.3-p3()#gemschmo& o'x #home#phusion#.rvm#gems#ruby-1.9.3-p3()

    chmo& o'x #home#phusion#.rvm#gemschmo& o'x #home#phusion#.rvmchmo& o'x #home#phusion

    Step " run the Phusion Passenger installer

    Nginx is a different from other web servers in that it does not support loadable modules. heonly way to extend Nginx is to recompile it entirely from source. hat>s what we will do inthis step. he good news is that Phusion Passenger provides a tool to ma7e this easy for you.

    If you>ve already installed Nginx before, but without Phusion Passenger support, then you

    shoulduninstall it first. Kou don>t have to, because you can also install another Nginx with

    2

  • 8/13/2019 Phusion Passenger Users Guide

    8/70

    Phusion Passenger support, in parallel to the existing Nginx. 'e merely recommenduninstalling the existing in order to avoid user confusion, but the choice is yours.

    If you had previously installed Nginx with Phusion Passenger support, and you areupgrading, then you don>t have to uninstall your existing Nginx first. Instead we>ll overwrite

    it this step.

    "ere>s how you can uninstall the original Nginx!

    If you installed the existing Nginx through AP, run! sudo apt-get remove nginx

    nginx-full nginx-light nginx-naxsi nginx-common

    If you installed the existing Nginx through K9, run yum remove nginx as root.

    o proceed with installing or upgrading Phusion Passenger, run the Phusion Passenger Nginxinstaller and follow the on-screen instructions!

    passenger-install-nginx-mo&ule

    At some point it will as7 you which prefix to install Nginx to. If you>re upgrading, thenspecify the same prefix that you used last time.

    Step -" erifying that Phusion Passenger is running

    Restart your web server and run!

    passenger-memory-stats

    Kou should see the web server processes as well as a number of Phusion Passenger processes:e.g. Passenger'atchdog, Passenger"elperAgent=. $ongratulations, Phusion Passenger isnow installed and running At this point you may be interested in creating an Nginx initscript.

    If the output is not as expected, then please refer to theroubleshootingsection.

    2.&. Generi installation, upgrade and do!ngrade method" via tarball

    Step 1" do!nload and extrat the tarball

    ownload the open source Phusion Passenger tarball from the Phusion Passenger website. Ifyou want a specific version, please refer to the release archive on Ruby/orge.

    If you a Phusion Passenger 3nterprisecustomer, download the Phusion Passenger 3nterprisetarball from the $ustomer Area. Also be sure to download the liense %eyand save it as

    /etc/passenger-enterprise-license.

    4

    http://www.modrails.com/documentation/Users%20guide%20Nginx.html#nginx_init_scripthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#nginx_init_scripthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#troubleshootinghttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#troubleshootinghttps://www.phusionpassenger.com/download#open_sourcehttp://rubyforge.org/frs/?group_id=5873&release_id=46919https://www.phusionpassenger.com/enterprisehttps://www.phusionpassenger.com/ordershttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#nginx_init_scripthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#nginx_init_scripthttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#troubleshootinghttps://www.phusionpassenger.com/download#open_sourcehttp://rubyforge.org/frs/?group_id=5873&release_id=46919https://www.phusionpassenger.com/enterprisehttps://www.phusionpassenger.com/orders
  • 8/13/2019 Phusion Passenger Users Guide

    9/70

    0nce you have downloaded the tarball, pic7 a location to extract it to. Kou can pic7 anylocation. A good location is/opt/passenger. 1et>s call this location PR3/IH. $reate thisdirectory and extract the tarball as follows!

    m*&ir !P+,/

    c& !P+,/tar xv% #location-to#passenger-x.x.x.tar.gc& !P+,/#passenger-x.x.x

    Note that passenger-x.x.x should be passenger-enterprise-server-x.x.x if you>re using PhusionPassenger 3nterprise.

    Step 2" loosen permissions

    he Phusion Passenger directory must be accessible by the web server and by any web appsyou want to run. o do that, you must ensure that the Phusion Passenger gem directory, as

    well as all parent directories, have the world-executable permission.

    %uppose that the Phusion Passenger directory is/opt/passenger/passenger-".#.#. Run chmodoQx on the directory itself and all parent directories.

    chmo& o'x #opt#passenger#passenger-.0.0chmo& o'x #opt#passengerchmo& o'x #opt

    Step &" installing #uby and #a%e

    Phusion Passenger supports multiple languages and its core is written in $QQ, but its installerand administration tools are written in Ruby, so you must install that.

    3ven though Ruby is reCuired, Ruby will not be loaded during normal operation unless youdeploy a Ruby web application on Phusion Passenger.

    Run ruby --version and ra7e --version to find out whether both commands are alreadyinstalled and recent enough. Phusion Passenger reCuires Ruby ;< #.4.. Any Ra7e versionwill do.

    ebian

    'e recommend you to usethe Drightbox Ruby pac7ages. hey provide more up-to-dateversions of Ruby than ebian>s official repositories provide. heir buntu 1ucid repositoryis compatible with ebian . If you do not want to use the Drightbox repository, then followthe instructions for ebian +.

    $reate/etc/apt/sources.list.d/brightbo!-source.list!

    &eb http"##ppa.launchpa&.net#brightbox#ruby-ng#ubuntu luci& main

    Install the Drightbox AP public 7ey!

    su&o apt-*ey a&v --*eyserver *eyserver.ubuntu.com --recv-*eys 2313AA(

    5

    http://wiki.brightbox.co.uk/docs:phusion-passengerhttp://wiki.brightbox.co.uk/docs:phusion-passengerhttp://wiki.brightbox.co.uk/docs:phusion-passenger
  • 8/13/2019 Phusion Passenger Users Guide

    10/70

    hen install Ruby and Ra7e!

    su&o apt-get up&atesu&o apt-get install ruby1.9.3su&o gem install ra*e

    ebian +

    Run!

    su&o apt-get up&atesu&o apt-get install ruby ra*e

    hen add the Ruby(ems bin directory to your PA".

    buntu

    'e recommend you to use the Drightbox Ruby pac7ages. hey provide more up-to-dateversions of Ruby than buntu>s official repositories provide.

    su&o apt-a&&-repository ppa"brightbox#passengersu&o apt-get up&ate

    If you>re on the older buntu 4.8* "ardy release, the apt-add-repository command isn>tavailable so you have to install the repository and the 7ey by hand!

    su&o sh -c 4echo 5&eb http"##ppa.launchpa&.net#brightbox#passenger#ubuntuhar&y main5 6 #etc#apt#sources.list.brightbox-passenger.list4su&o apt-*ey a&v --*eyserver *eyserver.ubuntu.com --recv-*eys 2313AA(

    su&o apt-get up&ate0ther operating systems

    Please install Ruby from the Ruby website. 0nce Ruby is installed, run the followingcommand :possibly as root= to install Ra7e!

    gem install ra*e

    Step +" figuring out !hether your #uby is installed the home diretory or system$!ide

    epending on whether you installed Ruby system-wide, you need to enter a root prompt

    before continuing to step +. Please refer to this section.

    Step " run the Phusion Passenger installer

    Please refer to this section. Note that the passenger-install-nginx-module command is insidethe binsubdirectory of the Phusion Passenger source directory, so you would have to runsomething li7e/opt/passenger/passenger-!.!.!/bin/passenger-install-ngin!-module.

    Step -" erifying that Phusion Passenger is running

    Please refer to this section. Note that all Phusion Passenger administration scripts are located

    inside the binsubdirectory of the Phusion Passenger source directory, so you would have torun something li7e/opt/passenger/passenger-!.!.!/bin/passenger-memory-stats.

    #8

    http://www.modrails.com/documentation/Users%20guide%20Nginx.html#add_rubygems_bin_dir_to_pathhttp://wiki.brightbox.co.uk/docs:phusion-passengerhttp://www.ruby-lang.org/http://www.modrails.com/documentation/Users%20guide%20Nginx.html#is_ruby_home_or_system_wide_installedhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#is_ruby_home_or_system_wide_installedhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#run_passenger_installerhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#verify_passenger_runninghttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#add_rubygems_bin_dir_to_pathhttp://wiki.brightbox.co.uk/docs:phusion-passengerhttp://www.ruby-lang.org/http://www.modrails.com/documentation/Users%20guide%20Nginx.html#is_ruby_home_or_system_wide_installedhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#is_ruby_home_or_system_wide_installedhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#run_passenger_installerhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#verify_passenger_running
  • 8/13/2019 Phusion Passenger Users Guide

    11/70

    2.+. /ryptographi verifiation of installation files

    'hen using the generic installation methods, you can chec7 whether the gem or the tarball

    are legit :i.e. whether they came from Phusion= by chec7ing them against their (P( digitalsignatures. %tarting from the open source version *.8.8 R$ *, or the 3nterprise version *.8.8R$ #, both the gem and tarball are signed with Phusion>s (P( 7ey!

    Phusion 7o%tware 7igning 8so%tware-signingphusion.nl:;ey t available soyou have to install the repository and the 7ey by hand.

    ebian !

    ##

    http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2AC745A50A212A8Chttp://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2AC745A50A212A8Chttps://www.phusionpassenger.com/signatures/https://www.phusionpassenger.com/ordershttp://wiki.brightbox.co.uk/docs:phusion-passengerhttps://www.phusionpassenger.com/enterprisehttps://www.phusionpassenger.com/enterprisehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#rubygems_generic_installhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#rubygems_generic_installhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#rubygems_generic_installhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#rubygems_generic_installhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#tarball_generic_installhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#tarball_generic_installhttp://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2AC745A50A212A8Chttps://www.phusionpassenger.com/signatures/https://www.phusionpassenger.com/ordershttp://wiki.brightbox.co.uk/docs:phusion-passengerhttps://www.phusionpassenger.com/enterprisehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#rubygems_generic_installhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#rubygems_generic_installhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#tarball_generic_install
  • 8/13/2019 Phusion Passenger Users Guide

    12/70

    su&o sh -c 4echo 5&eb http"##ppa.launchpa&.net#brightbox#passenger#ubuntuluci& main5 6 #etc#apt#sources.list.brightbox-passenger.list4su&o apt-*ey a&v --*eyserver *eyserver.ubuntu.com --recv-*eys 2313AA(su&o apt-get up&ate

    buntu 4.8* "ardy!

    su&o sh -c 4echo 5&eb http"##ppa.launchpa&.net#brightbox#passenger#ubuntuhar&y main5 6 #etc#apt#sources.list.brightbox-passenger.list4su&o apt-*ey a&v --*eyserver *eyserver.ubuntu.com --recv-*eys 2313AA(su&o apt-get up&ate

    Kou can proceed with installing Phusion Passenger by running!

    su&o apt-get install libapache)-mo&-passenger

    he Apache pac7age provides configuration snippets for you, so you don>t need to modify

    any Apache configuration to get it to load Phusion Passenger.

    Nginx

    0n buntu versions newer than 4.8* "ardy, register the Drightbox Apache PPA as follows!

    su&o apt-a&&-repository ppa"brightbox#passenger-nginxsu&o apt-get up&ate

    0n buntu 4.8* "ardy and on ebian, the apt-add-repository command isn>t available soyou have to install the repository and the 7ey by hand.

    ebian !

    su&o sh -c 4echo 5&eb http"##ppa.launchpa&.net#brightbox#passenger-nginx#ubuntu luci& main5 6 #etc#apt#sources.list.brightbox-passenger-nginx.list4su&o apt-*ey a&v --*eyserver *eyserver.ubuntu.com --recv-*eys 2313AA(su&o apt-get up&ate

    buntu 4.8* "ardy!

    su&o sh -c 4echo 5&eb http"##ppa.launchpa&.net#brightbox#passenger#ubuntu

    har&y main5 6 #etc#apt#sources.list.brightbox-passenger-nginx.list4su&o apt-*ey a&v --*eyserver *eyserver.ubuntu.com --recv-*eys 2313AA(su&o apt-get up&ate

    hen!

    su&o apt-get install nginx-%ull

    Kou>ll then need to enable the Phusion Passenger module in Nginx by creating the followingconfiguration file!

    su&o sh -c 4echo 5passenger>root #usr#lib#phusion-passenger?5 6

    #etc#nginx#con%.passenger.con%4

    #&

  • 8/13/2019 Phusion Passenger Users Guide

    13/70

    hen restart Nginx to apply the changes!

    su&o #etc#init.nginx restart

    %tandalone

    nfortunately, no pac7ages are provided for Phusion Passenger %tandalone.

    2.-. Installing or upgrading on #ed *at, edora, /ent3S or Sientifi4inux

    K9 repositories with RP9s are maintained by 3ri7 0ganand %tealthy 9on7eys$onsulting. 0nly pac7ages for the open source version of Phusion Passenger are provided.Phusion Passenger 3nterprisecustomers should use the generic Ruby(ems installationmethodor the generic tarball installation methodinstead.

    If you use K9 to install Phusion Passenger then you do not need to run passenger-install-apache&-module or passenger-install-nginx-module. he K9 pac7ages contain all the

    binaries that you need. Kou also don>t need to modify any Apache or Nginx configuration toget them to load Phusion Passenger, the pac7ages provide configuration snippets for you aswell.

    Step 1" Install the release pa%age

    he easiest way to install Phusion Passenger and 7eep it up to date is to install the passenger-release pac7age from themain repository.

    /edora $ore #+!

    yum install http"##passenger.stealthymon*eys.com#%e&ora#1=#passenger-release.noarch.rpm

    /edora $ore #*!

    yum install http"##passenger.stealthymon*eys.com#%e&ora#1#passenger-release.noarch.rpm

    R"31 + ? $ent0% + ? %cientific1inux +! :Note! these pac7ages depend on 3P31.=

    rpm -@vh http"##passenger.stealthymon*eys.com#rhel#=#passenger-release.noarch.rpm

    R"31 ? $ent0% ? %cientific1inux !

    yum install http"##passenger.stealthymon*eys.com#rhel#(#passenger-release.noarch.rpm

    Step 2" se 56

    /rom there you can use K9to install pac7ages. /or example, try one of these!

    #)

    https://github.com/erikogan/passengerhttp://stealthymonkeys.com/http://stealthymonkeys.com/https://www.phusionpassenger.com/enterprisehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#rubygems_generic_installhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#rubygems_generic_installhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#tarball_generic_installhttp://passenger.stealthymonkeys.com/http://passenger.stealthymonkeys.com/http://passenger.stealthymonkeys.com/http://fedoraproject.org/wiki/EPELhttp://prefetch.net/articles/yum.htmlhttps://github.com/erikogan/passengerhttp://stealthymonkeys.com/http://stealthymonkeys.com/https://www.phusionpassenger.com/enterprisehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#rubygems_generic_installhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#rubygems_generic_installhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#tarball_generic_installhttp://passenger.stealthymonkeys.com/http://fedoraproject.org/wiki/EPELhttp://prefetch.net/articles/yum.html
  • 8/13/2019 Phusion Passenger Users Guide

    14/70

    Phusion Passenger for Apache!

    yum install mo&>passenger

    Phusion Passenger for Nginx!

    yum install nginx-passenger

    Phusion Passenger %tandalone!

    yum install passenger-stan&alone

    7uilding your o!n pa%ages

    here are instructions for building your own pac7ages and Kum repositories in therpmdirectory Read9ewithin the (it"ub repository.

    2.8. pgrading from open soure to 9nterprise

    Phusion Passenger comes in two variants! an open source version, as well as an 3nterpriseversionwhich introduces a myriad of useful features that can improve stability and

    performance and efficiency.

    $ustomers who have bought Phusion Passenger 3nterprise can upgrade their open sourceinstallation to 3nterprise as follows!

    #. ninstall the open source Phusion Passenger.&. Install the 3nterprise version by following one of the installation guides in this section

    :e.g. Ruby(ems generic installationor tarball generic installation=.

    he uninstallation is necessary because the 3nterprise Ruby gem has a different gem name:passenger-enterprise-serverinstead ofpassenger=, but the same administration commandnames :e.g. passenger-status=. ninstalling the open source version avoids any conflicts.

    2.:. Non$interative, automati, headless installs or upgrades

    Dy default, the installer :passenger-install-nginx-module= is interactive. If you want toautomate installation then you can do so by passing various answers to the installer throughcommand line options. Please run the installer with --help for a list of available command lineoptions.

    2.;. /ustomi

  • 8/13/2019 Phusion Passenger Users Guide

    15/70

    2.;.1. Setting the ompiler

    Kou can force the Phusion Passenger build system to use a specific $ or $QQ compiler bysetting the $$ and $HH environment variables. hese may be set to any arbitrary shellcommands.

    /or example, contributors who want to hac7 on Phusion Passenger may want to use $lang forfaster compilation and ccachefor faster recompilation, and may want to enable more error-catching compilation flags!

    export 224ccache clang -%color-&iagnostics -unuse&-arguments -%catch-un&e%ine&-behavior -%trapv4export 2//4ccache clang'' -%color-&iagnostics -unuse&-arguments -%catch-un&e%ine&-behavior -%trapv4

    2.;.2. (dding additional ompiler or lin%er flags

    0n some systems, $?$QQ libraries and headers that Phusion Passenger reCuires may belocated in a non-standard directory. Kou can force the Phusion Passenger build system toloo7 in those locations by inecting compiler and lin7er flags using the followingenvironment variables!

    3HRA@PR3@$/1A(%

    hese flags are inected into all $ compiler invocations that involve compiling $ or$QQ source files. his includes compiler invocations that compile andlin7. he flags

    are inected at the beginning of the command string, even before3HRA@PR3@1/1A(%.

    3HRA@$/1A(%

    %imilar to 3HRA@PR3@$/1A(%, but inected at the end of the command string,before 3HRA@1/1A(%.

    3HRA@PR3@$HH/1A(%

    %imilar to 3HRA@PR3@$/1A(%, but for $QQ compiler invocations.

    3HRA@$HH/1A(%

    %imilar to 3HRA@$/1A(%, but for $QQ compiler invocations.

    3HRA@PR3@1/1A(%

    hese flags are inected into all $?$QQ compiler invocations that involve lin7ing. hisincludes compiler invocations that compile andlin7. he flags are inected at the

    beginning of the command string, but after 3HRA@PR3@$/1A(% and3HRA@PR3@$HH/1A(%.

    3HRA@1/1A(%

    #+

    http://ccache.samba.org/http://ccache.samba.org/
  • 8/13/2019 Phusion Passenger Users Guide

    16/70

    %imilar to 3HRA@PR3@1/1A(%, but inected at the very end of the commandstring, even after 3HRA@$/1A(% and 3HRA@$HH/1A(%.

    2.;.&. oring loation of ertain ommand line tools

    he Phusion Passenger build system attempts to autodetect many things by locating relevanthelper tools. /or example, to find out which compiler flags it should use for compilingApache modules, it locates the apxs& command and Cueries it. o find out which compilerflags it should use for libcurl, it Cueries the curl-config command. hese commands may not

    be in PA", or even when they are you may want to use a different one.

    Kou can often force the build to find certain command line tools at certain locations by usingthe following environment variables!

    "P

    he location of the httpd executable :the Apache server executable=.

    APH%&

    he location of the apxs& executable :the Apache module developer tool=.

    APR@$0N/I(

    he location of the apr-config executable :the Apache Portable Runtime developertool=.

    AP@$0N/I(

    he location of the apu-config executable :the Apache Portable Runtime tilitydeveloper tool=.

    9AS3

    he location of a ma7e tool. It does not matter which implementation of ma7e this is.

    (9AS3

    he location of the (N-compatible ma7e tool.

    2.1=. Installing as a normal Nginx module !ithout using the installer

    Kou can also install Phusion Passenger the way you install any other Nginx module, e.g. with--add-module. Run Nginx>s configure script with --add-module

  • 8/13/2019 Phusion Passenger Users Guide

    17/70

    If you installed Phusion Passenger via the gem, thenpath-to-passenger-rootcan be obtainedwith the command!

    passenger-con%ig --root

    his will probably output something along the lines of/usr/lib/ruby/gems/1.$/gems/passenger-!.!.!, so you>ll probably have to specify somethingli7e --add-module

  • 8/13/2019 Phusion Passenger Users Guide

    18/70

    Phusion Passenger completely. 'hen disabled, Phusion Passenger will not occupy anymemory or $P or otherwise interfere with the web server.

    o unload Phusion Passenger, edit your Nginx configuration file:s= and comment out allPhusion Passenger configuration directives.

    /or example, if your configuration file loo7s li7e thisO

    ...

    http B passenger>root #somewhere#passenger-x.x.x? passenger>ruby #usr#bin#ruby? passenger>max>pool>sie 10?

    gip on?

    server B server>name www.%oo.com? listen $0? root #webapps#%oo#public? passenger>enable& on? CC

    Othen comment out the relevant directives, so that it loo7s li7e this!

    ...

    http B

    D passenger>root #somewhere#passenger-x.x.x? D passenger>ruby #usr#bin#ruby? D passenger>max>pool>sie 10?

    gip on?

    server B server>name www.%oo.com? listen $0? root #webapps#%oo#public? D passenger>enable& on? CC

    After you>ve done this, save the configuration file and restart the web server.

    2.1&. ninstalling

    o uninstall Phusion Passenger, please first remove all Phusion Passenger configurationdirectives from your web server configuration file:s=. After you>ve done this, you need toremove the Phusion Passenger files.

    #4

  • 8/13/2019 Phusion Passenger Users Guide

    19/70

    If you installed Phusion Passenger via a Ruby gem, then run gem uninstall passenger

    :or, if you>re an Phusion Passenger 3nterpriseuser, gem uninstall passenger-enterprise-server=. Kou might have to run this as root.

    If you installed Phusion Passenger via a source tarball, then remove the directory in

    which you placed the extracted Phusion Passenger files. his directory is the same as

    the one pointed to the by PassengerRoot?passenger@root configuration directive.

    If you installed Phusion Passenger through AP or K9, then use them to uninstall

    Phusion Passenger.

    Nginx does not have to be recompiled. Altough it contains Phusion Passenger code, it willnot do anything when Phusion Passenger is disabled.

    2.1+. 6oving to a different diretory

    If you installed Phusion Passenger through a tarball then you can move the PhusionPassenger directory to another location. his is not possible if you used any of the otherinstallation methods.

    /irst, move the directory to whereever you li7e!

    mv #opt#passenger#passenger-.0.0 #usr#local#passenger-.0.0

    Next you must tell your web server that Phusion Passenger has moved. 0pen your Nginx

    configuration file and set thepassenger%rootdirective to the new location!

    passenger>root #usr#local#passenger-.0.0

    Restart your web server to finali6e the change.

    &. 0eploying a #uby on #ails 1.x or 2.x >but N3) #ails ?@

    &A appliation

    %uppose you have a Ruby on Rails application in/&ebapps/mycoo', and you own the domain&&&.mycoo'.com. Kou can either deploy your application to the virtual host>s root :i.e. theapplication will be accessible from the root R1, http(//&&&.mycoo'.com/=, or in a sub RI:i.e. the application will be accessible from a sub R1, such ashttp(//&&&.mycoo'.com/railsapplication=.

    he default RAI1%@3N environment in which deployed Rails applications are run,is TproductionU. Kou can change this by changing the rails@envconfiguration option.

    &.1. 0eploying to a virtual hostBs root

    #5

    https://www.phusionpassenger.com/enterprisehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#is_ruby_home_or_system_wide_installedhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#RailsEnvhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#RailsEnvhttps://www.phusionpassenger.com/enterprisehttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#is_ruby_home_or_system_wide_installedhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#RailsEnv
  • 8/13/2019 Phusion Passenger Users Guide

    20/70

    Add aservervirtual host entry to your Nginx configuration file. he virtual host>s root mustpoint to your Ruby on Rails application>spublicfolder.

    Inside theserverbloc7, setpassenger%enabled on.

    /or example!

    http B ...

    server B listen $0? server>name www.mycoo*.com? root #webapps#mycoo*#public? passenger>enable& on? C

    ...

    C

    hen restart Nginx. he application has now been deployed.

    &.2. 0eploying to a sub #I

    %uppose that you already have aservervirtual host entry!

    http B ...

    server B listen $0? server>name www.phusion.nl? root #websites#phusion? C

    ...C

    And you want your Ruby on Rails application to be accessible from the R1

    http(//&&&.phusion.nl/rails.

    o do this, ma7e a symlin7 in the virtual host>s document root, and have it point to yourRuby on Rails application>spublicfolder. /or example!

    ln -s #webapps#mycoo*#public #websites#phusion#rails

    Next, setpassenger%enabled onand add apassenger@base@urioption to theserverbloc7!

    http B ...

    server B listen $0?

    &8

    http://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerBaseURIhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerBaseURIhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerBaseURI
  • 8/13/2019 Phusion Passenger Users Guide

    21/70

    server>name www.phusion.nl? root #websites#phusion? passenger>enable& on? D E--- These lines have passenger>base>uri #rails? D E--- been a&&e&. C

    ...C

    hen restart Nginx. he application has now been deployed.

    Kou can deploy multiple Rails applications under a virtual host, by specifyingpassenger@base@urimultiple times. /or example!

    server B ... passenger>base>uri #app1? passenger>base>uri #app)?

    passenger>base>uri #app3?C

    &.&. #edeploying >restarting the #uby on #ails appliationA

    eploying a new version of a Ruby on Rails application is as simple as re-uploading theapplication files, and restarting the application.

    here are two ways to restart the application!

    #. Dy restarting Nginx.

    &. Dy creating or modifying the file tmp/restart.t!tin the Rails application>s root folder.Phusion Passenger will automatically restart the application during the next reCuest.

    /or example, to restart our example 9y$oo7 application, we type this in the command line!

    touch #webapps#mycoo*#tmp#restart.txt

    Please note that, unli7e earlier versions of Phusion Passenger, restart.t!tis not automaticallydeleted. Phusion Passenger chec7s whether the timestamp of this file has changed in order todetermine whether the application should be restarted.

    &.+. 6igrations

    Phusion Passenger is not related to Ruby on Rails migrations in any way. o run migrationson your deployment server, please login to your deployment server :e.g. with ssh= and typera7e db!migrate RAI1%@3N

  • 8/13/2019 Phusion Passenger Users Guide

    22/70

    &.. /apistrano integration

    %ee $apistrano recipe.

    +. 0eploying a #a%$based #uby appliation >inluding

    #ails ?@ &A

    Phusion Passenger supports arbitrary Ruby web applications that follow theRac7interface.

    Phusion Passenger assumes that Rac7 application directories have a certain layout. %upposethat you have a Rac7 application in/&ebapps/rac'app. hen that folder must contain at leastthree entries!

    config.ru, a Rac7up file for starting the Rac7 application. his file must contain the

    complete logic for initiali6ing the application. public/, a folder containing public static web assets, li7e images and stylesheets.

    tmp/, used for restart.t!t:our application restart mechanism=. his will be explained

    in a following subsection.

    %o/&ebapps/rac'appmust, at minimum, loo7 li7e this!

    #webapps#rac*app F '-- con%ig.ru F '-- public# F '-- tmp#

    %uppose you own the domain &&&.rac'app.com. Kou can either deploy your application tothe virtual host>s root :i.e. the application will be accessible from the root R1,http(//&&&.rac'app.com/=, or in a sub RI :i.e. the application will be accessible from a subR1, such as http(//&&&.rac'app.com/rac'app=.

    he default RA$S@3N environment in which deployed Rac7 applications are run,is TproductionU. Kou can change this by changing the rac7@envconfiguration option.

    +.1. )utorialCexample" !riting and deploying a *ello World #a% appliation

    /irst we create a Phusion Passenger-compliant Rac7 directory structure!

    ! m*&ir #webapps#rac*>example! m*&ir #webapps#rac*>example#public! m*&ir #webapps#rac*>example#tmp

    Next, we write a minimal Vhello worldV Rac7 application!

    &&

    http://www.modrails.com/documentation/Users%20guide%20Nginx.html#capistranohttp://rack.rubyforge.org/http://rack.rubyforge.org/http://rack.rubyforge.org/http://www.modrails.com/documentation/Users%20guide%20Nginx.html#RackEnvhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#RackEnvhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#capistranohttp://rack.rubyforge.org/http://www.modrails.com/documentation/Users%20guide%20Nginx.html#RackEnv
  • 8/13/2019 Phusion Passenger Users Guide

    23/70

  • 8/13/2019 Phusion Passenger Users Guide

    24/70

    http B ...

    server B listen $0? server>name www.phusion.nl?

    root #websites#phusion? passenger>enable& on? C

    ...C

    And you want your Rac7 application to be accessible from the R1http(//&&&.phusion.nl/rac'.

    o do this, ma7e a symlin7 in the virtual host>s document root, and have it point to your Rac7application>spublicfolder. /or example!

    ln -s #webapps#rac*app#public #websites#phusion#rac*

    Next, setpassenger%enabled onand add apassenger@base@urioption to theserverbloc7!

    http B ...

    server B listen $0? server>name www.phusion.nl? root #websites#phusion?

    passenger>enable& on? D E--- These lines have passenger>base>uri #rac*? D E--- been a&&e&. C

    ...C

    hen restart Nginx. he application has now been deployed.

    Kou can deploy multiple Rac7 applications under a virtual host, by specifyingpassenger@base@urimultiple times. /or example!

    server B ... passenger>base>uri #app1? passenger>base>uri #app)? passenger>base>uri #app3?C

    +.+. #edeploying >restarting the #a% appliationA

    eploying a new version of a Rac7 application is as simple as re-uploading the application

    files, and restarting the application.

    &*

    http://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerBaseURIhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerBaseURIhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerBaseURIhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerBaseURIhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerBaseURIhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerBaseURI
  • 8/13/2019 Phusion Passenger Users Guide

    25/70

    here are two ways to restart the application!

    #. Dy restarting Nginx.

    &. Dy creating or modifying the file tmp/restart.t!tin the Rac7 application>s root folder.

    Phusion Passenger will automatically restart the application.

    /or example, to restart our example application, we type this in the command line!

    touch #webapps#rac*app#tmp#restart.txt

    +.. #a%up speifiations for various !eb frame!or%s

    his subsection shows example config.rufiles for various web framewor7s.

    +..1. /amping

    reJuire 4rubygems4reJuire 4rac*4reJuire 4camping4

    DDDDD Kegin 2amping application2amping.goes "Klog

    ...your application co&e here...

    DDDDD ,n& 2amping application

    run +ac*""A&apter""2amping.new8Klog:

    /or $amping versions &.8 and up, using run Dlog as the final line will do.

    +..2. *alyon

    reJuire 4rubygems4reJuire 4halcyon4!LMAPATH.unshi%t8Halcyon.root # 4lib4:Halcyon""+unner.loa&>con%ig Halcyon.root#4con%ig4#4con%ig.yml4run Halcyon""+unner.new

    +..&. 6a%

    ,NOG5A2;>,NO5I ,NOG5+A2;>,NO5Iloa&85+a*e%ile5:reJuire 4rubygems4reJuire 4mac*4run ac*""@tils""7erver.buil&>app

    &+

    http://www.modrails.com/documentation/Users%20guide%20Nginx.html#application_roothttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#application_roothttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#application_root
  • 8/13/2019 Phusion Passenger Users Guide

    26/70

    +..+. 6erb

    reJuire 4rubygems4reJuire 4merb-core4

    erb""2on%ig.setup8

    "merb>root 6 ""ile.expan&>path8""ile.&irname8>>L,>>:: "environment 6 ,NOG4+A2;>,NO4I:erb.environment erb""2on%igG"environmentIerb.root erb""2on%igG"merb>rootIerb""KootLoa&er.run

    run erb""+ac*""Application.new

    +... #ama,NO4I.to>sym&isable "run "reloa&

    reJuire 4app.rb4

    run 7inatra""Application

    . 0eploying a WSGI >PythonA appliation

    Phusion Passenger supports all '%(I-compliant Python web applications. %uppose that youhave a '%(I application in/&ebapps/&sgiapp. hen that folder must contain at least threeentries!

    passenger%&sgi.py, which Phusion Passenger will use as the main entry point for your

    application. his file must export a '%(I obect called application. public/, a folder containing public static web assets, li7e images and stylesheets.

    tmp/, used for restart.t!t:our application restart mechanism=. his will be explainedin a following subsection.

    %o/&ebapps/&sgiappmust, at minimum, loo7 li7e this!

    &

  • 8/13/2019 Phusion Passenger Users Guide

    27/70

    #webapps#wsgiapp F '-- con%ig.ru F '-- public# F

    '-- tmp#

    .1. )utorialCexample" !riting and deploying a *ello World WSGI appliation

    /irst we create a Phusion Passenger-compliant '%(I directory structure!

    ! m*&ir #webapps#wsgi>example! m*&ir #webapps#wsgi>example#public! m*&ir #webapps#wsgi>example#tmp

    Next, we write a minimal Vhello worldV '%(I application!

    ! c& #webapps#wsgi>example! some>awesome>e&itor passenger>wsgi.py...type in some source co&e...! cat passenger>wsgi.py&e% application8environ start>response:" start>response84)00 M;4 G842ontent-Type4 4text#plain4:I: return G5hello worl&QRn5I

    /inally, we deploy it by adding the following configuration options to the Nginxconfiguration file!

    http B ... server B listen $0? server>name www.wsgiexample.com? root #webapps#wsgi>example#public? passenger>enable& on? C ...C

    And we>re done After an Nginx restart, the above '%(I application will be available under

    the R1 http(//&&&.&sgie!ample.com/.

    .2. 0eploying to a virtual hostBs root

    Add aservervirtual host entry to your Nginx configuration file. he virtual host>s root mustpoint to your '%(I application>s publicfolder. Kou must also setpassenger%enabled onintheserverbloc7.

    /or example!

    http B

    &2

  • 8/13/2019 Phusion Passenger Users Guide

    28/70

    ... server B listen $0? server>name www.wsgiapp.com? root #webapps#wsgiapp#public? passenger>enable& on?

    C ...C

    hen restart Nginx. he application has now been deployed.

    .&. #edeploying >restarting the WSGI appliationA

    eploying a new version of a '%(I application is as simple as re-uploading the application

    files, and restarting the application.

    here are two ways to restart the application!

    #. Dy restarting Nginx.

    &. Dy creating or modifying the file tmp/restart.t!tin the '%(I application>s root folder.Phusion Passenger will automatically restart the application.

    /or example, to restart our example application, we type this in the command line!

    touch #webapps#wsgiapp#tmp#restart.txt

    -. /onfiguring Phusion Passenger

    After installation, Phusion Passenger does not need any further configurations. Nevertheless,the system administrator may be interested in changing Phusion Passenger>s behavior.Phusion Passenger supports the following configuration options in the Nginx configurationfile!

    -.1. passengerDroot Ediretory?

    he location to the Phusion Passenger root directory. his configuration option is essential toPhusion Passenger, and allows Phusion Passenger to locate its own data files. he correctvalue is given by the installer.

    If you>ve moved Phusion Passenger to a different directory then you need to update thisoption as well. Please read9oving Phusion Passenger to a different directoryfor moreinformation.

    his reCuired option may only occur once, in the httpconfiguration bloc7.

    &4

    http://www.modrails.com/documentation/Users%20guide%20Nginx.html#application_roothttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#application_roothttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#moving_phusion_passengerhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#moving_phusion_passengerhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#application_roothttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#moving_phusion_passenger
  • 8/13/2019 Phusion Passenger Users Guide

    29/70

    -.2. passengerDruby Efilename?

    his option allows one to specify the Ruby interpreter to use.

    %ince version *.8.8, this option may occur in the following places!

    In the httpconfiguration bloc7.

    In aserverconfiguration bloc7.

    In a locationconfiguration bloc7.

    In an ifconfiguration scope.

    If you want to use a different Ruby interpreter for two different applications then you shoulddefine different passenger@ruby directives in different httpbloc7s.

    In versions prior to *.8.8, only a single Ruby version is supported for the entire Nginxinstance, so passenger@ruby may only occur in the httpconfiguration bloc7.

    he default value is ruby, meaning that the Ruby interpreter will be loo7ed up according tothe PA" environment variable.

    -.&. passengerDpython Efilename?

    Introdued in version +.=.=.

    his option allows one to specify the Python interpreter to use. It may occur in the followingplaces!

    In the httpconfiguration bloc7.

    In aserverconfiguration bloc7.

    In a locationconfiguration bloc7.

    In an ifconfiguration scope.

    If you want to use a different Python interpreter for two different applications then youshould define different passenger@python directives in different httpbloc7s.

    he default value ispython, meaning that the Python interpreter will be loo7ed up accordingto the PA" environment variable.

    -.+. passengerDappDroot EpathCtoCroot?

    &5

  • 8/13/2019 Phusion Passenger Users Guide

    30/70

    Introdued in version +.=.=.Dy default, Phusion Passenger assumes that the application>sroot directory is the parent directory of thepublicdirectory. his option allows one to specifythe application>s root independently from the Nginx root, which is useful if thepublicdirectory lives in a non-standard place.

    his option may occur in the following places!

    In the httpconfiguration bloc7.

    In aserverconfiguration bloc7.

    In a locationconfiguration bloc7.

    In an ifconfiguration scope.

    In each place, it may be specified at most once.

    3xample!

    server B server>name test.host? root #var#rails#ena#sites#example.com#public? D normally Phusion Passenger woul& D have assume& that the application D root is 5#var#rails#ena#sites#example.com5 passenger>app>root #var#rails#ena?C

    -.. passengerDspa!nDmethod Estring?

    V'hat spawn method should I useMV

    his subsection attempts to describe spawn methods, but it>s o7ay if you don>t :wantto= understand it, as it>s mostly a technical detail. Kou can basically follow this rule ofthumb!

    If your application wor7s on 9ongrel, but not on Phusion Passenger, then setpassenger@spawn@method to direct. 0therwise, leave it atsmart:the default=.

    "owever, we do recommend you to try to understand it. hesmartspawn methodbrings many benefits.

    Internally, Phusion Passenger spawns multiple Ruby application processes in order to handlereCuests. Dut there are multiple ways with which processes can be spawned, each having itsown set of pros and cons. %upported spawn methods are!

    smart

    his spawning method caches code using the app preloader. /ramewor7 code is not

    cached between multiple applications, although it is cached within instances of the

    )8

  • 8/13/2019 Phusion Passenger Users Guide

    31/70

    same application. Please read %pawning methods explainedfor a more detailedexplanation of what smart spawning exactly does.

    Pros"%mart spawning caches code where possible to speed up the respawn processand is compatible with most applications

    /ons"It is possible that it may be incompatible with some applications

    direct

    his spawning method is similar to the one used in 9ongrel $luster. It does notperform any code caching at all. Please read %pawning methods explainedfor a moredetailed explanation of what direct spawning exactly does.

    Pros"irect spawning is guaranteed to be compatible with all applications andlibraries.

    /ons"9uch slower than smart spawning. 3very spawn action will be eCually slow,though no slower than the startup time of a single server in 9ongrel $luster. irectspawning will also render Ruby 3nterprise 3dition>s memory reduction technologyuseless.

    As of Passenger ).&, conservativespawning was renamed to directandsmart-lvwasrenamed tosmart. he oldsmartspawning has been removed in favor of the new version.

    his option may occur in the following places!

    In the httpconfiguration bloc7.

    In aserverconfiguration bloc7.

    In a locationconfiguration bloc7.

    In an ifconfiguration scope.

    In each place, it may be specified at most once. he default value issmart.

    -.-. passengerDrollingDrestarts EonFoff?

    )his feature is only available in Phusion Passenger 9nterprise. It !as introdued in

    version &.=.=. 7uy Phusion Passenger 9nterprise here.

    3nables or disables support for rolling restarts. Normally when you restart an application :bytouching restart.txt=, Phusion Passenger would shut down all application processes and spawna new one. he spawning of a new application process could ta7e a while, and any reCueststhat come in during this time will be bloc7ed until this first application process has spawned.

    Dut when rolling restarts are enabled, Phusion Passenger 3nterprise will!

    )#

    http://www.modrails.com/documentation/Users%20guide%20Nginx.html#spawning_methods_explainedhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#spawning_methods_explainedhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#spawning_methods_explainedhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#reducing_memory_usagehttps://www.phusionpassenger.com/enterprisehttps://www.phusionpassenger.com/downloadhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#spawning_methods_explainedhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#spawning_methods_explainedhttp://www.modrails.com/documentation/Users%20guide%20Nginx.html#reducing_memory_usagehttps://www.phusionpassenger.com/enterprisehttps://www.phusionpassenger.com/download
  • 8/13/2019 Phusion Passenger Users Guide

    32/70

    #. %pawn a new process in the bac7ground.&. 'hen it>s done spawning, Phusion Passenger 3nterprise will replace one of the old

    processes with this newly spawned one.

    ). %tep # and & are repeated until all processes have been replaced.

    his way, visitors will not experience any delays when you are restarting your application.his allows you to, for example, upgrade your application often without degrading userexperience.

    Rolling restarts have a few caveat however that you should be aware of!

    pgrading an application sometimes involves upgrading the database schema. 'ith

    rolling restarts, there may be a point in time during which processes belonging to theprevious version and processes belonging to the new version both exist at the sametime. Any database schema upgrades you perform must therefore be bac7wards-

    compatible with the old application version.

    Decause there>s no telling which process will serve a reCuest, users may not see

    changes brought about by the new version until all processes have been restarted. It isfor this reason that you should not use rolling restarts in development, only in

    production.

    his option may occur in the following places!

    In the httpconfiguration bloc7.

    In aserverconfiguration bloc7.

    In a locationconfiguration bloc7.

    In an ifconfiguration scope.

    In each place, it may be specified at most once. he default value is off.

    -.8. passengerDresistDdeploymentDerrors EonFoff?

    )his feature is only available in Phusion Passenger 9nterprise. It !as introdued in

    version &.=.=. 7uy Phusion Passenger 9nterprise here.

    3nables or disables resistance against deployment errors.

    %uppose you>ve upgraded your application and you>ve issues a command to restart it :bytouching restart.txt=, but the application code contains an error that prevents PhusionPassenger from successfully spawning a process :e.g. a syntax error=. Phusion Passengerwould normally display an error message in response to this.

    Dy enabling deployment error resistance, Phusion Passenger 3nterprise would instead do this!

    )&

    https://www.phusionpassenger.com/enterprisehttps://www.phusionpassenger.com/downloadhttps://www.phusionpassenger.com/enterprisehttps://www.phusionpassenger.com/download
  • 8/13/2019 Phusion Passenger Users Guide

    33/70

    It passes the reCuest to one of the existing application processes :that belong to the

    previous version of the application=. he visitor will not see a Phusion Passengerprocess spawning error message.

    It logs the error to the global web server error log file.

    It sets an internal flag so that no processes for this application will be spawned :evenwhen the current traffic would normally result in more processes being spawned= andno processes will be idle cleaned. Processes ouldstill be shutdown because of otherevents, e.g. because their memory limithave been reached.

    his way, visitors will suffer minimally from deployment errors. Phusion Passenger willattempt to restart the application again next time restart.txt is touched.

    3nabling deployment error resistance only wor7s ifrolling restartis also enabled.

    his option may occur in the following places!

    In the httpconfiguration bloc7.

    In aserverconfiguration bloc7.

    In a locationconfiguration bloc7.

    In an ifconfiguration scope.

    In each place, it may be specified at most once. he default value is off.

    -.:. passengerDtempDdir Ediretory?

    %pecifies the directory that Phusion Passenger should use for storing temporary files. hisincludes things such as nix soc7et files.

    his opti


Recommended