passenger 4.0.5 → 4.0.6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of passenger might be problematic. Click here for more details.

Files changed (162) hide show
  1. data.tar.gz.asc +7 -7
  2. data/.travis.yml +1 -2
  3. data/CONTRIBUTING.md +20 -5
  4. data/CONTRIBUTORS +67 -0
  5. data/LICENSE +1 -1
  6. data/NEWS +48 -0
  7. data/Rakefile +2 -2
  8. data/bin/passenger-config +18 -0
  9. data/bin/passenger-install-apache2-module +2 -0
  10. data/bin/passenger-install-nginx-module +11 -12
  11. data/bin/passenger-memory-stats +2 -0
  12. data/bin/passenger-status +152 -69
  13. data/build/agents.rb +1 -5
  14. data/build/basics.rb +26 -13
  15. data/build/cplusplus_support.rb +9 -0
  16. data/build/debian.rb +129 -0
  17. data/build/documentation.rb +6 -2
  18. data/build/integration_tests.rb +13 -2
  19. data/build/misc.rb +16 -0
  20. data/build/packaging.rb +67 -51
  21. data/build/preprocessor.rb +314 -0
  22. data/build/test_basics.rb +1 -0
  23. data/{debian → debian.template}/README.Debian +0 -0
  24. data/{debian → debian.template}/changelog +131 -0
  25. data/debian.template/compat +1 -0
  26. data/debian.template/control +71 -0
  27. data/debian.template/copyright +385 -0
  28. data/debian.template/libapache2-mod-passenger.install +3 -0
  29. data/{debian → debian.template}/libapache2-mod-passenger.postinst +0 -0
  30. data/{debian → debian.template}/libapache2-mod-passenger.prerm +0 -0
  31. data/debian.template/locations.ini +12 -0
  32. data/debian.template/passenger.conf +4 -0
  33. data/{debian → debian.template}/passenger.load +0 -0
  34. data/debian.template/patches/series +0 -0
  35. data/debian.template/repack.sh +42 -0
  36. data/debian.template/ruby-passenger-dev.install +3 -0
  37. data/debian.template/ruby-passenger-doc.install +2 -0
  38. data/debian.template/ruby-passenger.docs +4 -0
  39. data/debian.template/ruby-passenger.install +11 -0
  40. data/debian.template/ruby-passenger.manpages +4 -0
  41. data/debian.template/rules.template +35 -0
  42. data/debian.template/source/format +1 -0
  43. data/debian.template/watch +3 -0
  44. data/dev/run_travis.sh +46 -46
  45. data/doc/Architectural overview.html +2 -2
  46. data/doc/Packaging.html +27 -18
  47. data/doc/Packaging.txt.md +27 -18
  48. data/doc/Security of user switching support.html +2 -2
  49. data/doc/Users guide Apache.html +881 -95
  50. data/doc/Users guide Apache.idmap.txt +48 -6
  51. data/doc/Users guide Apache.txt +13 -1
  52. data/doc/Users guide Nginx.html +1063 -190
  53. data/doc/Users guide Nginx.idmap.txt +89 -45
  54. data/doc/Users guide Nginx.txt +45 -0
  55. data/doc/Users guide Standalone.html +7 -7
  56. data/doc/users_guide_snippets/alternative_for_flying_passenger.txt +1 -0
  57. data/doc/users_guide_snippets/environment_variables.txt +221 -0
  58. data/doc/users_guide_snippets/installation.txt +66 -17
  59. data/doc/users_guide_snippets/support_information.txt +3 -3
  60. data/doc/users_guide_snippets/tips.txt +352 -40
  61. data/ext/common/Account.h +4 -3
  62. data/ext/common/AccountsDatabase.h +6 -6
  63. data/ext/common/AgentsStarter.h +1 -13
  64. data/ext/common/ApplicationPool2/DirectSpawner.h +4 -4
  65. data/ext/common/ApplicationPool2/DummySpawner.h +1 -1
  66. data/ext/common/ApplicationPool2/Group.h +9 -4
  67. data/ext/common/ApplicationPool2/Implementation.cpp +6 -1
  68. data/ext/common/ApplicationPool2/Options.h +65 -37
  69. data/ext/common/ApplicationPool2/Pool.h +91 -41
  70. data/ext/common/ApplicationPool2/Process.h +6 -6
  71. data/ext/common/ApplicationPool2/SmartSpawner.h +14 -14
  72. data/ext/common/ApplicationPool2/Socket.h +1 -1
  73. data/ext/common/ApplicationPool2/Spawner.h +24 -16
  74. data/ext/common/ApplicationPool2/SpawnerFactory.h +9 -1
  75. data/ext/common/ApplicationPool2/SuperGroup.h +1 -1
  76. data/ext/common/Constants.h +1 -1
  77. data/ext/common/Logging.cpp +12 -7
  78. data/ext/common/MessageServer.h +7 -12
  79. data/ext/common/MultiLibeio.cpp +5 -5
  80. data/ext/common/ResourceLocator.h +2 -6
  81. data/ext/common/ServerInstanceDir.h +37 -10
  82. data/ext/common/UnionStation.h +10 -10
  83. data/ext/common/Utils.cpp +30 -4
  84. data/ext/common/Utils.h +7 -0
  85. data/ext/common/Utils/BlockingQueue.h +2 -2
  86. data/ext/common/Utils/Lock.h +2 -2
  87. data/ext/common/Utils/MessagePassing.h +2 -2
  88. data/ext/common/Utils/Timer.h +4 -4
  89. data/ext/common/agents/HelperAgent/AgentOptions.h +2 -0
  90. data/ext/common/agents/HelperAgent/Main.cpp +57 -16
  91. data/ext/common/agents/HelperAgent/RequestHandler.h +4 -1
  92. data/ext/common/agents/LoggingAgent/AdminController.h +91 -0
  93. data/ext/common/agents/LoggingAgent/LoggingServer.h +46 -29
  94. data/ext/common/agents/LoggingAgent/Main.cpp +43 -16
  95. data/ext/common/agents/LoggingAgent/RemoteSender.h +7 -7
  96. data/ext/common/agents/Watchdog/AgentWatcher.cpp +11 -11
  97. data/ext/common/agents/Watchdog/LoggingAgentWatcher.cpp +3 -1
  98. data/ext/common/agents/Watchdog/Main.cpp +62 -0
  99. data/ext/libeio/config.guess +206 -167
  100. data/ext/libeio/config.sub +142 -68
  101. data/ext/libev/config.guess +304 -290
  102. data/ext/libev/config.sub +198 -77
  103. data/ext/nginx/config +4 -0
  104. data/ext/nginx/ngx_http_passenger_module.c +1 -0
  105. data/ext/oxt/implementation.cpp +4 -4
  106. data/lib/phusion_passenger.rb +14 -5
  107. data/lib/phusion_passenger/abstract_installer.rb +41 -0
  108. data/lib/phusion_passenger/admin_tools/server_instance.rb +48 -39
  109. data/lib/phusion_passenger/message_client.rb +31 -7
  110. data/lib/phusion_passenger/native_support.rb +35 -12
  111. data/lib/phusion_passenger/packaging.rb +16 -2
  112. data/lib/phusion_passenger/platform_info/binary_compatibility.rb +6 -31
  113. data/lib/phusion_passenger/platform_info/operating_system.rb +1 -1
  114. data/lib/phusion_passenger/preloader_shared_helpers.rb +3 -1
  115. data/lib/phusion_passenger/request_handler.rb +1 -1
  116. data/lib/phusion_passenger/standalone/command.rb +6 -6
  117. data/lib/phusion_passenger/standalone/main.rb +23 -8
  118. data/lib/phusion_passenger/standalone/package_runtime_command.rb +9 -5
  119. data/lib/phusion_passenger/standalone/runtime_installer.rb +9 -10
  120. data/lib/phusion_passenger/standalone/start_command.rb +20 -4
  121. data/resources/templates/installer_common/freebsd9_broken_cxx_runtime.txt.erb +19 -0
  122. data/resources/templates/installer_common/low_amount_of_memory_warning.txt.erb +22 -0
  123. data/resources/templates/standalone/config.erb +3 -2
  124. data/test/cxx/ApplicationPool2/DirectSpawnerTest.cpp +4 -4
  125. data/test/cxx/ApplicationPool2/PoolTest.cpp +1 -1
  126. data/test/cxx/ApplicationPool2/SmartSpawnerTest.cpp +7 -7
  127. data/test/cxx/ApplicationPool2/SpawnerTestCases.cpp +9 -9
  128. data/test/cxx/EventedBufferedInputTest.cpp +17 -17
  129. data/test/cxx/RequestHandlerTest.cpp +5 -5
  130. data/test/cxx/ServerInstanceDirTest.cpp +3 -1
  131. data/test/cxx/TestSupport.h +4 -4
  132. data/test/cxx/UnionStationTest.cpp +3 -1
  133. data/test/cxx/UtilsTest.cpp +2 -0
  134. data/test/integration_tests/apache2_tests.rb +2 -2
  135. data/test/integration_tests/native_packaging_spec.rb +170 -0
  136. data/test/ruby/spec_helper.rb +0 -1
  137. data/test/stub/apache2/httpd.conf.erb +1 -1
  138. data/test/stub/nginx/nginx.conf.erb +1 -0
  139. data/test/support/apache2_controller.rb +1 -1
  140. data/test/support/placebo-preloader.rb +1 -1
  141. data/test/support/test_helper.rb +5 -2
  142. metadata +32 -26
  143. metadata.gz.asc +7 -7
  144. data/debian/compat +0 -1
  145. data/debian/control +0 -49
  146. data/debian/copyright +0 -20
  147. data/debian/libapache2-mod-passenger.install +0 -1
  148. data/debian/passenger-common.install +0 -4
  149. data/debian/passenger.conf +0 -4
  150. data/debian/prerm +0 -2
  151. data/debian/rules +0 -37
  152. data/debian/watch +0 -3
  153. data/dev/googlecode_upload.py +0 -265
  154. data/ext/common/agents/HelperAgent/BacktracesServer.h +0 -60
  155. data/resources/templates/nginx/not_available_when_natively_packaged.txt.erb +0 -8
  156. data/test/stub/rails3.1/app/assets/javascripts/application.js +0 -9
  157. data/test/stub/rails3.2/app/assets/javascripts/application.js +0 -15
  158. data/test/stub/rails_apps/2.3/mycook/public/javascripts/application.js +0 -2
  159. data/test/stub/rails_apps/2.3/mycook/public/javascripts/controls.js +0 -963
  160. data/test/stub/rails_apps/2.3/mycook/public/javascripts/dragdrop.js +0 -973
  161. data/test/stub/rails_apps/2.3/mycook/public/javascripts/effects.js +0 -1128
  162. data/test/stub/rails_apps/2.3/mycook/public/javascripts/prototype.js +0 -4320
@@ -56,7 +56,7 @@
56
56
 
57
57
  2.9.2. Adding additional compiler or linker flags => adding-additional-compiler-or-linker-flags-wzu0ey
58
58
 
59
- 2.9.3. Forcing location of certain command line tools => forcing-location-of-certain-command-line-tools-1hym30u
59
+ 2.9.3. Forcing location of command line tools and dependencies => forcing-location-of-certain-command-line-tools-1hym30u
60
60
 
61
61
  2.10. Working with the Apache configuration file => locating-the-apache-configuration-file-1fterqv
62
62
 
@@ -114,7 +114,7 @@
114
114
 
115
115
  6.1. PassengerRoot <directory> => passengerroot-directory--sere8l
116
116
 
117
- 6.2. PassengerDefaultRuby and PassengerRuby => passengerdefaultruby-and-passengerruby-7zblp8
117
+ 6.2. PassengerDefaultRuby <filename> => passengerdefaultruby-and-passengerruby-7zblp8
118
118
 
119
119
  6.3. PassengerRuby <filename> => passengerruby-filename--1r3fv73
120
120
 
@@ -284,14 +284,24 @@
284
284
 
285
285
  9. Tips => tips-19cwwf7
286
286
 
287
- 9.1. User switching (security) => user-switching-security--8njx1x
287
+ 9.1. User Switching (security feature) => user-switching-security--8njx1x
288
288
 
289
- 9.2. Reducing memory consumption of Ruby on Rails applications by 33% => reducing-memory-consumption-of-ruby-on-rails-applications-by-33--1ubxnq0
289
+ 9.1.1. Requirements => requirements-yxvtxo
290
+
291
+ 9.1.2. Effects => effects-1lko7vo
292
+
293
+ 9.1.3. Caveats & troubleshooting => caveats-troubleshooting-161hgge
294
+
295
+ 9.1.4. Finding out what user an application is running as => finding-out-what-user-an-application-is-running-as-7uwrol
296
+
297
+ 9.2. Copy-on-write memory support (reducing memory consumption of Ruby applications) => reducing-memory-consumption-of-ruby-on-rails-applications-by-33--1ubxnq0
290
298
 
291
299
  9.3. Capistrano recipe => capistrano-recipe-syzgo7
292
300
 
293
301
  9.4. Bundler support => bundler-support-cf72ih
294
302
 
303
+ 9.4.1. Does Phusion Passenger itself need to be added to the Gemfile? => does-phusion-passenger-itself-need-to-be-added-to-the-gemfile--17whimp
304
+
295
305
  9.5. Installing multiple Ruby on Rails versions => installing-multiple-ruby-on-rails-versions-mi5j14
296
306
 
297
307
  9.6. Making the application restart after each request => making-the-application-restart-after-each-request-183bezx
@@ -300,9 +310,21 @@
300
310
 
301
311
  9.8. Out-of-Band Garbage Work and Out-of-Band Garbage Collection => out-of-band-garbage-work-and-out-of-band-garbage-collection-kav2p8
302
312
 
303
- 9.9. X-Sendfile support => x-sendfile-support-1cgyykw
313
+ 9.9. Flying Passenger => flying-passenger-q916f7
314
+
315
+ 9.9.1. Requirements => requirements-1ntkin3
316
+
317
+ 9.9.2. Basic usage => basic-usage-joifsk
318
+
319
+ 9.9.3. Configuring Flying Passenger => configuring-flying-passenger-1v35vgg
320
+
321
+ 9.9.4. Managing the Flying Passenger daemon => managing-the-flying-passenger-daemon-1bng2bu
322
+
323
+ 9.9.5. Caveats and limitations => caveats-and-limitations-lz3rbb
324
+
325
+ 9.10. X-Sendfile support => x-sendfile-support-1cgyykw
304
326
 
305
- 9.10. Upload progress => upload-progress-71cyl7
327
+ 9.11. Upload progress => upload-progress-71cyl7
306
328
 
307
329
  10. Under the hood => under-the-hood-21ue5t
308
330
 
@@ -342,3 +364,23 @@
342
364
 
343
365
  13.5. Smart spawning gotcha #3: code load order => smart-spawning-gotcha-3-code-load-order-nkotiy
344
366
 
367
+ 14. Appendix D: About environment variables => appendix-d-about-environment-variables-1lebv1u
368
+
369
+ 14.1. Working with environment variables => working-with-environment-variables-85e6aa
370
+
371
+ 14.2. The PATH environment variable => the-path-environment-variable-p8e32r
372
+
373
+ 14.3. Making environment variables permanent => making-environment-variables-permanent-13x0l4h
374
+
375
+ 14.3.1. bash => bash-1pktn63
376
+
377
+ 14.3.2. Apache => apache-15zqjvi
378
+
379
+ 14.3.3. Nginx => nginx-l7ztbb
380
+
381
+ 14.3.4. cron => cron-1kjp7ck
382
+
383
+ 14.3.5. Phusion Passenger-served apps => phusion-passenger-served-apps-478vyt
384
+
385
+ 14.4. Environment variables and sudo => environment-variables-and-sudo-1odzcpz
386
+
@@ -488,7 +488,7 @@ this option as well. Please read
488
488
  This required option may only occur once, in the global server configuration.
489
489
 
490
490
  [[PassengerDefaultRuby]]
491
- === PassengerDefaultRuby and PassengerRuby ===
491
+ === PassengerDefaultRuby <filename> ===
492
492
  :version: 4.0.0
493
493
  include::users_guide_snippets/since_version.txt[]
494
494
 
@@ -916,6 +916,7 @@ Whether to enable <<user_switching,user switching support>>.
916
916
  This option may only occur once, in the global server configuration.
917
917
  The default value is 'on'.
918
918
 
919
+ [[PassengerUser]]
919
920
  ==== PassengerUser <username> ====
920
921
  If <<user_switching,user switching support>> is enabled, then Phusion Passenger will
921
922
  by default run the web application as the owner of the file 'config/environment.rb'
@@ -931,6 +932,7 @@ This option may occur in the following places:
931
932
 
932
933
  In each place, it may be specified at most once.
933
934
 
935
+ [[PassengerGroup]]
934
936
  ==== PassengerGroup <group name> ====
935
937
  If <<user_switching,user switching support>> is enabled, then Phusion Passenger will
936
938
  by default run the web application as the primary group of the owner of the file
@@ -968,6 +970,7 @@ This option may only occur once, in the global server configuration.
968
970
  The default value is the primary group of the user specifified by
969
971
  <<PassengerDefaultUser,PassengerDefaultUser>>.
970
972
 
973
+ [[PassengerFriendlyErrorPages]]
971
974
  ==== PassengerFriendlyErrorPages <on|off> ====
972
975
  Phusion Passenger can display friendly error pages whenever an application fails
973
976
  to start. This friendly error page presents the startup error message, some
@@ -1296,6 +1299,12 @@ fix the problem in your application rather than relying on these directives as a
1296
1299
  measure to avoid freezing applications.
1297
1300
  =====================================================
1298
1301
 
1302
+ [NOTE]
1303
+ =====================================================
1304
+ This option is currently only available for Ruby apps. It is not yet available
1305
+ for Python and Node.js.
1306
+ =====================================================
1307
+
1299
1308
  [[PassengerMemoryLimit]]
1300
1309
  ==== PassengerMemoryLimit <integer> ====
1301
1310
  :version: 3.0.0
@@ -1715,6 +1724,7 @@ displaying maintenance.html will work fine even for URLs starting with "/users".
1715
1724
 
1716
1725
  === Logging and debugging options ===
1717
1726
 
1727
+ [[PassengerLogLevel]]
1718
1728
  ==== PassengerLogLevel <integer> ====
1719
1729
  This option allows one to specify how much information Phusion Passenger should
1720
1730
  write to the Apache error log file. A higher log level value means that more
@@ -2323,3 +2333,5 @@ include::users_guide_snippets/appendix_a_about.txt[]
2323
2333
  include::users_guide_snippets/appendix_b_terminology.txt[]
2324
2334
 
2325
2335
  include::users_guide_snippets/appendix_c_spawning_methods.txt[]
2336
+
2337
+ include::users_guide_snippets/environment_variables.txt[]
@@ -1059,8 +1059,8 @@ pre {
1059
1059
  <body class="article">
1060
1060
  <div id="topbar" style="display: none">
1061
1061
  <div class="title">
1062
- <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAKCAYAAAEV95QVAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sGCRMSACDxkZwAAAAidEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVAgb24gYSBNYWOHqHdDAAAAZUlEQVQY032PSxbAIAjEIlfygL6ePF3UUvpzNjgSYWwqAMEhUQnANnsC7TQPeJpsVWzMuh2sog4vDTUbqP081zECrW4dtdaQGSIKlWluPyjK+VXxAz5XfcKufCzA130AfQHWB30HZxlPaP080xsAAAAASUVORK5CYII=" width="11" height="10" alt="">
1063
- <a href="javascript:void(Mizuho.smoothlyScrollToToc())">Phusion Passenger users guide, Nginx version</a>
1062
+ <!-- Don't put a space between the img and a. That will break the hover layout. -->
1063
+ <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAKCAYAAAEV95QVAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sGCRMSACDxkZwAAAAidEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVAgb24gYSBNYWOHqHdDAAAAZUlEQVQY032PSxbAIAjEIlfygL6ePF3UUvpzNjgSYWwqAMEhUQnANnsC7TQPeJpsVWzMuh2sog4vDTUbqP081zECrW4dtdaQGSIKlWluPyjK+VXxAz5XfcKufCzA130AfQHWB30HZxlPaP080xsAAAAASUVORK5CYII=" width="11" height="10" alt=""><a href="javascript:void(Mizuho.smoothlyScrollToToc())">Phusion Passenger users guide, Nginx version</a>
1064
1064
  </div>
1065
1065
  <a href="javascript:void(0)" id="current_section"></a>
1066
1066
  </div>
@@ -1111,7 +1111,7 @@ using the command line.</p></div>
1111
1111
  <div class="foo toclevel3"><a href="#_synopsis">2.1. Synopsis</a></div>
1112
1112
  <div class="foo toclevel3"><a href="#rubygems_generic_install">2.2. Generic installation, upgrade and downgrade method: via RubyGems</a></div>
1113
1113
  <div class="foo toclevel3"><a href="#tarball_generic_install">2.3. Generic installation, upgrade and downgrade method: via tarball</a></div>
1114
- <div class="foo toclevel3"><a href="#_installing_or_upgrading_on_debian_6_or_ubuntu">2.4. Installing or upgrading on Debian 6 or Ubuntu</a></div>
1114
+ <div class="foo toclevel3"><a href="#install_on_debian_ubuntu">2.4. Installing or upgrading on Debian 6 or Ubuntu</a></div>
1115
1115
  <div class="foo toclevel3"><a href="#_installing_or_upgrading_on_red_hat_fedora_centos_or_scientificlinux">2.5. Installing or upgrading on Red Hat, Fedora, CentOS or ScientificLinux</a></div>
1116
1116
  <div class="foo toclevel3"><a href="#_upgrading_from_open_source_to_enterprise">2.6. Upgrading from open source to Enterprise</a></div>
1117
1117
  <div class="foo toclevel3"><a href="#_cryptographic_verification_of_installation_files">2.7. Cryptographic verification of installation files</a></div>
@@ -1126,7 +1126,7 @@ using the command line.</p></div>
1126
1126
  <div class="foo toclevel3"><a href="#_customizing_the_compilation_process">2.9. Customizing the compilation process</a></div>
1127
1127
  <div class="foo toclevel4"><a href="#_setting_the_compiler">2.9.1. Setting the compiler</a></div>
1128
1128
  <div class="foo toclevel4"><a href="#_adding_additional_compiler_or_linker_flags">2.9.2. Adding additional compiler or linker flags</a></div>
1129
- <div class="foo toclevel4"><a href="#_forcing_location_of_certain_command_line_tools">2.9.3. Forcing location of certain command line tools</a></div>
1129
+ <div class="foo toclevel4"><a href="#_forcing_location_of_command_line_tools_and_dependencies">2.9.3. Forcing location of command line tools and dependencies</a></div>
1130
1130
  <div class="foo toclevel3"><a href="#_installing_as_a_normal_nginx_module_without_using_the_installer">2.10. Installing as a normal Nginx module without using the installer</a></div>
1131
1131
  <div class="foo toclevel3"><a href="#nginx_init_script">2.11. Creating an Nginx init script</a></div>
1132
1132
  <div class="foo toclevel3"><a href="#_disabling_without_uninstalling">2.12. Disabling without uninstalling</a></div>
@@ -1163,48 +1163,49 @@ using the command line.</p></div>
1163
1163
  <div class="foo toclevel3"><a href="#PassengerRollingRestarts">6.6. passenger_rolling_restarts &lt;on|off&gt;</a></div>
1164
1164
  <div class="foo toclevel3"><a href="#_passenger_resist_deployment_errors_lt_on_off_gt">6.7. passenger_resist_deployment_errors &lt;on|off&gt;</a></div>
1165
1165
  <div class="foo toclevel3"><a href="#PassengerTempDir">6.8. passenger_temp_dir &lt;directory&gt;</a></div>
1166
- <div class="foo toclevel3"><a href="#_important_deployment_options">6.9. Important deployment options</a></div>
1167
- <div class="foo toclevel4"><a href="#_passenger_enabled_lt_on_off_gt">6.9.1. passenger_enabled &lt;on|off&gt;</a></div>
1168
- <div class="foo toclevel4"><a href="#PassengerBaseURI">6.9.2. passenger_base_uri &lt;uri&gt;</a></div>
1169
- <div class="foo toclevel3"><a href="#_connection_handling_options">6.10. Connection handling options</a></div>
1170
- <div class="foo toclevel4"><a href="#_passenger_ignore_client_abort_lt_on_off_gt">6.10.1. passenger_ignore_client_abort &lt;on|off&gt;</a></div>
1171
- <div class="foo toclevel4"><a href="#_passenger_set_cgi_param_lt_cgi_environment_name_gt_lt_value_gt">6.10.2. passenger_set_cgi_param &lt;CGI environment name&gt; &lt;value&gt;</a></div>
1172
- <div class="foo toclevel4"><a href="#_passenger_pass_header_lt_header_name_gt">6.10.3. passenger_pass_header &lt;header name&gt;</a></div>
1173
- <div class="foo toclevel4"><a href="#_passenger_buffer_response_lt_on_off_gt">6.10.4. passenger_buffer_response &lt;on|off&gt;</a></div>
1174
- <div class="foo toclevel4"><a href="#_passenger_buffer_size">6.10.5. passenger_buffer_size</a></div>
1175
- <div class="foo toclevel4"><a href="#_passenger_buffers">6.10.6. passenger_buffers</a></div>
1176
- <div class="foo toclevel4"><a href="#_passenger_busy_buffer_size">6.10.7. passenger_busy_buffer_size</a></div>
1177
- <div class="foo toclevel3"><a href="#_security_options">6.11. Security options</a></div>
1178
- <div class="foo toclevel4"><a href="#PassengerUserSwitching">6.11.1. passenger_user_switching &lt;on|off&gt;</a></div>
1179
- <div class="foo toclevel4"><a href="#_passenger_user_lt_username_gt">6.11.2. passenger_user &lt;username&gt;</a></div>
1180
- <div class="foo toclevel4"><a href="#_passenger_group_lt_group_name_gt">6.11.3. passenger_group &lt;group name&gt;</a></div>
1181
- <div class="foo toclevel4"><a href="#PassengerDefaultUser">6.11.4. passenger_default_user &lt;username&gt;</a></div>
1182
- <div class="foo toclevel4"><a href="#PassengerDefaultGroup">6.11.5. Passenger_default_group &lt;group name&gt;</a></div>
1183
- <div class="foo toclevel4"><a href="#_passenger_show_version_in_header_lt_on_off_gt">6.11.6. passenger_show_version_in_header &lt;on|off&gt;</a></div>
1184
- <div class="foo toclevel4"><a href="#_passenger_friendly_error_pages_lt_on_off_gt">6.11.7. passenger_friendly_error_pages &lt;on|off&gt;</a></div>
1185
- <div class="foo toclevel3"><a href="#_resource_control_and_optimization_options">6.12. Resource control and optimization options</a></div>
1186
- <div class="foo toclevel4"><a href="#PassengerMaxPoolSize">6.12.1. passenger_max_pool_size &lt;integer&gt;</a></div>
1187
- <div class="foo toclevel4"><a href="#PassengerMinInstances">6.12.2. passenger_min_instances &lt;integer&gt;</a></div>
1188
- <div class="foo toclevel4"><a href="#_passenger_max_instances_lt_integer_gt">6.12.3. passenger_max_instances &lt;integer&gt;</a></div>
1189
- <div class="foo toclevel4"><a href="#_passenger_max_instances_per_app_lt_integer_gt">6.12.4. passenger_max_instances_per_app &lt;integer&gt;</a></div>
1190
- <div class="foo toclevel4"><a href="#PassengerPoolIdleTime">6.12.5. passenger_pool_idle_time &lt;integer&gt;</a></div>
1191
- <div class="foo toclevel4"><a href="#_passenger_max_preloader_idle_time_lt_integer_gt">6.12.6. passenger_max_preloader_idle_time &lt;integer&gt;</a></div>
1192
- <div class="foo toclevel4"><a href="#PassengerConcurrencyModel">6.12.7. passenger_concurrency_model &lt;process|thread&gt;</a></div>
1193
- <div class="foo toclevel4"><a href="#PassengerThreadCount">6.12.8. passenger_thread_count &lt;number&gt;</a></div>
1194
- <div class="foo toclevel4"><a href="#PassengerMaxRequests">6.12.9. passenger_max_requests &lt;integer&gt;</a></div>
1195
- <div class="foo toclevel4"><a href="#PassengerMaxRequestTime">6.12.10. passenger_max_request_time &lt;seconds&gt;</a></div>
1196
- <div class="foo toclevel4"><a href="#PassengerMemoryLimit">6.12.11. passenger_memory_limit &lt;integer&gt;</a></div>
1197
- <div class="foo toclevel4"><a href="#PassengerPreStart">6.12.12. passenger_pre_start &lt;url&gt;</a></div>
1198
- <div class="foo toclevel3"><a href="#_logging_and_debugging_options">6.13. Logging and debugging options</a></div>
1199
- <div class="foo toclevel4"><a href="#_passenger_log_level_lt_integer_gt">6.13.1. passenger_log_level &lt;integer&gt;</a></div>
1200
- <div class="foo toclevel4"><a href="#_passenger_debug_log_file_lt_filename_gt">6.13.2. passenger_debug_log_file &lt;filename&gt;</a></div>
1201
- <div class="foo toclevel4"><a href="#_passenger_debugger_lt_on_off_gt">6.13.3. passenger_debugger &lt;on|off&gt;</a></div>
1202
- <div class="foo toclevel3"><a href="#_ruby_on_rails_specific_options">6.14. Ruby on Rails-specific options</a></div>
1203
- <div class="foo toclevel4"><a href="#RailsEnv">6.14.1. rails_env &lt;string&gt;</a></div>
1204
- <div class="foo toclevel3"><a href="#_rack_and_rails_gt_3_specific_options">6.15. Rack and Rails &gt;= 3 specific options</a></div>
1205
- <div class="foo toclevel4"><a href="#RackEnv">6.15.1. rack_env &lt;string&gt;</a></div>
1206
- <div class="foo toclevel3"><a href="#_deprecated_options">6.16. Deprecated options</a></div>
1207
- <div class="foo toclevel4"><a href="#_rails_spawn_method">6.16.1. rails_spawn_method</a></div>
1166
+ <div class="foo toclevel3"><a href="#_passenger_fly_with_lt_socket_filename_gt">6.9. passenger_fly_with &lt;socket filename&gt;</a></div>
1167
+ <div class="foo toclevel3"><a href="#_important_deployment_options">6.10. Important deployment options</a></div>
1168
+ <div class="foo toclevel4"><a href="#_passenger_enabled_lt_on_off_gt">6.10.1. passenger_enabled &lt;on|off&gt;</a></div>
1169
+ <div class="foo toclevel4"><a href="#PassengerBaseURI">6.10.2. passenger_base_uri &lt;uri&gt;</a></div>
1170
+ <div class="foo toclevel3"><a href="#_connection_handling_options">6.11. Connection handling options</a></div>
1171
+ <div class="foo toclevel4"><a href="#_passenger_ignore_client_abort_lt_on_off_gt">6.11.1. passenger_ignore_client_abort &lt;on|off&gt;</a></div>
1172
+ <div class="foo toclevel4"><a href="#_passenger_set_cgi_param_lt_cgi_environment_name_gt_lt_value_gt">6.11.2. passenger_set_cgi_param &lt;CGI environment name&gt; &lt;value&gt;</a></div>
1173
+ <div class="foo toclevel4"><a href="#_passenger_pass_header_lt_header_name_gt">6.11.3. passenger_pass_header &lt;header name&gt;</a></div>
1174
+ <div class="foo toclevel4"><a href="#_passenger_buffer_response_lt_on_off_gt">6.11.4. passenger_buffer_response &lt;on|off&gt;</a></div>
1175
+ <div class="foo toclevel4"><a href="#_passenger_buffer_size">6.11.5. passenger_buffer_size</a></div>
1176
+ <div class="foo toclevel4"><a href="#_passenger_buffers">6.11.6. passenger_buffers</a></div>
1177
+ <div class="foo toclevel4"><a href="#_passenger_busy_buffer_size">6.11.7. passenger_busy_buffer_size</a></div>
1178
+ <div class="foo toclevel3"><a href="#_security_options">6.12. Security options</a></div>
1179
+ <div class="foo toclevel4"><a href="#PassengerUserSwitching">6.12.1. passenger_user_switching &lt;on|off&gt;</a></div>
1180
+ <div class="foo toclevel4"><a href="#PassengerUser">6.12.2. passenger_user &lt;username&gt;</a></div>
1181
+ <div class="foo toclevel4"><a href="#PassengerGroup">6.12.3. passenger_group &lt;group name&gt;</a></div>
1182
+ <div class="foo toclevel4"><a href="#PassengerDefaultUser">6.12.4. passenger_default_user &lt;username&gt;</a></div>
1183
+ <div class="foo toclevel4"><a href="#PassengerDefaultGroup">6.12.5. Passenger_default_group &lt;group name&gt;</a></div>
1184
+ <div class="foo toclevel4"><a href="#_passenger_show_version_in_header_lt_on_off_gt">6.12.6. passenger_show_version_in_header &lt;on|off&gt;</a></div>
1185
+ <div class="foo toclevel4"><a href="#PassengerFriendlyErrorPages">6.12.7. passenger_friendly_error_pages &lt;on|off&gt;</a></div>
1186
+ <div class="foo toclevel3"><a href="#_resource_control_and_optimization_options">6.13. Resource control and optimization options</a></div>
1187
+ <div class="foo toclevel4"><a href="#PassengerMaxPoolSize">6.13.1. passenger_max_pool_size &lt;integer&gt;</a></div>
1188
+ <div class="foo toclevel4"><a href="#PassengerMinInstances">6.13.2. passenger_min_instances &lt;integer&gt;</a></div>
1189
+ <div class="foo toclevel4"><a href="#_passenger_max_instances_lt_integer_gt">6.13.3. passenger_max_instances &lt;integer&gt;</a></div>
1190
+ <div class="foo toclevel4"><a href="#_passenger_max_instances_per_app_lt_integer_gt">6.13.4. passenger_max_instances_per_app &lt;integer&gt;</a></div>
1191
+ <div class="foo toclevel4"><a href="#PassengerPoolIdleTime">6.13.5. passenger_pool_idle_time &lt;integer&gt;</a></div>
1192
+ <div class="foo toclevel4"><a href="#_passenger_max_preloader_idle_time_lt_integer_gt">6.13.6. passenger_max_preloader_idle_time &lt;integer&gt;</a></div>
1193
+ <div class="foo toclevel4"><a href="#PassengerConcurrencyModel">6.13.7. passenger_concurrency_model &lt;process|thread&gt;</a></div>
1194
+ <div class="foo toclevel4"><a href="#PassengerThreadCount">6.13.8. passenger_thread_count &lt;number&gt;</a></div>
1195
+ <div class="foo toclevel4"><a href="#PassengerMaxRequests">6.13.9. passenger_max_requests &lt;integer&gt;</a></div>
1196
+ <div class="foo toclevel4"><a href="#PassengerMaxRequestTime">6.13.10. passenger_max_request_time &lt;seconds&gt;</a></div>
1197
+ <div class="foo toclevel4"><a href="#PassengerMemoryLimit">6.13.11. passenger_memory_limit &lt;integer&gt;</a></div>
1198
+ <div class="foo toclevel4"><a href="#PassengerPreStart">6.13.12. passenger_pre_start &lt;url&gt;</a></div>
1199
+ <div class="foo toclevel3"><a href="#_logging_and_debugging_options">6.14. Logging and debugging options</a></div>
1200
+ <div class="foo toclevel4"><a href="#PassengerLogLevel">6.14.1. passenger_log_level &lt;integer&gt;</a></div>
1201
+ <div class="foo toclevel4"><a href="#_passenger_debug_log_file_lt_filename_gt">6.14.2. passenger_debug_log_file &lt;filename&gt;</a></div>
1202
+ <div class="foo toclevel4"><a href="#_passenger_debugger_lt_on_off_gt">6.14.3. passenger_debugger &lt;on|off&gt;</a></div>
1203
+ <div class="foo toclevel3"><a href="#_ruby_on_rails_specific_options">6.15. Ruby on Rails-specific options</a></div>
1204
+ <div class="foo toclevel4"><a href="#RailsEnv">6.15.1. rails_env &lt;string&gt;</a></div>
1205
+ <div class="foo toclevel3"><a href="#_rack_and_rails_gt_3_specific_options">6.16. Rack and Rails &gt;= 3 specific options</a></div>
1206
+ <div class="foo toclevel4"><a href="#RackEnv">6.16.1. rack_env &lt;string&gt;</a></div>
1207
+ <div class="foo toclevel3"><a href="#_deprecated_options">6.17. Deprecated options</a></div>
1208
+ <div class="foo toclevel4"><a href="#_rails_spawn_method">6.17.1. rails_spawn_method</a></div>
1208
1209
  <div class="foo toclevel2"><a href="#_analysis_and_system_maintenance">7. Analysis and system maintenance</a></div>
1209
1210
  <div class="foo toclevel3"><a href="#_inspecting_memory_usage">7.1. Inspecting memory usage</a></div>
1210
1211
  <div class="foo toclevel3"><a href="#_inspecting_phusion_passenger_8217_s_internal_status">7.2. Inspecting Phusion Passenger’s internal status</a></div>
@@ -1212,14 +1213,25 @@ using the command line.</p></div>
1212
1213
  <div class="foo toclevel3"><a href="#_accessing_individual_application_processes">7.4. Accessing individual application processes</a></div>
1213
1214
  <div class="foo toclevel3"><a href="#_attaching_an_irb_console_to_an_application_process">7.5. Attaching an IRB console to an application process</a></div>
1214
1215
  <div class="foo toclevel2"><a href="#_tips">8. Tips</a></div>
1215
- <div class="foo toclevel3"><a href="#user_switching">8.1. User switching (security)</a></div>
1216
- <div class="foo toclevel3"><a href="#reducing_memory_usage">8.2. Reducing memory consumption of Ruby on Rails applications by 33%</a></div>
1216
+ <div class="foo toclevel3"><a href="#user_switching">8.1. User Switching (security feature)</a></div>
1217
+ <div class="foo toclevel4"><a href="#_requirements">8.1.1. Requirements</a></div>
1218
+ <div class="foo toclevel4"><a href="#_effects">8.1.2. Effects</a></div>
1219
+ <div class="foo toclevel4"><a href="#_caveats_amp_troubleshooting">8.1.3. Caveats &amp; troubleshooting</a></div>
1220
+ <div class="foo toclevel4"><a href="#finding_out_app_user">8.1.4. Finding out what user an application is running as</a></div>
1221
+ <div class="foo toclevel3"><a href="#reducing_memory_usage">8.2. Copy-on-write memory support (reducing memory consumption of Ruby applications)</a></div>
1217
1222
  <div class="foo toclevel3"><a href="#capistrano">8.3. Capistrano recipe</a></div>
1218
1223
  <div class="foo toclevel3"><a href="#bundler_support">8.4. Bundler support</a></div>
1224
+ <div class="foo toclevel4"><a href="#add_passenger_to_gemfile">8.4.1. Does Phusion Passenger itself need to be added to the Gemfile?</a></div>
1219
1225
  <div class="foo toclevel3"><a href="#_installing_multiple_ruby_on_rails_versions">8.5. Installing multiple Ruby on Rails versions</a></div>
1220
1226
  <div class="foo toclevel3"><a href="#_making_the_application_restart_after_each_request">8.6. Making the application restart after each request</a></div>
1221
1227
  <div class="foo toclevel3"><a href="#sub_uri_deployment_uri_fix">8.7. How to fix broken images/CSS/JavaScript URIs in sub-URI deployments</a></div>
1222
1228
  <div class="foo toclevel3"><a href="#_out_of_band_garbage_work_and_out_of_band_garbage_collection">8.8. Out-of-Band Garbage Work and Out-of-Band Garbage Collection</a></div>
1229
+ <div class="foo toclevel3"><a href="#flying_passenger">8.9. Flying Passenger</a></div>
1230
+ <div class="foo toclevel4"><a href="#_requirements_2">8.9.1. Requirements</a></div>
1231
+ <div class="foo toclevel4"><a href="#_basic_usage">8.9.2. Basic usage</a></div>
1232
+ <div class="foo toclevel4"><a href="#configuring_flying_passenger">8.9.3. Configuring Flying Passenger</a></div>
1233
+ <div class="foo toclevel4"><a href="#_managing_the_flying_passenger_daemon">8.9.4. Managing the Flying Passenger daemon</a></div>
1234
+ <div class="foo toclevel4"><a href="#flying_passenger_caveats">8.9.5. Caveats and limitations</a></div>
1223
1235
  <div class="foo toclevel2"><a href="#_under_the_hood">9. Under the hood</a></div>
1224
1236
  <div class="foo toclevel3"><a href="#_page_caching_support">9.1. Page caching support</a></div>
1225
1237
  <div class="foo toclevel3"><a href="#application_detection">9.2. How Phusion Passenger detects whether a virtual host is a web application</a></div>
@@ -1238,6 +1250,16 @@ using the command line.</p></div>
1238
1250
  <div class="foo toclevel4"><a href="#_example_2_log_file_sharing_not_harmful">12.3.2. Example 2: Log file sharing (not harmful)</a></div>
1239
1251
  <div class="foo toclevel3"><a href="#_smart_spawning_gotcha_2_the_need_to_revive_threads">12.4. Smart spawning gotcha #2: the need to revive threads</a></div>
1240
1252
  <div class="foo toclevel3"><a href="#_smart_spawning_gotcha_3_code_load_order">12.5. Smart spawning gotcha #3: code load order</a></div>
1253
+ <div class="foo toclevel2"><a href="#about_environment_variables">13. Appendix D: About environment variables</a></div>
1254
+ <div class="foo toclevel3"><a href="#_working_with_environment_variables">13.1. Working with environment variables</a></div>
1255
+ <div class="foo toclevel3"><a href="#_the_path_environment_variable">13.2. The PATH environment variable</a></div>
1256
+ <div class="foo toclevel3"><a href="#_making_environment_variables_permanent">13.3. Making environment variables permanent</a></div>
1257
+ <div class="foo toclevel4"><a href="#_bash">13.3.1. bash</a></div>
1258
+ <div class="foo toclevel4"><a href="#_apache">13.3.2. Apache</a></div>
1259
+ <div class="foo toclevel4"><a href="#_nginx">13.3.3. Nginx</a></div>
1260
+ <div class="foo toclevel4"><a href="#_cron">13.3.4. cron</a></div>
1261
+ <div class="foo toclevel4"><a href="#env_vars_passenger_apps">13.3.5. Phusion Passenger-served apps</a></div>
1262
+ <div class="foo toclevel3"><a href="#env_vars_and_sudo">13.4. Environment variables and sudo</a></div>
1241
1263
  </div>
1242
1264
  </div>
1243
1265
  <div id="content">
@@ -1264,14 +1286,14 @@ if it doesn’t work on your POSIX-compliant operating system.</p></div>
1264
1286
  <div class="ulist"><ul>
1265
1287
  <li>
1266
1288
  <p>
1267
- <a href="http://code.google.com/p/phusion-passenger/issues/list">Issue tracker</a> - report
1268
- bugs here.
1289
+ <a href="http://groups.google.com/group/phusion-passenger">Discussion forum</a> - post a
1290
+ message here if you’re experiencing problems. Support on this forum is provided by the community on a best-effort basis, so a (timely) response is not guaranteed.
1269
1291
  </p>
1270
1292
  </li>
1271
1293
  <li>
1272
1294
  <p>
1273
- <a href="http://groups.google.com/group/phusion-passenger">Discussion forum</a> - post a
1274
- message here if you’re experiencing problems. Support on this forum is provided by the community on a best-effort basis, so a (timely) response is not guaranteed.
1295
+ <a href="http://code.google.com/p/phusion-passenger/issues/list">Issue tracker</a> - report
1296
+ bugs here.
1275
1297
  </p>
1276
1298
  </li>
1277
1299
  <li>
@@ -1286,7 +1308,7 @@ Email <a href="mailto:support@phusion.nl">support@phusion.nl</a> if you are a <a
1286
1308
  </li>
1287
1309
  <li>
1288
1310
  <p>
1289
- Report security vulnerabilities to <a href="mailto:support@phusion.nl">support@phusion.nl</a>. We will do our best to respond to you as quickly as we can, so please do not disclose the vulnerability until then.
1311
+ Report security vulnerabilities to <a href="mailto:security@phusion.nl">security@phusion.nl</a>. We will do our best to respond to you as quickly as we can, so please do not disclose the vulnerability until then.
1290
1312
  </p>
1291
1313
  </li>
1292
1314
  </ul></div>
@@ -1455,7 +1477,21 @@ If you installed the existing Nginx through YUM, run <span class="monospaced">yu
1455
1477
  </div>
1456
1478
  </div>
1457
1479
  <div class="paragraph"><p>At some point it will ask you which prefix to install Nginx to. If you’re upgrading, then specify the same prefix that you used last time, as well as the same configuration parameters that you used last time.</p></div>
1458
- <span class="anchor_helper" id="verify_passenger_running"></span><h4 class="float" data-anchor="verify_passenger_running">Step 6: Verifying that Phusion Passenger is running</h4>
1480
+ <span class="anchor_helper" id="_step_6_restarting_the_flying_passenger_daemon"></span><h4 class="float" data-anchor="_step_6_restarting_the_flying_passenger_daemon">Step 6: Restarting the Flying Passenger daemon</h4>
1481
+ <div class="paragraph"><p>If you are using <a href="#flying_passenger">Flying Passenger</a> then you must restart the Flying Passenger daemon by sending it the SIGTERM signal:</p></div>
1482
+ <div class="listingblock">
1483
+ <div class="content monospaced">
1484
+ <pre>kill `cat /path-to/flying-passenger.pid`</pre>
1485
+ </div>
1486
+ </div>
1487
+ <div class="paragraph"><p>Or, if Flying Passenger is not running with a PID file, look up its PID us <span class="monospaced">ps</span> and then send it SIGTERM:</p></div>
1488
+ <div class="listingblock">
1489
+ <div class="content monospaced">
1490
+ <pre>ps auxw | grep flying-passenger
1491
+ kill PID_OF_FLYING_PASSENGER</pre>
1492
+ </div>
1493
+ </div>
1494
+ <span class="anchor_helper" id="verify_passenger_running"></span><h4 class="float" data-anchor="verify_passenger_running">Step 7: Verifying that Phusion Passenger is running</h4>
1459
1495
  <div class="paragraph"><p>Restart your web server and run:</p></div>
1460
1496
  <div class="listingblock">
1461
1497
  <div class="content monospaced">
@@ -1469,24 +1505,7 @@ At this point you may be interested in <a href="#nginx_init_script">creating an
1469
1505
  <div class="sect2">
1470
1506
  <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="tarball_generic_install"></span><h3 data-comment-topic="generic-installation-upgrade-and-downgrade-method-via-tarball-2gkx43" data-anchor="tarball_generic_install">2.3. Generic installation, upgrade and downgrade method: via tarball</h3>
1471
1507
  <span class="anchor_helper" id="_step_1_download_and_extract_the_tarball"></span><h4 class="float" data-anchor="_step_1_download_and_extract_the_tarball">Step 1: download and extract the tarball</h4>
1472
- <div class="paragraph"><p>Download the open source Phusion Passenger tarball from <a href="https://www.phusionpassenger.com/download#open_source">the Phusion Passenger website</a>. Specific older versions are not found on the Phusion Passenger website, but are found in the following places:</p></div>
1473
- <div class="ulist"><ul>
1474
- <li>
1475
- <p>
1476
- All versions starting from 4.0.0 can be found on <a href="https://code.google.com/p/phusion-passenger/downloads/list">Google Code</a>.
1477
- </p>
1478
- </li>
1479
- <li>
1480
- <p>
1481
- All versions prior to 4.0.0, except for beta releases and Release Candidates, can be found on <a href="http://rubyforge.org/frs/?group_id=5873&amp;release_id=46919">RubyForge</a>.
1482
- </p>
1483
- </li>
1484
- <li>
1485
- <p>
1486
- All beta releases and Release Candidates prior to 4.0.0 beta 1 can be found on <a href="https://code.google.com/p/phusion-passenger/downloads/list">Google Code</a>.
1487
- </p>
1488
- </li>
1489
- </ul></div>
1508
+ <div class="paragraph"><p>Download the open source Phusion Passenger tarball from <a href="https://www.phusionpassenger.com/download#open_source">the Phusion Passenger website</a>. Older versions can be found on <a href="https://www.phusionpassenger.com/file_releases">the release archive</a>.</p></div>
1490
1509
  <div class="paragraph"><p>If you a <a href="https://www.phusionpassenger.com/enterprise">Phusion Passenger Enterprise</a> customer, download the Phusion Passenger Enterprise tarball from the <a href="https://www.phusionpassenger.com/orders">Customer Area</a>. Also be sure to download the <strong>license key</strong> and save it as <em>/etc/passenger-enterprise-license</em>.</p></div>
1491
1510
  <div class="paragraph"><p>Once you have downloaded the tarball, pick a location to extract it to. You can pick any location. A good location is <em>/opt/passenger</em>. Let’s call this location <span class="monospaced">$PREFIX</span>. Create this directory and extract the tarball as follows:</p></div>
1492
1511
  <div class="listingblock">
@@ -1579,11 +1598,25 @@ sudo apt-get update</pre>
1579
1598
  <span class="anchor_helper" id="_step_5_run_the_phusion_passenger_installer"></span><h4 class="float" data-anchor="_step_5_run_the_phusion_passenger_installer">Step 5: run the Phusion Passenger installer</h4>
1580
1599
  <div class="paragraph"><p>Please refer to <a href="#run_passenger_installer">this section</a>.
1581
1600
  Note that the <span class="monospaced">passenger-install-nginx-module</span> command is inside the <em>bin</em> subdirectory of the Phusion Passenger source directory, so you would have to run something like <em>/opt/passenger/passenger-x.x.x/bin/passenger-install-nginx-module</em>.</p></div>
1582
- <span class="anchor_helper" id="_step_6_verifying_that_phusion_passenger_is_running"></span><h4 class="float" data-anchor="_step_6_verifying_that_phusion_passenger_is_running">Step 6: Verifying that Phusion Passenger is running</h4>
1601
+ <span class="anchor_helper" id="_step_6_restarting_the_flying_passenger_daemon_2"></span><h4 class="float" data-anchor="_step_6_restarting_the_flying_passenger_daemon_2">Step 6: Restarting the Flying Passenger daemon</h4>
1602
+ <div class="paragraph"><p>If you are using <a href="#flying_passenger">Flying Passenger</a> then you must restart the Flying Passenger daemon by sending it the SIGTERM signal:</p></div>
1603
+ <div class="listingblock">
1604
+ <div class="content monospaced">
1605
+ <pre>kill `cat /path-to/flying-passenger.pid`</pre>
1606
+ </div>
1607
+ </div>
1608
+ <div class="paragraph"><p>Or, if Flying Passenger is not running with a PID file, look up its PID us <span class="monospaced">ps</span> and then send it SIGTERM:</p></div>
1609
+ <div class="listingblock">
1610
+ <div class="content monospaced">
1611
+ <pre>ps auxw | grep flying-passenger
1612
+ kill PID_OF_FLYING_PASSENGER</pre>
1613
+ </div>
1614
+ </div>
1615
+ <span class="anchor_helper" id="_step_7_verifying_that_phusion_passenger_is_running"></span><h4 class="float" data-anchor="_step_7_verifying_that_phusion_passenger_is_running">Step 7: Verifying that Phusion Passenger is running</h4>
1583
1616
  <div class="paragraph"><p>Please refer to <a href="#verify_passenger_running">this section</a>. Note that all Phusion Passenger administration scripts are located inside the <em>bin</em> subdirectory of the Phusion Passenger source directory, so you would have to run something like <em>/opt/passenger/passenger-x.x.x/bin/passenger-memory-stats</em>.</p></div>
1584
1617
  </div>
1585
1618
  <div class="sect2">
1586
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_installing_or_upgrading_on_debian_6_or_ubuntu"></span><h3 data-comment-topic="installing-or-upgrading-on-ubuntu-fw5fvp" data-anchor="_installing_or_upgrading_on_debian_6_or_ubuntu">2.4. Installing or upgrading on Debian 6 or Ubuntu</h3>
1619
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="install_on_debian_ubuntu"></span><h3 data-comment-topic="installing-or-upgrading-on-ubuntu-fw5fvp" data-anchor="install_on_debian_ubuntu">2.4. Installing or upgrading on Debian 6 or Ubuntu</h3>
1587
1620
  <div class="paragraph"><p>John Leach from Brightbox has kindly provided Ubuntu packages for Phusion Passenger. The Ubuntu Lucid packages are compatible with Debian 6. The packages are available from the <a href="http://wiki.brightbox.co.uk/docs:phusion-passenger">Brightbox repository</a>. Only packages for the open source version of Phusion Passenger are provided. <a href="https://www.phusionpassenger.com/enterprise">Phusion Passenger Enterprise</a> customers should use the <a href="#rubygems_generic_install">generic RubyGems installation method</a> or <a href="#tarball_generic_install">the generic tarball installation method</a> instead.</p></div>
1588
1621
  <div class="paragraph"><p>If you use these packages to install Phusion Passenger then you do not need to run <span class="monospaced">passenger-install-apache2-module</span> or <span class="monospaced">passenger-install-nginx-module</span>. These packages contain all the binaries that you need.</p></div>
1589
1622
  <div class="paragraph">
@@ -1592,7 +1625,7 @@ Note that the <span class="monospaced">passenger-install-nginx-module</span> com
1592
1625
  </div>
1593
1626
  <div class="listingblock">
1594
1627
  <div class="content monospaced">
1595
- <pre>sudo apt-add-repository ppa:brightbox/passenger
1628
+ <pre>sudo apt-add-repository ppa:brightbox/passenger-experimental
1596
1629
  sudo apt-get update</pre>
1597
1630
  </div>
1598
1631
  </div>
@@ -1600,7 +1633,7 @@ sudo apt-get update</pre>
1600
1633
  <div class="paragraph"><p>Debian 6:</p></div>
1601
1634
  <div class="listingblock">
1602
1635
  <div class="content monospaced">
1603
- <pre>sudo sh -c 'echo "deb http://ppa.launchpad.net/brightbox/passenger/ubuntu lucid main" &gt; /etc/apt/sources.list.d/brightbox-passenger.list'
1636
+ <pre>sudo sh -c 'echo "deb http://ppa.launchpad.net/brightbox/passenger-experimental/ubuntu lucid main" &gt; /etc/apt/sources.list.d/brightbox-passenger.list'
1604
1637
  sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C3173AA6
1605
1638
  sudo apt-get update</pre>
1606
1639
  </div>
@@ -1608,7 +1641,7 @@ sudo apt-get update</pre>
1608
1641
  <div class="paragraph"><p>Ubuntu 8.04 Hardy:</p></div>
1609
1642
  <div class="listingblock">
1610
1643
  <div class="content monospaced">
1611
- <pre>sudo sh -c 'echo "deb http://ppa.launchpad.net/brightbox/passenger/ubuntu hardy main" &gt; /etc/apt/sources.list.d/brightbox-passenger.list'
1644
+ <pre>sudo sh -c 'echo "deb http://ppa.launchpad.net/brightbox/passenger-experimental/ubuntu hardy main" &gt; /etc/apt/sources.list.d/brightbox-passenger.list'
1612
1645
  sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C3173AA6
1613
1646
  sudo apt-get update</pre>
1614
1647
  </div>
@@ -1626,7 +1659,7 @@ sudo apt-get update</pre>
1626
1659
  </div>
1627
1660
  <div class="listingblock">
1628
1661
  <div class="content monospaced">
1629
- <pre>sudo apt-add-repository ppa:brightbox/passenger-nginx
1662
+ <pre>sudo apt-add-repository ppa:brightbox/passenger-experimental
1630
1663
  sudo apt-get update</pre>
1631
1664
  </div>
1632
1665
  </div>
@@ -1634,7 +1667,7 @@ sudo apt-get update</pre>
1634
1667
  <div class="paragraph"><p>Debian 6:</p></div>
1635
1668
  <div class="listingblock">
1636
1669
  <div class="content monospaced">
1637
- <pre>sudo sh -c 'echo "deb http://ppa.launchpad.net/brightbox/passenger-nginx/ubuntu lucid main" &gt; /etc/apt/sources.list.d/brightbox-passenger-nginx.list'
1670
+ <pre>sudo sh -c 'echo "deb http://ppa.launchpad.net/brightbox/passenger-experimental/ubuntu lucid main" &gt; /etc/apt/sources.list.d/brightbox-passenger-nginx.list'
1638
1671
  sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C3173AA6
1639
1672
  sudo apt-get update</pre>
1640
1673
  </div>
@@ -1642,7 +1675,7 @@ sudo apt-get update</pre>
1642
1675
  <div class="paragraph"><p>Ubuntu 8.04 Hardy:</p></div>
1643
1676
  <div class="listingblock">
1644
1677
  <div class="content monospaced">
1645
- <pre>sudo sh -c 'echo "deb http://ppa.launchpad.net/brightbox/passenger/ubuntu hardy main" &gt; /etc/apt/sources.list.d/brightbox-passenger-nginx.list'
1678
+ <pre>sudo sh -c 'echo "deb http://ppa.launchpad.net/brightbox/passenger-experimental/ubuntu hardy main" &gt; /etc/apt/sources.list.d/brightbox-passenger-nginx.list'
1646
1679
  sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C3173AA6
1647
1680
  sudo apt-get update</pre>
1648
1681
  </div>
@@ -1867,16 +1900,29 @@ gpg --refresh-keys --keyserver keyserver.ubuntu.com</pre>
1867
1900
  </div>
1868
1901
  <div class="sect2">
1869
1902
  <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_customizing_the_compilation_process"></span><h3 data-comment-topic="customizing-the-compilation-process-u4cdcf" data-anchor="_customizing_the_compilation_process">2.9. Customizing the compilation process</h3>
1903
+ <div class="paragraph"><p>The Phusion Passenger compilation process can be customized with environment variables. You can learn more about environment variables in <a href="#about_environment_variables">About environment variables</a>.</p></div>
1870
1904
  <div class="sect3">
1871
1905
  <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_setting_the_compiler"></span><h4 data-comment-topic="setting-the-compiler-1l6dpe1" data-anchor="_setting_the_compiler">2.9.1. Setting the compiler</h4>
1872
1906
  <div class="paragraph"><p>You can force the Phusion Passenger build system to use a specific C or C++ compiler by setting the <span class="monospaced">CC</span> and <span class="monospaced">CXX</span> environment variables. These may be set to any arbitrary shell commands.</p></div>
1873
1907
  <div class="paragraph"><p>For example, contributors who want to hack on Phusion Passenger may want to use Clang for faster compilation and <a href="http://ccache.samba.org/">ccache</a> for faster recompilation, and may want to enable more error-catching compilation flags:</p></div>
1874
1908
  <div class="listingblock">
1875
- <div class="content monospaced">
1876
- <pre>export CC='ccache clang -fcolor-diagnostics -Qunused-arguments -fcatch-undefined-behavior -ftrapv'
1877
- export CXX='ccache clang++ -fcolor-diagnostics -Qunused-arguments -fcatch-undefined-behavior -ftrapv'</pre>
1909
+ <div class="content">
1910
+ <!-- Generator: GNU source-highlight 2.11.1
1911
+ by Lorenzo Bettini
1912
+ http://www.lorenzobettini.it
1913
+ http://www.gnu.org/software/src-highlite -->
1914
+ <pre><tt><span style="font-weight: bold"><span style="color: #0000FF">export</span></span> <span style="color: #009900">CC</span><span style="color: #990000">=</span><span style="color: #FF0000">'ccache clang -fcolor-diagnostics -Qunused-arguments -fcatch-undefined-behavior -ftrapv'</span>
1915
+ <span style="font-weight: bold"><span style="color: #0000FF">export</span></span> <span style="color: #009900">CXX</span><span style="color: #990000">=</span><span style="color: #FF0000">'ccache clang++ -fcolor-diagnostics -Qunused-arguments -fcatch-undefined-behavior -ftrapv'</span></tt></pre>
1878
1916
  </div>
1879
1917
  </div>
1918
+ <div class="admonitionblock">
1919
+ <table><tr>
1920
+ <td class="icon">
1921
+ <img src="./images/icons/note.png" alt="Note">
1922
+ </td>
1923
+ <td class="content">If you run the installer with <span class="monospaced">sudo</span> then environment variables may not be passed properly. Learn more at <a href="#env_vars_and_sudo">Environment variables and sudo</a>.</td>
1924
+ </tr></table>
1925
+ </div>
1880
1926
  </div>
1881
1927
  <div class="sect3">
1882
1928
  <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_adding_additional_compiler_or_linker_flags"></span><h4 data-comment-topic="adding-additional-compiler-or-linker-flags-1jehjon" data-anchor="_adding_additional_compiler_or_linker_flags">2.9.2. Adding additional compiler or linker flags</h4>
@@ -1931,11 +1977,19 @@ export CXX='ccache clang++ -fcolor-diagnostics -Qunused-arguments -fcatch-undefi
1931
1977
  </p>
1932
1978
  </dd>
1933
1979
  </dl></div>
1980
+ <div class="admonitionblock">
1981
+ <table><tr>
1982
+ <td class="icon">
1983
+ <img src="./images/icons/note.png" alt="Note">
1984
+ </td>
1985
+ <td class="content">If you run the installer with <span class="monospaced">sudo</span> then environment variables may not be passed properly. Learn more at <a href="#env_vars_and_sudo">Environment variables and sudo</a>.</td>
1986
+ </tr></table>
1987
+ </div>
1934
1988
  </div>
1935
1989
  <div class="sect3">
1936
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_forcing_location_of_certain_command_line_tools"></span><h4 data-comment-topic="forcing-location-of-certain-command-line-tools-1j93cki" data-anchor="_forcing_location_of_certain_command_line_tools">2.9.3. Forcing location of certain command line tools</h4>
1990
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_forcing_location_of_command_line_tools_and_dependencies"></span><h4 data-comment-topic="forcing-location-of-certain-command-line-tools-1j93cki" data-anchor="_forcing_location_of_command_line_tools_and_dependencies">2.9.3. Forcing location of command line tools and dependencies</h4>
1937
1991
  <div class="paragraph"><p>The Phusion Passenger build system attempts to autodetect many things by locating relevant helper tools. For example, to find out which compiler flags it should use for compiling Apache modules, it locates the <span class="monospaced">apxs2</span> command and queries it. To find out which compiler flags it should use for libcurl, it queries the <span class="monospaced">curl-config</span> command. These commands may not be in <span class="monospaced">$PATH</span>, or even when they are you may want to use a different one.</p></div>
1938
- <div class="paragraph"><p>You can often force the build to find certain command line tools at certain locations by using the following environment variables:</p></div>
1992
+ <div class="paragraph"><p>You can force the build to find certain command line tools at certain locations by using the following environment variables:</p></div>
1939
1993
  <div class="dlist"><dl>
1940
1994
  <dt class="hdlist1">
1941
1995
  <span class="monospaced">HTTPD</span>
@@ -1950,8 +2004,18 @@ export CXX='ccache clang++ -fcolor-diagnostics -Qunused-arguments -fcatch-undefi
1950
2004
  </dt>
1951
2005
  <dd>
1952
2006
  <p>
1953
- The location of the <span class="monospaced">apxs2</span> executable (the Apache module developer tool).
2007
+ The location of the <span class="monospaced">apxs2</span> executable (the Apache module developer tool). Only used by <span class="monospaced">passenger-install-apache2-module</span>.
1954
2008
  </p>
2009
+ <div class="paragraph"><p>This environment variable, together with <span class="monospaced">HTTPD</span>, are what you need to customize if you have multiple Apache installations on your system, or if your Apache is located in a non-standard location which Phusion Passenger cannot detect. By setting <span class="monospaced">APXS2</span> and <span class="monospaced">HTTP</span> to the right paths, you can force Phusion Passenger to be compiled against that specific Apache installation.</p></div>
2010
+ <div class="paragraph"><p>For example, if your Apache installation is located in <span class="monospaced">/opt/lamp/apache2</span>, then you can run the installer as follows:</p></div>
2011
+ <div class="listingblock">
2012
+ <div class="content monospaced">
2013
+ <pre>$ sudo bash
2014
+ # export HTTPD=/opt/lampp/apache2/bin/apache
2015
+ # export APXS2=/opt/lampp/apache2/bin/apxs
2016
+ # passenger-install-apache2-module</pre>
2017
+ </div>
2018
+ </div>
1955
2019
  </dd>
1956
2020
  <dt class="hdlist1">
1957
2021
  <span class="monospaced">APR_CONFIG</span>
@@ -1986,6 +2050,14 @@ export CXX='ccache clang++ -fcolor-diagnostics -Qunused-arguments -fcatch-undefi
1986
2050
  </p>
1987
2051
  </dd>
1988
2052
  </dl></div>
2053
+ <div class="admonitionblock">
2054
+ <table><tr>
2055
+ <td class="icon">
2056
+ <img src="./images/icons/note.png" alt="Note">
2057
+ </td>
2058
+ <td class="content">If you run the installer with <span class="monospaced">sudo</span> then environment variables may not be passed properly. Learn more at <a href="#env_vars_and_sudo">Environment variables and sudo</a>.</td>
2059
+ </tr></table>
2060
+ </div>
1989
2061
  </div>
1990
2062
  </div>
1991
2063
  <div class="sect2">
@@ -2099,7 +2171,7 @@ done this, you need to remove the Phusion Passenger files.</p></div>
2099
2171
  <div class="ulist"><ul>
2100
2172
  <li>
2101
2173
  <p>
2102
- If you installed Phusion Passenger via a Ruby gem, then run <span class="monospaced">gem uninstall passenger</span> (or, if you’re an <a href="https://www.phusionpassenger.com/enterprise">Phusion Passenger Enterprise</a> user, <span class="monospaced">gem uninstall passenger-enterprise-server</span>).
2174
+ If you installed Phusion Passenger via a Ruby gem, then run <span class="monospaced">gem uninstall passenger</span> (or, if you’re a <a href="https://www.phusionpassenger.com/enterprise">Phusion Passenger Enterprise</a> user, <span class="monospaced">gem uninstall passenger-enterprise-server</span>).
2103
2175
  You <a href="#is_ruby_home_or_system_wide_installed">might have to run this as root</a>.
2104
2176
  </p>
2105
2177
  </li>
@@ -2745,6 +2817,14 @@ data files. The correct value is given by the installer.</p></div>
2745
2817
  this option as well. Please read
2746
2818
  <a href="#moving_phusion_passenger">Moving Phusion Passenger to a different directory</a> for more information.</p></div>
2747
2819
  <div class="paragraph"><p>This required option may only occur once, in the <em>http</em> configuration block.</p></div>
2820
+ <div class="admonitionblock">
2821
+ <table><tr>
2822
+ <td class="icon">
2823
+ <img src="./images/icons/note.png" alt="Note">
2824
+ </td>
2825
+ <td class="content">This option has no effect when you are using <a href="#flying_passenger">Flying Passenger</a>.</td>
2826
+ </tr></table>
2827
+ </div>
2748
2828
  </div>
2749
2829
  <div class="sect2">
2750
2830
  <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerRuby"></span><h3 data-comment-topic="passenger-ruby-filename--1gnok5k" data-anchor="PassengerRuby">6.2. passenger_ruby &lt;filename&gt;</h3>
@@ -3172,11 +3252,25 @@ sudo -E passenger-status
3172
3252
  # The -E option tells 'sudo' to preserve environment variables.</pre>
3173
3253
  </div>
3174
3254
  </div>
3255
+ <div class="admonitionblock">
3256
+ <table><tr>
3257
+ <td class="icon">
3258
+ <img src="./images/icons/note.png" alt="Note">
3259
+ </td>
3260
+ <td class="content">This option has no effect when you are using <a href="#flying_passenger">Flying Passenger</a>. Instead, you should configure this by passing the <span class="monospaced">--temp-dir</span> command line option to the Flying Passenger daemon.</td>
3261
+ </tr></table>
3262
+ </div>
3263
+ </div>
3264
+ <div class="sect2">
3265
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_fly_with_lt_socket_filename_gt"></span><h3 data-comment-topic="passenger-fly-with-socket-filename--1amd1xn" data-anchor="_passenger_fly_with_lt_socket_filename_gt">6.9. passenger_fly_with &lt;socket filename&gt;</h3>
3266
+ <div class="paragraph"><p><strong>This feature is only available in <a href="https://www.phusionpassenger.com/enterprise">Phusion Passenger Enterprise</a>. It was introduced in version 4.1.0. <a href="https://www.phusionpassenger.com/download">Buy Phusion Passenger Enterprise here.</a></strong></p></div>
3267
+ <div class="paragraph"><p>Enables <a href="#flying_passenger">Flying Passenger</a> mode, and configures Nginx to connect to the Flying Passenger daemon that’s listening on the given socket filename.</p></div>
3268
+ <div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration block. When not set, Flying Passenger is not enabled.</p></div>
3175
3269
  </div>
3176
3270
  <div class="sect2">
3177
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_important_deployment_options"></span><h3 data-comment-topic="important-deployment-options-av567" data-anchor="_important_deployment_options">6.9. Important deployment options</h3>
3271
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_important_deployment_options"></span><h3 data-comment-topic="important-deployment-options-av567" data-anchor="_important_deployment_options">6.10. Important deployment options</h3>
3178
3272
  <div class="sect3">
3179
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_enabled_lt_on_off_gt"></span><h4 data-comment-topic="passenger-enabled-on-off--1rpb2t7" data-anchor="_passenger_enabled_lt_on_off_gt">6.9.1. passenger_enabled &lt;on|off&gt;</h4>
3273
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_enabled_lt_on_off_gt"></span><h4 data-comment-topic="passenger-enabled-on-off--1rpb2t7" data-anchor="_passenger_enabled_lt_on_off_gt">6.10.1. passenger_enabled &lt;on|off&gt;</h4>
3180
3274
  <div class="paragraph"><p>This option may be specified in the <em>http</em> configuration block, a
3181
3275
  <em>server</em> configuration block, a <em>location</em> configuration block or
3182
3276
  an <em>if</em> configuration scope, to enable or disable Phusion Passenger
@@ -3188,7 +3282,7 @@ and <a href="#deploying_a_rack_app">Deploying a Rack-based Ruby application</a>
3188
3282
  for examples.</p></div>
3189
3283
  </div>
3190
3284
  <div class="sect3">
3191
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerBaseURI"></span><h4 data-comment-topic="passenger-base-uri-uri--1xtuo50" data-anchor="PassengerBaseURI">6.9.2. passenger_base_uri &lt;uri&gt;</h4>
3285
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerBaseURI"></span><h4 data-comment-topic="passenger-base-uri-uri--1xtuo50" data-anchor="PassengerBaseURI">6.10.2. passenger_base_uri &lt;uri&gt;</h4>
3192
3286
  <div class="paragraph"><p>Used to specify that the given URI is an distinct application that should
3193
3287
  be served by Phusion Passenger. This option can be used for both Rails and
3194
3288
  Rack applications. See <a href="#deploying_rails_to_sub_uri">Deploying Rails to a sub URI</a>
@@ -3221,9 +3315,9 @@ In an <em>if</em> configuration scope.
3221
3315
  </div>
3222
3316
  </div>
3223
3317
  <div class="sect2">
3224
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_connection_handling_options"></span><h3 data-comment-topic="connection-handling-options-8jgq90" data-anchor="_connection_handling_options">6.10. Connection handling options</h3>
3318
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_connection_handling_options"></span><h3 data-comment-topic="connection-handling-options-8jgq90" data-anchor="_connection_handling_options">6.11. Connection handling options</h3>
3225
3319
  <div class="sect3">
3226
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_ignore_client_abort_lt_on_off_gt"></span><h4 data-comment-topic="passenger-ignore-client-abort" data-anchor="_passenger_ignore_client_abort_lt_on_off_gt">6.10.1. passenger_ignore_client_abort &lt;on|off&gt;</h4>
3320
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_ignore_client_abort_lt_on_off_gt"></span><h4 data-comment-topic="passenger-ignore-client-abort" data-anchor="_passenger_ignore_client_abort_lt_on_off_gt">6.11.1. passenger_ignore_client_abort &lt;on|off&gt;</h4>
3227
3321
  <div class="paragraph"><p>Normally, when the HTTP client aborts the connection (e.g. when the user clicked on "Stop"
3228
3322
  in the browser), the connection with the application process will be closed too. If the
3229
3323
  application process continues to send its response, then that will result in EPIPE errors
@@ -3259,7 +3353,7 @@ In an <em>if</em> configuration scope.
3259
3353
  <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>off</em>.</p></div>
3260
3354
  </div>
3261
3355
  <div class="sect3">
3262
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_set_cgi_param_lt_cgi_environment_name_gt_lt_value_gt"></span><h4 data-comment-topic="passenger-set-cgi-param-cgi-environment-name-value--rx9gc0" data-anchor="_passenger_set_cgi_param_lt_cgi_environment_name_gt_lt_value_gt">6.10.2. passenger_set_cgi_param &lt;CGI environment name&gt; &lt;value&gt;</h4>
3356
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_set_cgi_param_lt_cgi_environment_name_gt_lt_value_gt"></span><h4 data-comment-topic="passenger-set-cgi-param-cgi-environment-name-value--rx9gc0" data-anchor="_passenger_set_cgi_param_lt_cgi_environment_name_gt_lt_value_gt">6.11.2. passenger_set_cgi_param &lt;CGI environment name&gt; &lt;value&gt;</h4>
3263
3357
  <div class="paragraph"><p>Allows one to define additional CGI environment variables to pass to the backend
3264
3358
  application. This is equivalent to ngx_http_fastcgi_module’s <em>fastcgi_param</em>
3265
3359
  directive, and is comparable to ngx_http_proxy_module’s <em>proxy_set_header</em> option.
@@ -3310,7 +3404,7 @@ In an <em>if</em> configuration scope.
3310
3404
  </ul></div>
3311
3405
  </div>
3312
3406
  <div class="sect3">
3313
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_pass_header_lt_header_name_gt"></span><h4 data-comment-topic="passenger-pass-header-header-name--1cg31je" data-anchor="_passenger_pass_header_lt_header_name_gt">6.10.3. passenger_pass_header &lt;header name&gt;</h4>
3407
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_pass_header_lt_header_name_gt"></span><h4 data-comment-topic="passenger-pass-header-header-name--1cg31je" data-anchor="_passenger_pass_header_lt_header_name_gt">6.11.3. passenger_pass_header &lt;header name&gt;</h4>
3314
3408
  <div class="paragraph"><p>Some headers generated by backend applications are not forwarded to the HTTP client,
3315
3409
  e.g. <em>X-Accel-Redirect</em> which is directly processed by Nginx and then discarded from
3316
3410
  the final response. This directive allows one to force Nginx to pass those headers
@@ -3348,7 +3442,7 @@ In an <em>if</em> configuration scope.
3348
3442
  </ul></div>
3349
3443
  </div>
3350
3444
  <div class="sect3">
3351
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_buffer_response_lt_on_off_gt"></span><h4 data-comment-topic="passenger-buffer-response" data-anchor="_passenger_buffer_response_lt_on_off_gt">6.10.4. passenger_buffer_response &lt;on|off&gt;</h4>
3445
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_buffer_response_lt_on_off_gt"></span><h4 data-comment-topic="passenger-buffer-response" data-anchor="_passenger_buffer_response_lt_on_off_gt">6.11.4. passenger_buffer_response &lt;on|off&gt;</h4>
3352
3446
  <div class="paragraph"><p>When turned on, application-generated responses are buffered by Nginx. Buffering will
3353
3447
  happen in memory and also on disk if the response is larger than a certain threshold.</p></div>
3354
3448
  <div class="paragraph"><p>Before we proceed with explaining this configuration option, we want to state the following to avoid confusion. If you use Phusion Passenger for Nginx, there are in fact two response buffering systems active:</p></div>
@@ -3437,27 +3531,35 @@ In an <em>if</em> configuration scope.
3437
3531
  <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>off</em>.</p></div>
3438
3532
  </div>
3439
3533
  <div class="sect3">
3440
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_buffer_size"></span><h4 data-comment-topic="passenger-buffer-size-1jfkq87" data-anchor="_passenger_buffer_size">6.10.5. passenger_buffer_size</h4>
3534
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_buffer_size"></span><h4 data-comment-topic="passenger-buffer-size-1jfkq87" data-anchor="_passenger_buffer_size">6.11.5. passenger_buffer_size</h4>
3441
3535
  </div>
3442
3536
  <div class="sect3">
3443
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_buffers"></span><h4 data-comment-topic="passenger-busy-buffers" data-anchor="_passenger_buffers">6.10.6. passenger_buffers</h4>
3537
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_buffers"></span><h4 data-comment-topic="passenger-busy-buffers" data-anchor="_passenger_buffers">6.11.6. passenger_buffers</h4>
3444
3538
  </div>
3445
3539
  <div class="sect3">
3446
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_busy_buffer_size"></span><h4 data-comment-topic="passenger-busy-buffer-size-124sj61" data-anchor="_passenger_busy_buffer_size">6.10.7. passenger_busy_buffer_size</h4>
3540
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_busy_buffer_size"></span><h4 data-comment-topic="passenger-busy-buffer-size-124sj61" data-anchor="_passenger_busy_buffer_size">6.11.7. passenger_busy_buffer_size</h4>
3447
3541
  <div class="paragraph"><p>These options have the same effect as proxy_module’s similarly named options.
3448
3542
  They can be used to modify the maximum allowed HTTP header size.</p></div>
3449
3543
  </div>
3450
3544
  </div>
3451
3545
  <div class="sect2">
3452
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_security_options"></span><h3 data-comment-topic="security-options-1bv93g4" data-anchor="_security_options">6.11. Security options</h3>
3546
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_security_options"></span><h3 data-comment-topic="security-options-1bv93g4" data-anchor="_security_options">6.12. Security options</h3>
3453
3547
  <div class="sect3">
3454
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerUserSwitching"></span><h4 data-comment-topic="passenger-user-switching-on-off--1p37u3l" data-anchor="PassengerUserSwitching">6.11.1. passenger_user_switching &lt;on|off&gt;</h4>
3548
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerUserSwitching"></span><h4 data-comment-topic="passenger-user-switching-on-off--1p37u3l" data-anchor="PassengerUserSwitching">6.12.1. passenger_user_switching &lt;on|off&gt;</h4>
3455
3549
  <div class="paragraph"><p>Whether to enable <a href="#user_switching">user switching support</a>.</p></div>
3456
3550
  <div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration block.
3457
3551
  The default value is <em>on</em>.</p></div>
3552
+ <div class="admonitionblock">
3553
+ <table><tr>
3554
+ <td class="icon">
3555
+ <img src="./images/icons/note.png" alt="Note">
3556
+ </td>
3557
+ <td class="content">This option has no effect when you are using <a href="#flying_passenger">Flying Passenger</a>. You can disable user switching for Flying Passenger by starting the Flying Passenger daemon as a non-root user.</td>
3558
+ </tr></table>
3559
+ </div>
3458
3560
  </div>
3459
3561
  <div class="sect3">
3460
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_user_lt_username_gt"></span><h4 data-comment-topic="passenger-user-username--b06ur7" data-anchor="_passenger_user_lt_username_gt">6.11.2. passenger_user &lt;username&gt;</h4>
3562
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerUser"></span><h4 data-comment-topic="passenger-user-username--b06ur7" data-anchor="PassengerUser">6.12.2. passenger_user &lt;username&gt;</h4>
3461
3563
  <div class="paragraph"><p>If <a href="#user_switching">user switching support</a> is enabled, then Phusion Passenger will
3462
3564
  by default run the web application as the owner of the file <em>config/environment.rb</em>
3463
3565
  (for Rails apps) or <em>config.ru</em> (for Rack apps). This option allows you to override
@@ -3489,7 +3591,7 @@ In an <em>if</em> configuration scope.
3489
3591
  <div class="paragraph"><p>In each place, it may be specified at most once.</p></div>
3490
3592
  </div>
3491
3593
  <div class="sect3">
3492
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_group_lt_group_name_gt"></span><h4 data-comment-topic="passenger-user-group-name--1fco4j7" data-anchor="_passenger_group_lt_group_name_gt">6.11.3. passenger_group &lt;group name&gt;</h4>
3594
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerGroup"></span><h4 data-comment-topic="passenger-user-group-name--1fco4j7" data-anchor="PassengerGroup">6.12.3. passenger_group &lt;group name&gt;</h4>
3493
3595
  <div class="paragraph"><p>If <a href="#user_switching">user switching support</a> is enabled, then Phusion Passenger will
3494
3596
  by default run the web application as the primary group of the owner of the file
3495
3597
  <em>config/environment.rb</em> (for Rails apps) or <em>config.ru</em> (for Rack apps). This option
@@ -3523,24 +3625,40 @@ In an <em>if</em> configuration scope.
3523
3625
  <div class="paragraph"><p>In each place, it may be specified at most once.</p></div>
3524
3626
  </div>
3525
3627
  <div class="sect3">
3526
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerDefaultUser"></span><h4 data-comment-topic="passenger-default-user-username--1h6cdmf" data-anchor="PassengerDefaultUser">6.11.4. passenger_default_user &lt;username&gt;</h4>
3628
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerDefaultUser"></span><h4 data-comment-topic="passenger-default-user-username--1h6cdmf" data-anchor="PassengerDefaultUser">6.12.4. passenger_default_user &lt;username&gt;</h4>
3527
3629
  <div class="paragraph"><p>Phusion Passenger enables <a href="#user_switching">user switching support</a> by default.
3528
3630
  This configuration option allows one to specify the user that applications must
3529
3631
  run as, if user switching fails or is disabled.</p></div>
3530
3632
  <div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration block.
3531
3633
  The default value is <em>nobody</em>.</p></div>
3634
+ <div class="admonitionblock">
3635
+ <table><tr>
3636
+ <td class="icon">
3637
+ <img src="./images/icons/note.png" alt="Note">
3638
+ </td>
3639
+ <td class="content">This option has no effect when you are using <a href="#flying_passenger">Flying Passenger</a>. There is currently no way to set this option when using Flying Passenger, but if you want to disable user switching for Flying Passenger then you can do so by starting the Flying Passenger daemon as a non-root user.</td>
3640
+ </tr></table>
3641
+ </div>
3532
3642
  </div>
3533
3643
  <div class="sect3">
3534
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerDefaultGroup"></span><h4 data-comment-topic="passenger-default-group-group-name--1qxn2qa" data-anchor="PassengerDefaultGroup">6.11.5. Passenger_default_group &lt;group name&gt;</h4>
3644
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerDefaultGroup"></span><h4 data-comment-topic="passenger-default-group-group-name--1qxn2qa" data-anchor="PassengerDefaultGroup">6.12.5. Passenger_default_group &lt;group name&gt;</h4>
3535
3645
  <div class="paragraph"><p>Phusion Passenger enables <a href="#user_switching">user switching support</a> by default.
3536
3646
  This configuration option allows one to specify the group that applications must
3537
3647
  run as, if user switching fails or is disabled.</p></div>
3538
3648
  <div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration block.
3539
3649
  The default value is the primary group of the user specifified by
3540
3650
  <a href="#PassengerDefaultUser">passenger_default_user</a>.</p></div>
3651
+ <div class="admonitionblock">
3652
+ <table><tr>
3653
+ <td class="icon">
3654
+ <img src="./images/icons/note.png" alt="Note">
3655
+ </td>
3656
+ <td class="content">This option has no effect when you are using <a href="#flying_passenger">Flying Passenger</a>. There is currently no way to set this option when using Flying Passenger, but if you want to disable user switching for Flying Passenger then you can do so by starting the Flying Passenger daemon as a non-root user.</td>
3657
+ </tr></table>
3658
+ </div>
3541
3659
  </div>
3542
3660
  <div class="sect3">
3543
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_show_version_in_header_lt_on_off_gt"></span><h4 data-comment-topic="passenger-show-version-in-header-on-off--2h49av" data-anchor="_passenger_show_version_in_header_lt_on_off_gt">6.11.6. passenger_show_version_in_header &lt;on|off&gt;</h4>
3661
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_show_version_in_header_lt_on_off_gt"></span><h4 data-comment-topic="passenger-show-version-in-header-on-off--2h49av" data-anchor="_passenger_show_version_in_header_lt_on_off_gt">6.12.6. passenger_show_version_in_header &lt;on|off&gt;</h4>
3544
3662
  <div class="paragraph"><p>When turned on, Phusion Passenger will output its version number in the <span class="monospaced">Server</span> and <span class="monospaced">X-Powered-By</span> header in all Phusion Passenger-served requests:</p></div>
3545
3663
  <div class="listingblock">
3546
3664
  <div class="content monospaced">
@@ -3581,7 +3699,7 @@ In an <em>if</em> configuration scope.
3581
3699
  <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>on</em>.</p></div>
3582
3700
  </div>
3583
3701
  <div class="sect3">
3584
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_friendly_error_pages_lt_on_off_gt"></span><h4 data-comment-topic="passenger-friendly-error-pages-on-off--1ti1a0e" data-anchor="_passenger_friendly_error_pages_lt_on_off_gt">6.11.7. passenger_friendly_error_pages &lt;on|off&gt;</h4>
3702
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerFriendlyErrorPages"></span><h4 data-comment-topic="passenger-friendly-error-pages-on-off--1ti1a0e" data-anchor="PassengerFriendlyErrorPages">6.12.7. passenger_friendly_error_pages &lt;on|off&gt;</h4>
3585
3703
  <div class="paragraph"><p>Phusion Passenger can display friendly error pages whenever an application fails
3586
3704
  to start. This friendly error page presents the startup error message, some
3587
3705
  suggestions for solving the problem, and a backtrace. This feature is very useful
@@ -3616,9 +3734,9 @@ In an <em>if</em> configuration scope.
3616
3734
  </div>
3617
3735
  </div>
3618
3736
  <div class="sect2">
3619
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_resource_control_and_optimization_options"></span><h3 data-comment-topic="resource-control-and-optimization-options-xd7evs" data-anchor="_resource_control_and_optimization_options">6.12. Resource control and optimization options</h3>
3737
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_resource_control_and_optimization_options"></span><h3 data-comment-topic="resource-control-and-optimization-options-xd7evs" data-anchor="_resource_control_and_optimization_options">6.13. Resource control and optimization options</h3>
3620
3738
  <div class="sect3">
3621
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerMaxPoolSize"></span><h4 data-comment-topic="passenger-max-pool-size-integer--3jzefs" data-anchor="PassengerMaxPoolSize">6.12.1. passenger_max_pool_size &lt;integer&gt;</h4>
3739
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerMaxPoolSize"></span><h4 data-comment-topic="passenger-max-pool-size-integer--3jzefs" data-anchor="PassengerMaxPoolSize">6.13.1. passenger_max_pool_size &lt;integer&gt;</h4>
3622
3740
  <div class="paragraph"><p>The maximum number of <a href="#application_process">application processes</a> that may
3623
3741
  simultanously exist. A larger number results in higher memory usage,
3624
3742
  but improves the ability to handle concurrent HTTP requests.</p></div>
@@ -3626,9 +3744,17 @@ but improves the ability to handle concurrent HTTP requests.</p></div>
3626
3744
  <div class="paragraph"><p>If you find that your server is running out of memory then you should lower this value.</p></div>
3627
3745
  <div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration block.
3628
3746
  The default value is <em>6</em>.</p></div>
3747
+ <div class="admonitionblock">
3748
+ <table><tr>
3749
+ <td class="icon">
3750
+ <img src="./images/icons/note.png" alt="Note">
3751
+ </td>
3752
+ <td class="content">This option has no effect when you are using <a href="#flying_passenger">Flying Passenger</a>. Instead, you should configure this by passing the <span class="monospaced">--max-pool-size</span> command line option to the Flying Passenger daemon.</td>
3753
+ </tr></table>
3754
+ </div>
3629
3755
  </div>
3630
3756
  <div class="sect3">
3631
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerMinInstances"></span><h4 data-comment-topic="passenger-min-instances-integer--uclykt" data-anchor="PassengerMinInstances">6.12.2. passenger_min_instances &lt;integer&gt;</h4>
3757
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerMinInstances"></span><h4 data-comment-topic="passenger-min-instances-integer--uclykt" data-anchor="PassengerMinInstances">6.13.2. passenger_min_instances &lt;integer&gt;</h4>
3632
3758
  <div class="paragraph"><p>This specifies the minimum number of application processes that should exist for a
3633
3759
  given application. You should set this option to a
3634
3760
  non-zero value if you want to avoid potentially long startup times after a website
@@ -3703,7 +3829,7 @@ In an <em>if</em> configuration scope.
3703
3829
  <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>1</em>.</p></div>
3704
3830
  </div>
3705
3831
  <div class="sect3">
3706
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_max_instances_lt_integer_gt"></span><h4 data-comment-topic="passenger-max-instances" data-anchor="_passenger_max_instances_lt_integer_gt">6.12.3. passenger_max_instances &lt;integer&gt;</h4>
3832
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_max_instances_lt_integer_gt"></span><h4 data-comment-topic="passenger-max-instances" data-anchor="_passenger_max_instances_lt_integer_gt">6.13.3. passenger_max_instances &lt;integer&gt;</h4>
3707
3833
  <div class="paragraph"><p><strong>This feature is only available in <a href="https://www.phusionpassenger.com/enterprise">Phusion Passenger Enterprise</a>. It was introduced in version 3.0.0. <a href="https://www.phusionpassenger.com/download">Buy Phusion Passenger Enterprise here.</a></strong></p></div>
3708
3834
  <div class="paragraph"><p>The maximum number of application processes that may simultaneously exist
3709
3835
  for an application. This helps to make sure that a single application
@@ -3754,7 +3880,7 @@ on the other hand will be free to spawn up to 10 processes if it gets a lot of t
3754
3880
  </div>
3755
3881
  </div>
3756
3882
  <div class="sect3">
3757
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_max_instances_per_app_lt_integer_gt"></span><h4 data-comment-topic="passenger-max-instances-per-app-integer--1xhbbne" data-anchor="_passenger_max_instances_per_app_lt_integer_gt">6.12.4. passenger_max_instances_per_app &lt;integer&gt;</h4>
3883
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_max_instances_per_app_lt_integer_gt"></span><h4 data-comment-topic="passenger-max-instances-per-app-integer--1xhbbne" data-anchor="_passenger_max_instances_per_app_lt_integer_gt">6.13.4. passenger_max_instances_per_app &lt;integer&gt;</h4>
3758
3884
  <div class="paragraph"><p>The maximum number of application processes that may simultaneously exist
3759
3885
  for a single application. This helps to make sure that a single application
3760
3886
  will not occupy all available slots in the application pool.</p></div>
@@ -3766,7 +3892,7 @@ will be enforced.</p></div>
3766
3892
  The default value is <em>0</em>.</p></div>
3767
3893
  </div>
3768
3894
  <div class="sect3">
3769
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerPoolIdleTime"></span><h4 data-comment-topic="passenger-pool-idle-time-integer--xcw65o" data-anchor="PassengerPoolIdleTime">6.12.5. passenger_pool_idle_time &lt;integer&gt;</h4>
3895
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerPoolIdleTime"></span><h4 data-comment-topic="passenger-pool-idle-time-integer--xcw65o" data-anchor="PassengerPoolIdleTime">6.13.5. passenger_pool_idle_time &lt;integer&gt;</h4>
3770
3896
  <div class="paragraph"><p>The maximum number of seconds that an application process may be idle. That is,
3771
3897
  if an application process hasn’t received any traffic after the given number of
3772
3898
  seconds, then it will be shutdown in order to conserve memory.</p></div>
@@ -3786,9 +3912,17 @@ recommended if you’re on a non-shared host that’s only running a few
3786
3912
  applications, each which must be available at all times.</p></div>
3787
3913
  <div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration block.
3788
3914
  The default value is <em>300</em>.</p></div>
3915
+ <div class="admonitionblock">
3916
+ <table><tr>
3917
+ <td class="icon">
3918
+ <img src="./images/icons/note.png" alt="Note">
3919
+ </td>
3920
+ <td class="content">This option has no effect when you are using <a href="#flying_passenger">Flying Passenger</a>. Instead, you should configure this by passing the <span class="monospaced">--pool-idle-time</span> command line option to the Flying Passenger daemon.</td>
3921
+ </tr></table>
3922
+ </div>
3789
3923
  </div>
3790
3924
  <div class="sect3">
3791
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_max_preloader_idle_time_lt_integer_gt"></span><h4 data-comment-topic="rails-app-spawner-idle-time-integer--1xjqe4b" data-anchor="_passenger_max_preloader_idle_time_lt_integer_gt">6.12.6. passenger_max_preloader_idle_time &lt;integer&gt;</h4>
3925
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_max_preloader_idle_time_lt_integer_gt"></span><h4 data-comment-topic="rails-app-spawner-idle-time-integer--1xjqe4b" data-anchor="_passenger_max_preloader_idle_time_lt_integer_gt">6.13.6. passenger_max_preloader_idle_time &lt;integer&gt;</h4>
3792
3926
  <div class="paragraph"><p>The ApplicationSpawner server (explained in <a href="#spawning_methods_explained">Spawning methods explained</a>) has an idle timeout, just like the backend processes spawned by
3793
3927
  Phusion Passenger do. That is, it will automatically shutdown if it hasn’t done
3794
3928
  anything for a given period.</p></div>
@@ -3825,9 +3959,17 @@ In an <em>if</em> configuration scope.
3825
3959
  </li>
3826
3960
  </ul></div>
3827
3961
  <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>300</em> (5 minutes).</p></div>
3962
+ <div class="admonitionblock">
3963
+ <table><tr>
3964
+ <td class="icon">
3965
+ <img src="./images/icons/note.png" alt="Note">
3966
+ </td>
3967
+ <td class="content">This option has no effect when you are using <a href="#flying_passenger">Flying Passenger</a>. Instead, you should configure this by passing the <span class="monospaced">--max-preloader-idle-time</span> command line option to the Flying Passenger daemon.</td>
3968
+ </tr></table>
3969
+ </div>
3828
3970
  </div>
3829
3971
  <div class="sect3">
3830
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerConcurrencyModel"></span><h4 data-comment-topic="passenger-concurrency-model-process-thread--brcvkk" data-anchor="PassengerConcurrencyModel">6.12.7. passenger_concurrency_model &lt;process|thread&gt;</h4>
3972
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerConcurrencyModel"></span><h4 data-comment-topic="passenger-concurrency-model-process-thread--brcvkk" data-anchor="PassengerConcurrencyModel">6.13.7. passenger_concurrency_model &lt;process|thread&gt;</h4>
3831
3973
  <div class="paragraph"><p><strong>This feature is only available in <a href="https://www.phusionpassenger.com/enterprise">Phusion Passenger Enterprise</a>. It was introduced in version 4.0.0. <a href="https://www.phusionpassenger.com/download">Buy Phusion Passenger Enterprise here.</a></strong></p></div>
3832
3974
  <div class="paragraph"><p>Specifies the I/O concurrency model that should be used for application processes. Phusion Passenger supports two concurrency models:</p></div>
3833
3975
  <div class="ulist"><ul>
@@ -3868,7 +4010,7 @@ In an <em>if</em> configuration scope.
3868
4010
  <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>process</em>.</p></div>
3869
4011
  </div>
3870
4012
  <div class="sect3">
3871
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerThreadCount"></span><h4 data-comment-topic="passenger-thread-count-number--1kd6ffy" data-anchor="PassengerThreadCount">6.12.8. passenger_thread_count &lt;number&gt;</h4>
4013
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerThreadCount"></span><h4 data-comment-topic="passenger-thread-count-number--1kd6ffy" data-anchor="PassengerThreadCount">6.13.8. passenger_thread_count &lt;number&gt;</h4>
3872
4014
  <div class="paragraph"><p><strong>This feature is only available in <a href="https://www.phusionpassenger.com/enterprise">Phusion Passenger Enterprise</a>. It was introduced in version 4.0.0. <a href="https://www.phusionpassenger.com/download">Buy Phusion Passenger Enterprise here.</a></strong></p></div>
3873
4015
  <div class="paragraph"><p>Specifies the number of threads that Phusion Passenger should spawn per application process. This option only has effect if <a href="#PassengerConcurrencyModel">passenger_concurrency_model</a> is <em>thread</em>.</p></div>
3874
4016
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
@@ -3897,7 +4039,7 @@ In an <em>if</em> configuration scope.
3897
4039
  <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>1</em>.</p></div>
3898
4040
  </div>
3899
4041
  <div class="sect3">
3900
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerMaxRequests"></span><h4 data-comment-topic="passenger-max-requests-integer--sgzint" data-anchor="PassengerMaxRequests">6.12.9. passenger_max_requests &lt;integer&gt;</h4>
4042
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerMaxRequests"></span><h4 data-comment-topic="passenger-max-requests-integer--sgzint" data-anchor="PassengerMaxRequests">6.13.9. passenger_max_requests &lt;integer&gt;</h4>
3901
4043
  <div class="paragraph"><p>The maximum number of requests an application process will process. After
3902
4044
  serving that many requests, the application process will be shut down and
3903
4045
  Phusion Passenger will restart it. A value of 0 means that there is no maximum:
@@ -3945,7 +4087,7 @@ measure to avoid memory leaks.</p></div>
3945
4087
  </div>
3946
4088
  </div>
3947
4089
  <div class="sect3">
3948
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerMaxRequestTime"></span><h4 data-comment-topic="passenger-max-request-time-seconds--1htog2g" data-anchor="PassengerMaxRequestTime">6.12.10. passenger_max_request_time &lt;seconds&gt;</h4>
4090
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerMaxRequestTime"></span><h4 data-comment-topic="passenger-max-request-time-seconds--1htog2g" data-anchor="PassengerMaxRequestTime">6.13.10. passenger_max_request_time &lt;seconds&gt;</h4>
3949
4091
  <div class="paragraph"><p><strong>This feature is only available in <a href="https://www.phusionpassenger.com/enterprise">Phusion Passenger Enterprise</a>. It was introduced in version 3.0.0. <a href="https://www.phusionpassenger.com/download">Buy Phusion Passenger Enterprise here.</a></strong></p></div>
3950
4092
  <div class="paragraph"><p>The maximum amount of time, in seconds, that an application process may take
3951
4093
  to process a request. If the request takes longer than this amount of time,
@@ -4014,9 +4156,20 @@ measure to avoid freezing applications.</p></div>
4014
4156
  </td>
4015
4157
  </tr></table>
4016
4158
  </div>
4159
+ <div class="admonitionblock">
4160
+ <table><tr>
4161
+ <td class="icon">
4162
+ <img src="./images/icons/note.png" alt="Note">
4163
+ </td>
4164
+ <td class="content">
4165
+ <div class="paragraph"><p>This option is currently only available for Ruby apps. It is not yet available
4166
+ for Python and Node.js.</p></div>
4167
+ </td>
4168
+ </tr></table>
4169
+ </div>
4017
4170
  </div>
4018
4171
  <div class="sect3">
4019
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerMemoryLimit"></span><h4 data-comment-topic="passenger-memory-limit-integer--1ry7dwx" data-anchor="PassengerMemoryLimit">6.12.11. passenger_memory_limit &lt;integer&gt;</h4>
4172
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerMemoryLimit"></span><h4 data-comment-topic="passenger-memory-limit-integer--1ry7dwx" data-anchor="PassengerMemoryLimit">6.13.11. passenger_memory_limit &lt;integer&gt;</h4>
4020
4173
  <div class="paragraph"><p><strong>This feature is only available in <a href="https://www.phusionpassenger.com/enterprise">Phusion Passenger Enterprise</a>. It was introduced in version 3.0.0. <a href="https://www.phusionpassenger.com/download">Buy Phusion Passenger Enterprise here.</a></strong></p></div>
4021
4174
  <div class="paragraph"><p>The maximum amount of memory that an application process may use, in megabytes.
4022
4175
  Once an application process has surpassed its memory limit, it will process
@@ -4081,7 +4234,7 @@ measure to avoid memory leaks.</p></div>
4081
4234
  </div>
4082
4235
  </div>
4083
4236
  <div class="sect3">
4084
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerPreStart"></span><h4 data-comment-topic="passenger-pre-start-url--npldeb" data-anchor="PassengerPreStart">6.12.12. passenger_pre_start &lt;url&gt;</h4>
4237
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerPreStart"></span><h4 data-comment-topic="passenger-pre-start-url--npldeb" data-anchor="PassengerPreStart">6.13.12. passenger_pre_start &lt;url&gt;</h4>
4085
4238
  <div class="paragraph"><p>By default, Phusion Passenger does not start any application processes until said
4086
4239
  web application is first accessed. The result is that the first visitor of said
4087
4240
  web application might experience a small delay as Phusion Passenger is starting
@@ -4127,6 +4280,14 @@ You will probably want to combine this option with
4127
4280
  </ul></div>
4128
4281
  <div class="paragraph"><p>This option may only occur in the <em>http</em> configuration block. It may be specified
4129
4282
  any number of times.</p></div>
4283
+ <div class="admonitionblock">
4284
+ <table><tr>
4285
+ <td class="icon">
4286
+ <img src="./images/icons/note.png" alt="Note">
4287
+ </td>
4288
+ <td class="content">This option is currently not available when using <a href="#flying_passenger">Flying Passenger</a>.</td>
4289
+ </tr></table>
4290
+ </div>
4130
4291
  <div class="sect4">
4131
4292
  <h5 id="_example_1_basic_usage">Example 1: basic usage</h5>
4132
4293
  <div class="paragraph"><p>Suppose that you have the following web applications.</p></div>
@@ -4296,9 +4457,9 @@ the request ending up at a different web server in the cluster.</p></div>
4296
4457
  </div>
4297
4458
  </div>
4298
4459
  <div class="sect2">
4299
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_logging_and_debugging_options"></span><h3 data-comment-topic="logging-and-debugging-options-14e91ni" data-anchor="_logging_and_debugging_options">6.13. Logging and debugging options</h3>
4460
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_logging_and_debugging_options"></span><h3 data-comment-topic="logging-and-debugging-options-14e91ni" data-anchor="_logging_and_debugging_options">6.14. Logging and debugging options</h3>
4300
4461
  <div class="sect3">
4301
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_log_level_lt_integer_gt"></span><h4 data-comment-topic="passenger-log-level-integer--17snhon" data-anchor="_passenger_log_level_lt_integer_gt">6.13.1. passenger_log_level &lt;integer&gt;</h4>
4462
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerLogLevel"></span><h4 data-comment-topic="passenger-log-level-integer--17snhon" data-anchor="PassengerLogLevel">6.14.1. passenger_log_level &lt;integer&gt;</h4>
4302
4463
  <div class="paragraph"><p>This option allows one to specify how much information Phusion Passenger should
4303
4464
  write to the Nginx error log file. A higher log level value means that more
4304
4465
  information will be logged.</p></div>
@@ -4331,14 +4492,22 @@ information will be logged.</p></div>
4331
4492
  The default is <em>0</em>.</p></div>
4332
4493
  </div>
4333
4494
  <div class="sect3">
4334
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_debug_log_file_lt_filename_gt"></span><h4 data-comment-topic="passenger-debug-log-file-filename--21ubaj" data-anchor="_passenger_debug_log_file_lt_filename_gt">6.13.2. passenger_debug_log_file &lt;filename&gt;</h4>
4495
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_debug_log_file_lt_filename_gt"></span><h4 data-comment-topic="passenger-debug-log-file-filename--21ubaj" data-anchor="_passenger_debug_log_file_lt_filename_gt">6.14.2. passenger_debug_log_file &lt;filename&gt;</h4>
4335
4496
  <div class="paragraph"><p>By default Phusion Passenger debugging and error messages are written to the global
4336
4497
  web server error log. This option allows one to specify the file that debugging and
4337
4498
  error messages should be written to instead.</p></div>
4338
4499
  <div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration block.</p></div>
4500
+ <div class="admonitionblock">
4501
+ <table><tr>
4502
+ <td class="icon">
4503
+ <img src="./images/icons/note.png" alt="Note">
4504
+ </td>
4505
+ <td class="content">This option has no effect when you are using <a href="#flying_passenger">Flying Passenger</a>. Instead, you should configure this by passing the <span class="monospaced">--log-file</span> command line option to the Flying Passenger daemon.</td>
4506
+ </tr></table>
4507
+ </div>
4339
4508
  </div>
4340
4509
  <div class="sect3">
4341
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_debugger_lt_on_off_gt"></span><h4 data-comment-topic="passenger-debugger-on-off--1wkuq85" data-anchor="_passenger_debugger_lt_on_off_gt">6.13.3. passenger_debugger &lt;on|off&gt;</h4>
4510
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_debugger_lt_on_off_gt"></span><h4 data-comment-topic="passenger-debugger-on-off--1wkuq85" data-anchor="_passenger_debugger_lt_on_off_gt">6.14.3. passenger_debugger &lt;on|off&gt;</h4>
4342
4511
  <div class="paragraph"><p><strong>This feature is only available in <a href="https://www.phusionpassenger.com/enterprise">Phusion Passenger Enterprise</a>. It was introduced in version 3.0.0. <a href="https://www.phusionpassenger.com/download">Buy Phusion Passenger Enterprise here.</a></strong></p></div>
4343
4512
  <div class="paragraph"><p>Turns support for application debugging on or off. In case of Ruby applications,
4344
4513
  turning this option on will cause them to load the <span class="monospaced">ruby-debug</span> gem (when on Ruby 1.8)
@@ -4378,9 +4547,9 @@ In an <em>if</em> configuration scope.
4378
4547
  </div>
4379
4548
  </div>
4380
4549
  <div class="sect2">
4381
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_ruby_on_rails_specific_options"></span><h3 data-comment-topic="ruby-on-rails-specific-options-12vfokt" data-anchor="_ruby_on_rails_specific_options">6.14. Ruby on Rails-specific options</h3>
4550
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_ruby_on_rails_specific_options"></span><h3 data-comment-topic="ruby-on-rails-specific-options-12vfokt" data-anchor="_ruby_on_rails_specific_options">6.15. Ruby on Rails-specific options</h3>
4382
4551
  <div class="sect3">
4383
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="RailsEnv"></span><h4 data-comment-topic="rails-env-string--jlh7v9" data-anchor="RailsEnv">6.14.1. rails_env &lt;string&gt;</h4>
4552
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="RailsEnv"></span><h4 data-comment-topic="rails-env-string--jlh7v9" data-anchor="RailsEnv">6.15.1. rails_env &lt;string&gt;</h4>
4384
4553
  <div class="paragraph"><p>This option allows one to specify the default <span class="monospaced">RAILS_ENV</span> value.</p></div>
4385
4554
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
4386
4555
  <div class="ulist"><ul>
@@ -4409,9 +4578,9 @@ In an <em>if</em> configuration scope.
4409
4578
  </div>
4410
4579
  </div>
4411
4580
  <div class="sect2">
4412
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_rack_and_rails_gt_3_specific_options"></span><h3 data-comment-topic="rack-specific-options-13yvdxs" data-anchor="_rack_and_rails_gt_3_specific_options">6.15. Rack and Rails &gt;= 3 specific options</h3>
4581
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_rack_and_rails_gt_3_specific_options"></span><h3 data-comment-topic="rack-specific-options-13yvdxs" data-anchor="_rack_and_rails_gt_3_specific_options">6.16. Rack and Rails &gt;= 3 specific options</h3>
4413
4582
  <div class="sect3">
4414
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="RackEnv"></span><h4 data-comment-topic="rack-env-string--tqmrt0" data-anchor="RackEnv">6.15.1. rack_env &lt;string&gt;</h4>
4583
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="RackEnv"></span><h4 data-comment-topic="rack-env-string--tqmrt0" data-anchor="RackEnv">6.16.1. rack_env &lt;string&gt;</h4>
4415
4584
  <div class="paragraph"><p>This option allows one to specify the default <span class="monospaced">RACK_ENV</span> value.</p></div>
4416
4585
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
4417
4586
  <div class="ulist"><ul>
@@ -4440,11 +4609,11 @@ In an <em>if</em> configuration scope.
4440
4609
  </div>
4441
4610
  </div>
4442
4611
  <div class="sect2">
4443
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_deprecated_options"></span><h3 data-comment-topic="deprecated-options-1dtzo0g" data-anchor="_deprecated_options">6.16. Deprecated options</h3>
4612
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_deprecated_options"></span><h3 data-comment-topic="deprecated-options-1dtzo0g" data-anchor="_deprecated_options">6.17. Deprecated options</h3>
4444
4613
  <div class="paragraph"><p>The following options have been deprecated, but are still supported for backwards
4445
4614
  compatibility reasons.</p></div>
4446
4615
  <div class="sect3">
4447
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_rails_spawn_method"></span><h4 data-comment-topic="rails-spawn-method-17vdnpt" data-anchor="_rails_spawn_method">6.16.1. rails_spawn_method</h4>
4616
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_rails_spawn_method"></span><h4 data-comment-topic="rails-spawn-method-17vdnpt" data-anchor="_rails_spawn_method">6.17.1. rails_spawn_method</h4>
4448
4617
  <div class="paragraph"><p>Deprecated in favor of <a href="#PassengerSpawnMethod">passenger_spawn_method</a>.</p></div>
4449
4618
  </div>
4450
4619
  </div>
@@ -4730,51 +4899,199 @@ through the <em>X-Passenger-Connect-Password</em> HTTP header, like this:</p></d
4730
4899
  <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_tips"></span><h2 data-comment-topic="tips-n4c22d" data-anchor="_tips">8. Tips</h2>
4731
4900
  <div class="sectionbody">
4732
4901
  <div class="sect2">
4733
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="user_switching"></span><h3 data-comment-topic="user-switching-security--zmsy9o" data-anchor="user_switching">8.1. User switching (security)</h3>
4734
- <div class="paragraph"><p>There is a problem that plagues most PHP web hosts, namely the fact that all PHP
4902
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="user_switching"></span><h3 data-comment-topic="user-switching-security--zmsy9o" data-anchor="user_switching">8.1. User Switching (security feature)</h3>
4903
+ <div class="paragraph"><p>Phusion Passenger supports automatic <em>user switching</em>: by default, it attempts to run applications as the "right" user, instead of running all applications as the same user.</p></div>
4904
+ <div class="paragraph"><p>To better understand the problem, let us consider the situation with PHP.
4905
+ There is a problem that plagues most PHP web hosts, namely the fact that all PHP
4735
4906
  applications are run in the same user context as the web server. So for
4736
4907
  example, Joe’s PHP application will be able to read Jane’s PHP application’s
4737
4908
  passwords. This is obviously undesirable on many servers.</p></div>
4738
- <div class="paragraph"><p>Phusion Passenger solves this problem by implementing <em>user switching</em>. A Rails
4739
- application is started as the owner of the file <em>config/environment.rb</em>,
4740
- and a Rack application is started as the owner of the file <em>config.ru</em>.
4741
- So if <em>/home/webapps/foo/config/environment.rb</em> is owned by <em>joe</em>, then Phusion
4742
- Passenger will launch the corresponding application as <em>joe</em> as well.</p></div>
4743
- <div class="paragraph"><p>This behavior is the default, and you don’t need to configure anything. But
4744
- there are things that you should keep in mind:</p></div>
4909
+ <div class="paragraph"><p>Phusion Passenger’s <em>user switching</em> feature solves this problem. Applications are
4910
+ run as the owner of their "startup file". For Ruby apps, the startup file is
4911
+ <span class="monospaced">config.ru</span> (Rack and Rails &gt;= 3) or <span class="monospaced">config/environment.rb</span> (Rails 1 and 2). For
4912
+ Python apps, the startup file is <span class="monospaced">passenger_wsgi.py</span>. So suppose that <span class="monospaced">config.ru</span>
4913
+ is owned by user <em>joe</em>, then Phusion Passenger will spawn the corresponding
4914
+ application as <em>joe</em> as well. The exact rules are a little bit more complicated,
4915
+ and they’re explained further down in this section.</p></div>
4916
+ <div class="sect3">
4917
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_requirements"></span><h4 data-comment-topic="requirements-15ozqdj" data-anchor="_requirements">8.1.1. Requirements</h4>
4918
+ <div class="paragraph"><p>User switching is only enabled when all of the following conditions are met:</p></div>
4919
+ <div class="ulist"><ul>
4920
+ <li>
4921
+ <p>
4922
+ When not using <a href="#flying_passenger">Flying Passenger</a> (this is probably the case):
4923
+ </p>
4924
+ <div class="ulist"><ul>
4925
+ <li>
4926
+ <p>
4927
+ The
4928
+ <a href="#PassengerUserSwitching">passenger_user_switching</a>
4929
+ option must be enabled.
4930
+ </p>
4931
+ </li>
4932
+ <li>
4933
+ <p>
4934
+ The web server’s control process must have root privileges. This is the case on most installations.
4935
+ </p>
4936
+ </li>
4937
+ </ul></div>
4938
+ </li>
4939
+ <li>
4940
+ <p>
4941
+ When using <a href="#flying_passenger">Flying Passenger</a>:
4942
+ </p>
4745
4943
  <div class="ulist"><ul>
4746
4944
  <li>
4747
4945
  <p>
4748
- The owner of <em>environment.rb</em>/<em>config.ru</em> must have read access to the application’s
4749
- root directory, and read/write access to the application’s <em>logs</em> directory.
4946
+ The Flying Passenger daemon must be run with root privileges.
4750
4947
  </p>
4751
4948
  </li>
4949
+ </ul></div>
4950
+ </li>
4951
+ </ul></div>
4952
+ </div>
4953
+ <div class="sect3">
4954
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_effects"></span><h4 data-comment-topic="effects-nd2m44" data-anchor="_effects">8.1.2. Effects</h4>
4955
+ <div class="paragraph"><p>When not using Flying Passenger, the following table illustrates the effect for different combinations of the requirements.</p></div>
4956
+ <table class="tableblock frame-all grid-all" style="
4957
+ width:100%;
4958
+ ">
4959
+ <col style="width:33%;">
4960
+ <col style="width:33%;">
4961
+ <col style="width:33%;">
4962
+ <tbody>
4963
+ <tr>
4964
+ <td class="tableblock halign-left valign-top"><p class="tableblock"></p></td>
4965
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><strong>passenger_user_switching on</strong></p></td>
4966
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><strong>passenger_user_switching off</strong></p></td>
4967
+ </tr>
4968
+ <tr>
4969
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Web server has root privileges</strong></p></td>
4970
+ <td class="tableblock halign-left valign-top"><p class="tableblock">User switching enabled.</p></td>
4971
+ <td class="tableblock halign-left valign-top"><p class="tableblock">User switching disabled. Apps are run as
4972
+ <a href="#PassengerDefaultUser">passenger_default_user</a> and
4973
+ <a href="#PassengerDefaultGroup">passenger_default_group</a>.</p></td>
4974
+ </tr>
4975
+ <tr>
4976
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Web server has no root privileges</strong></p></td>
4977
+ <td class="tableblock halign-left valign-top"><p class="tableblock">User switching disabled. Apps are run as the web server’s user.</p></td>
4978
+ <td class="tableblock halign-left valign-top"><p class="tableblock">User switching disabled. Apps are run as the web server’s user.</p></td>
4979
+ </tr>
4980
+ </tbody>
4981
+ </table>
4982
+ <div class="paragraph"><p>When using Flying Passenger, the effect is as follows:</p></div>
4983
+ <table class="tableblock frame-all grid-all" style="
4984
+ width:100%;
4985
+ ">
4986
+ <col style="width:50%;">
4987
+ <col style="width:50%;">
4988
+ <tbody>
4989
+ <tr>
4990
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Daemon run with root privileges</strong></p></td>
4991
+ <td class="tableblock halign-left valign-top"><p class="tableblock">User switching enabled.</p></td>
4992
+ </tr>
4993
+ <tr>
4994
+ <td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Daemon run without root privileges</strong></p></td>
4995
+ <td class="tableblock halign-left valign-top"><p class="tableblock">User switching disabled. Apps are run as the daemon’s user.</p></td>
4996
+ </tr>
4997
+ </tbody>
4998
+ </table>
4999
+ <div class="paragraph"><p>When user switching is enabled, the following rules are followed to determine what user an application should be run as. The first matching rule is the rule that will be followed.</p></div>
5000
+ <div class="olist arabic"><ol class="arabic">
4752
5001
  <li>
4753
5002
  <p>
4754
- This feature is only available if the web server is started by <em>root</em>. This is the
4755
- case on most installations.
5003
+ If
5004
+ <a href="#PassengerUser">passenger_user</a> or
5005
+ <a href="#PassengerGroup">passenger_group</a>
5006
+ are set, then the application will be run as the specified user/group. Thus, these options are a good way to override user switching settings.
4756
5007
  </p>
4757
5008
  </li>
4758
5009
  <li>
4759
5010
  <p>
4760
- Under no circumstances will applications be run as <em>root</em>. If
4761
- <em>environment.rb</em>/<em>config.ru</em> is owned as root or by an unknown user, then the
4762
- Rails/Rack application will run as the user specified by
5011
+ If the startup file is owned by root or an unknown user, then the application will run as the user specified by
4763
5012
  <a href="#PassengerDefaultUser">passenger_default_user</a> and
4764
5013
  <a href="#PassengerDefaultGroup">passenger_default_group</a>.
4765
5014
  </p>
4766
5015
  </li>
5016
+ <li>
5017
+ <p>
5018
+ Otherwise, the application is run as the owner of the startup file.
5019
+ </p>
5020
+ </li>
5021
+ </ol></div>
5022
+ </div>
5023
+ <div class="sect3">
5024
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_caveats_amp_troubleshooting"></span><h4 data-comment-topic="caveats-troubleshooting-mbw582" data-anchor="_caveats_amp_troubleshooting">8.1.3. Caveats &amp; troubleshooting</h4>
5025
+ <div class="paragraph"><p>If your application regularly encounters permission errors or fails to find certain files, then this is an indication that your application is started as a user that you did not intent it to be run as. Other symptoms include:</p></div>
5026
+ <div class="ulist"><ul>
5027
+ <li>
5028
+ <p>
5029
+ The application fails to start because Bundler complains that it cannot find gems. This probably indicates that Bundler does not have read access to the directory that contains Bundler-installed gems.
5030
+ </p>
5031
+ </li>
5032
+ <li>
5033
+ <p>
5034
+ The application fails to start and its error message mentions the path <em>/nonexistent</em>. This probably indicates that your application is started as the <em>nobody</em> user. This is because on many systems, the <em>nobody</em> user’s home directory is <em>/nonexistent</em>.
5035
+ </p>
5036
+ </li>
4767
5037
  </ul></div>
4768
- <div class="paragraph"><p>User switching can be disabled with the
4769
- <a href="#PassengerUserSwitching">passenger_user_switching</a>
4770
- option.</p></div>
5038
+ <div class="paragraph"><p>To check whether it is indeed the case that your application is started as a different user than you intended to, see <a href="#finding_out_app_user">Finding out what user an application is running as</a>.</p></div>
5039
+ <div class="paragraph"><p>The most likely reason why your application is started as <em>nobody</em> is probably because your startup file is owned by <em>root</em>, by <em>nobody</em> or by an unknown user. To fix this, change the owner of the startup file to the owner that you want to run the application as.</p></div>
5040
+ <div class="paragraph"><p>Whatever user your application runs as, it must have read access to the <a href="#application_root">application root</a>, and read/write access to the application’s <em>logs</em> directory.</p></div>
5041
+ </div>
5042
+ <div class="sect3">
5043
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="finding_out_app_user"></span><h4 data-comment-topic="finding-out-what-user-an-application-is-running-as-1ni7zk6" data-anchor="finding_out_app_user">8.1.4. Finding out what user an application is running as</h4>
5044
+ <div class="paragraph"><p>To find our what user an application is started as, first access its URL in your browser so that Phusion Passenger starts the application. For example:</p></div>
5045
+ <div class="listingblock">
5046
+ <div class="content monospaced">
5047
+ <pre>http://www.example.local/</pre>
5048
+ </div>
5049
+ </div>
5050
+ <div class="paragraph"><p>The application will now either successfully start or fail to start. If it fails to start then you will see an error page that tells you what user the application was being started as. If you do not see the error page in the browser then set
5051
+ <a href="#PassengerFriendlyErrorPages">passenger_friendly_error_pages</a>
5052
+ on.</p></div>
5053
+ <div class="paragraph"><p>If the application successfully started, then run <span class="monospaced">passenger-status</span> to find the process’s PID:</p></div>
5054
+ <div class="listingblock">
5055
+ <div class="content monospaced">
5056
+ <pre>.---------- General information -----------
5057
+ Max pool size : 6
5058
+ Processes : 1
5059
+ Requests in top-level queue : 0
5060
+
5061
+ .---------- Application groups -----------
5062
+ /webapps/example.local#default:
5063
+ App root: /webapps/example.local
5064
+ Requests in queue: 0
5065
+ * PID: 16915 Sessions: 0 Processed: 1 Uptime: 2s
5066
+ CPU: 0% Memory : 9M Last used: 2s ago</pre>
5067
+ </div>
5068
+ </div>
5069
+ <div class="paragraph"><p>In the above example we see that the PID is 16915. Next, use <em>ps</em> to find out the user that it is running as:</p></div>
5070
+ <div class="listingblock">
5071
+ <div class="content monospaced">
5072
+ <pre># ps -o pid,user,comm -p 16915
5073
+ PID USER COMM
5074
+ 16915 phusion Passenger RackApp: /webapps/example.local</pre>
5075
+ </div>
5076
+ </div>
5077
+ <div class="paragraph"><p>As you can see, the application in this example is being run as user <em>phusion</em>.</p></div>
5078
+ </div>
4771
5079
  </div>
4772
5080
  <div class="sect2">
4773
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="reducing_memory_usage"></span><h3 data-comment-topic="reducing-memory-consumption-of-ruby-on-rails-applications-by-33--1o3z66q" data-anchor="reducing_memory_usage">8.2. Reducing memory consumption of Ruby on Rails applications by 33%</h3>
4774
- <div class="paragraph"><p>Is it possible to reduce memory consumption of your Rails applications by 33% on average,
4775
- by using <a href="http://www.rubyenterpriseedition.com/">Ruby Enterprise Edition</a>.
4776
- Please visit the website for details.</p></div>
4777
- <div class="paragraph"><p>Note that this feature does not apply to Rack applications.</p></div>
5081
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="reducing_memory_usage"></span><h3 data-comment-topic="reducing-memory-consumption-of-ruby-on-rails-applications-by-33--1o3z66q" data-anchor="reducing_memory_usage">8.2. Copy-on-write memory support (reducing memory consumption of Ruby applications)</h3>
5082
+ <div class="paragraph"><p>Phusion Passenger automatically leverages operating system virtual memory copy-on-write features in order to reduce the memory usage of Ruby applications. Experience has shown that this reduces memory usage by 33% on average. For this mechanism to work, a Ruby interpreter with a copy-on-write friendly garbage collector is required. The following Ruby interpreters have copy-on-write friendly garbage collectors:</p></div>
5083
+ <div class="ulist"><ul>
5084
+ <li>
5085
+ <p>
5086
+ MRI Ruby &gt;= 2.0. Versions prior to 2.0 did not have a copy-on-write friendly garbage collector.
5087
+ </p>
5088
+ </li>
5089
+ <li>
5090
+ <p>
5091
+ <a href="http://www.rubyenterpriseedition.com/">Ruby Enterprise Edition</a>, which was Phusion’s branch of MRI Ruby 1.8 with a copy-on-write friendly garbage collector and other enhancement. It has reached End-Of-Life as of 2012, but remains available for legacy systems.
5092
+ </p>
5093
+ </li>
5094
+ </ul></div>
4778
5095
  </div>
4779
5096
  <div class="sect2">
4780
5097
  <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="capistrano"></span><h3 data-comment-topic="capistrano-recipe-pfn4qu" data-anchor="capistrano">8.3. Capistrano recipe</h3>
@@ -4814,7 +5131,9 @@ end</pre>
4814
5131
  <div class="sect2">
4815
5132
  <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="bundler_support"></span><h3 data-comment-topic="bundler-support-19v1h43" data-anchor="bundler_support">8.4. Bundler support</h3>
4816
5133
  <div class="paragraph"><p>Phusion Passenger has automatic support for <a href="http://gembundler.com/git.html">Bundler</a>.
4817
- It works as follows:</p></div>
5134
+ The support consists of loading your application under the environment defined by your
5135
+ Gemfile. In other words, Phusion Passenger loads your application as if <em>bundle exec</em> was used.</p></div>
5136
+ <div class="paragraph"><p>The Bundler support works as follows:</p></div>
4818
5137
  <div class="ulist"><ul>
4819
5138
  <li>
4820
5139
  <p>
@@ -4839,10 +5158,22 @@ have any negative effects.</p></div>
4839
5158
  <div class="paragraph"><p>Phusion Passenger assumes that you’re using Bundler &gt;= 0.9.5. If you don’t want Phusion
4840
5159
  Passenger to run its Bundler support code, e.g. because you need to use an older version
4841
5160
  of Bundler with an incompatible API or because you use a system other than Bundler, then
4842
- you can override Phusion Passenger’s Bundler support code by creating a file
5161
+ you can override Phusion Passenger’s Bundler support code by creating an empty file
4843
5162
  <em>config/setup_load_paths.rb</em>. If this file exists then it will be required before loading
4844
5163
  the application startup file. In this file you can do whatever you need to setup Bundler
4845
5164
  or a similar system.</p></div>
5165
+ <div class="sect3">
5166
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="add_passenger_to_gemfile"></span><h4 data-comment-topic="does-phusion-passenger-itself-need-to-be-added-to-the-gemfile--xn1a11" data-anchor="add_passenger_to_gemfile">8.4.1. Does Phusion Passenger itself need to be added to the Gemfile?</h4>
5167
+ <div class="paragraph"><p>It is never necessary to add Phusion Passenger to the application’s Gemfile. In case of Phusion Passenger Standalone, it is not necessary to execute the <span class="monospaced">passenger</span> command through <span class="monospaced">bundle exec</span>. The reason for this is because Phusion Passenger automatically loads the Gemfile environment. Most other Ruby application servers do not automatically load the Gemfile environment, which is why they must be added to the Gemfile and be executed with <span class="monospaced">bundle exec</span>.</p></div>
5168
+ <div class="paragraph"><p>Even when your application uses any of the Phusion Passenger APIs, you still do not need to add Phusion Passenger to the Gemfile. The only thing you need to do is to put Phusion Passenger API calls inside <span class="monospaced">if</span> blocks that check whether Phusion Passenger is active, by checking whether the <span class="monospaced">PhusionPassenger</span> namespace is defined:</p></div>
5169
+ <div class="listingblock">
5170
+ <div class="content monospaced">
5171
+ <pre><strong>if</strong> defined?(PhusionPassenger)
5172
+ ...
5173
+ <strong>end</strong></pre>
5174
+ </div>
5175
+ </div>
5176
+ </div>
4846
5177
  </div>
4847
5178
  <div class="sect2">
4848
5179
  <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_installing_multiple_ruby_on_rails_versions"></span><h3 data-comment-topic="installing-multiple-ruby-on-rails-versions-1bp1fff" data-anchor="_installing_multiple_ruby_on_rails_versions">8.5. Installing multiple Ruby on Rails versions</h3>
@@ -4954,7 +5285,7 @@ You can actually perform out-of-band work when you receive a <span class="monosp
4954
5285
  </li>
4955
5286
  </ol></div>
4956
5287
  <div class="paragraph"><p>Note that even though you can request out-of-band work, there’s no guarantee that Phusion Passenger will send an <span class="monospaced">oob_work</span> event in a timely manner, if at all. It is also possible that Phusion Passenger sends an <span class="monospaced">oob_work</span> event without you ever having requested one. This latter could for example happen if the OOB work is administrator-initiated. Do not make any assumptions in your code.</p></div>
4957
- <div class="paragraph"><p>Here’s an example which implements out-of-band garbage collection using the Out-of-Band framework:</p></div>
5288
+ <div class="paragraph"><p>Here’s an example which implements out-of-band garbage collection using the Out-of-Band framework. This example code doesn’t do anything when the code is not being run in Phusion Passenger, thanks to the <span class="monospaced">if</span> block.</p></div>
4958
5289
  <div class="listingblock">
4959
5290
  <div class="content">
4960
5291
  <!-- Generator: GNU source-highlight 2.11.1
@@ -4966,27 +5297,32 @@ http://www.gnu.org/software/src-highlite -->
4966
5297
  response<span style="color: #990000">.</span>headers<span style="color: #990000">[</span><span style="color: #FF0000">"X-Passenger-Request-OOB-Work"</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"true"</span>
4967
5298
 
4968
5299
  <span style="font-style: italic"><span style="color: #9A1900"># Somewhere during application initialization:</span></span>
4969
- PhusionPassenger<span style="color: #990000">.</span>on_event<span style="color: #990000">(:</span>oob_work<span style="color: #990000">)</span> <span style="font-weight: bold"><span style="color: #0000FF">do</span></span>
4970
- <span style="font-style: italic"><span style="color: #9A1900"># Phusion Passenger has told us that we're ready to perform OOB work.</span></span>
4971
- t0 <span style="color: #990000">=</span> Time<span style="color: #990000">.</span>now
4972
- GC<span style="color: #990000">.</span>start
4973
- Rails<span style="color: #990000">.</span>logger<span style="color: #990000">.</span>info <span style="color: #FF0000">"Out-Of-Bound GC finished in #{Time.now - t0} sec"</span>
5300
+ <span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="font-weight: bold"><span style="color: #0000FF">defined</span></span><span style="color: #990000">?(</span>PhusionPassenger<span style="color: #990000">)</span>
5301
+ PhusionPassenger<span style="color: #990000">.</span>on_event<span style="color: #990000">(:</span>oob_work<span style="color: #990000">)</span> <span style="font-weight: bold"><span style="color: #0000FF">do</span></span>
5302
+ <span style="font-style: italic"><span style="color: #9A1900"># Phusion Passenger has told us that we're ready to perform OOB work.</span></span>
5303
+ t0 <span style="color: #990000">=</span> Time<span style="color: #990000">.</span>now
5304
+ GC<span style="color: #990000">.</span>start
5305
+ Rails<span style="color: #990000">.</span>logger<span style="color: #990000">.</span>info <span style="color: #FF0000">"Out-Of-Bound GC finished in #{Time.now - t0} sec"</span>
5306
+ <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
4974
5307
  <span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre>
4975
5308
  </div>
4976
5309
  </div>
4977
- <div class="paragraph"><p>For your convenience, Phusion Passenger provides a Rack middleware for out-of-band garbage collection. Add this to your <span class="monospaced">config.ru</span>:</p></div>
5310
+ <div class="paragraph"><p>For your convenience, Phusion Passenger provides a Rack middleware for out-of-band garbage collection. Add the following to your <span class="monospaced">config.ru</span>. Likewise, this example code doesn’t do anything when the code is not being run in Phusion Passenger, thanks to the <span class="monospaced">if</span> block.</p></div>
4978
5311
  <div class="listingblock">
4979
5312
  <div class="content">
4980
5313
  <!-- Generator: GNU source-highlight 2.11.1
4981
5314
  by Lorenzo Bettini
4982
5315
  http://www.lorenzobettini.it
4983
5316
  http://www.gnu.org/software/src-highlite -->
4984
- <pre><tt><span style="font-weight: bold"><span style="color: #000080">require</span></span> <span style="color: #FF0000">'phusion_passenger/rack/out_of_band_gc'</span>
5317
+ <pre><tt><span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="font-weight: bold"><span style="color: #0000FF">defined</span></span><span style="color: #990000">?(</span>PhusionPassenger<span style="color: #990000">)</span>
5318
+ <span style="font-weight: bold"><span style="color: #000080">require</span></span> <span style="color: #FF0000">'phusion_passenger/rack/out_of_band_gc'</span>
4985
5319
 
4986
- <span style="font-style: italic"><span style="color: #9A1900"># Trigger out-of-band GC every 5 requests.</span></span>
4987
- use PhusionPassenger<span style="color: #990000">::</span>Rack<span style="color: #990000">::</span>OutOfBandGc<span style="color: #990000">,</span> <span style="color: #993399">5</span></tt></pre>
5320
+ <span style="font-style: italic"><span style="color: #9A1900"># Trigger out-of-band GC every 5 requests.</span></span>
5321
+ use PhusionPassenger<span style="color: #990000">::</span>Rack<span style="color: #990000">::</span>OutOfBandGc<span style="color: #990000">,</span> <span style="color: #993399">5</span>
5322
+ <span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre>
4988
5323
  </div>
4989
5324
  </div>
5325
+ <div class="paragraph"><p>It should be noted that, although the application uses the Phusion Passenger API, it is <a href="#add_passenger_to_gemfile"><strong>not</strong> necessary to add Phusion Passenger to the Gemfile</a>.</p></div>
4990
5326
  <div class="paragraph"><p>References:</p></div>
4991
5327
  <div class="ulist"><ul>
4992
5328
  <li>
@@ -4996,42 +5332,253 @@ use PhusionPassenger<span style="color: #990000">::</span>Rack<span style="color
4996
5332
  </li>
4997
5333
  </ul></div>
4998
5334
  </div>
4999
- </div>
5000
- </div>
5001
- <div class="sect1">
5002
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_under_the_hood"></span><h2 data-comment-topic="under-the-hood-8uney" data-anchor="_under_the_hood">9. Under the hood</h2>
5003
- <div class="sectionbody">
5004
- <div class="paragraph"><p>Phusion Passenger hides a lot of complexity for the end user (i.e. the web server
5005
- system administrator), but sometimes it is desirable to know what is going on.
5006
- This section describes a few things that Phusion Passenger does under the hood.</p></div>
5007
5335
  <div class="sect2">
5008
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_page_caching_support"></span><h3 data-comment-topic="page-caching-support-nafhf6" data-anchor="_page_caching_support">9.1. Page caching support</h3>
5009
- <div class="paragraph"><p>For each HTTP request, Phusion Passenger will automatically look for a corresponding
5010
- page cache file, and serve that if it exists. It does this by appending ".html" to
5011
- the filename that the URI normally maps to, and checking whether that file exists.
5012
- This check occurs after checking whether the original mapped filename exists (as part
5013
- of static asset serving). All this is done without the need for special mod_rewrite
5014
- rules.</p></div>
5015
- <div class="paragraph"><p>For example, suppose that the browser requests <em>/foo/bar</em>.</p></div>
5016
- <div class="olist arabic"><ol class="arabic">
5336
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="flying_passenger"></span><h3 data-comment-topic="flying-passenger-137qg5e" data-anchor="flying_passenger">8.9. Flying Passenger</h3>
5337
+ <div class="paragraph"><p><strong>This feature is only available in <a href="https://www.phusionpassenger.com/enterprise">Phusion Passenger Enterprise</a>. It was introduced in version 4.0.6. <a href="https://www.phusionpassenger.com/download">Buy Phusion Passenger Enterprise here.</a></strong></p></div>
5338
+ <div class="paragraph"><p>Flying Passenger allows one to decouple Phusion Passenger’s life time from the web server’s life time, so that the web server can be independently restarted from Phusion Passenger, and from any of the application processes served by Phusion Passenger.</p></div>
5339
+ <div class="paragraph"><p>Normally, Phusion Passenger starts together with the web server, and shuts down together with the web server. The advantages of this default behavior is that it makes Phusion Passenger easy to administer: one only has to deal with the web server process and can expect all relevant processes to be cleaned up after a web server shut down. However this also brings about a disadvantage: every time one restarts the web server (e.g. to make a minor configuration change), Phusion Passenger and all its application processes also get restarted.</p></div>
5340
+ <div class="paragraph"><p>This problem is solved by <em>Flying Passenger</em>, which is an advanced mode of operation in Phusion Passenger that allows the web server to be indepedently restarted from Phusion Passenger. When this mode is enabled:</p></div>
5341
+ <div class="ulist"><ul>
5017
5342
  <li>
5018
5343
  <p>
5019
- Phusion Passenger will first check whether this URI maps to a static file, i.e.
5020
- whether the file <em>foo/bar</em> exists in the web application’s <em>public</em> directory.
5021
- If it does then Phusion Passenger will serve this file through the web server immediately.
5344
+ One must start Phusion Passenger separately from the web server, namely by starting the Flying Passenger daemon. This daemon must - to an extent - be separately configured and managed from the web server.
5022
5345
  </p>
5023
5346
  </li>
5024
5347
  <li>
5025
5348
  <p>
5026
- If that doesn’t exist, then Phusion Passenger will check whether the file
5027
- <em>foo/bar.html</em> exists. If it does then Phusion Passenger will serve this file
5028
- through the web server immediately.
5349
+ The web server must be configured to forward requests to the Flying Passenger daemon.
5029
5350
  </p>
5030
5351
  </li>
5031
5352
  <li>
5032
5353
  <p>
5033
- If <em>foo/bar.html</em> doesn’t exist either, then Phusion Passenger will forward the
5034
- request to the underlying web application.
5354
+ You should beware of the <a href="#flying_passenger_caveats">caveats and limitations</a>.
5355
+ </p>
5356
+ </li>
5357
+ </ul></div>
5358
+ <div class="sect3">
5359
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_requirements_2"></span><h4 data-comment-topic="requirements-194ysj6" data-anchor="_requirements_2">8.9.1. Requirements</h4>
5360
+ <div class="paragraph"><p>At this time, this feature is <strong>only available in the Enterprise version of Phusion Passenger for Nginx</strong>. You must have Phusion Passenger for Nginx properly installed.</p></div>
5361
+ </div>
5362
+ <div class="sect3">
5363
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_basic_usage"></span><h4 data-comment-topic="basic-usage-1qtgvwx" data-anchor="_basic_usage">8.9.2. Basic usage</h4>
5364
+ <div class="paragraph"><p>Start the Flying Passenger daemon by invoking the <span class="monospaced">flying-passenger</span> command. The only required option is <span class="monospaced">--socket-file</span>. Depending on whether you wish to enable <a href="#user_switching">User Switching</a>, you have to start <span class="monospaced">flying-passenger</span> with root privileges or not.</p></div>
5365
+ <div class="listingblock">
5366
+ <div class="content monospaced">
5367
+ <pre>$ sudo flying-passenger --socket-file=/var/run/flying-passenger.sock
5368
+ I, [2013-06-14T09:10:13.095339 #77179] INFO -- : Welcome to Flying Passenger 4.1.0
5369
+ I, [2013-06-14T09:10:13.095339 #77179] INFO -- : Starting PassengerWatchdog...
5370
+ I, [2013-06-14T09:10:13.097036 #77179] INFO -- : PassengerWatchdog started on PID 77181
5371
+ ...
5372
+ I, [2013-06-14T09:10:13.129017 #77179] INFO -- : PassengerWatchdog initialized properly
5373
+ I, [2013-06-14T09:10:13.129127 #77179] INFO -- : Flying Passenger up and listening on /var/run/flying-passenger.sock!</pre>
5374
+ </div>
5375
+ </div>
5376
+ <div class="paragraph"><p>Now configure Phusion Passenger for Nginx to make use of the Flying Passenger daemon, by setting the <span class="monospaced">passenger_fly_with</span> option to the socket filename:</p></div>
5377
+ <div class="listingblock">
5378
+ <div class="content monospaced">
5379
+ <pre>http {
5380
+ ...
5381
+ passenger_fly_with /var/run/flying-passenger.sock;
5382
+ ...
5383
+ }</pre>
5384
+ </div>
5385
+ </div>
5386
+ <div class="paragraph"><p>After (re)starting Nginx, Nginx + Flying Passenger is fully operational:</p></div>
5387
+ <div class="listingblock">
5388
+ <div class="content monospaced">
5389
+ <pre>$ sudo /path-to/nginx</pre>
5390
+ </div>
5391
+ </div>
5392
+ <div class="paragraph"><p>You can test it by adding a virtual host for a web app:</p></div>
5393
+ <div class="listingblock">
5394
+ <div class="content monospaced">
5395
+ <pre>http {
5396
+ ...
5397
+
5398
+ server {
5399
+ listen 80;
5400
+ server_name www.foo.local;
5401
+ root /webapps/foo/public;
5402
+ passenger_enabled on;
5403
+ }
5404
+ }</pre>
5405
+ </div>
5406
+ </div>
5407
+ <div class="paragraph"><p>Verify that it works by making an HTTP request to it:</p></div>
5408
+ <div class="listingblock">
5409
+ <div class="content monospaced">
5410
+ <pre>$ curl http://www.foo.local/</pre>
5411
+ </div>
5412
+ </div>
5413
+ <div class="paragraph"><p>Now let’s verify that restarting the web server does not restart the just-spawned application process. Run <span class="monospaced">passenger-status</span> to obtain the PID of the application process:</p></div>
5414
+ <div class="listingblock">
5415
+ <div class="content monospaced">
5416
+ <pre>$ sudo passenger-status
5417
+ Version: 4.1.0
5418
+ Date : 2013-06-14 09:21:51 -0400
5419
+ .---------- General information -----------
5420
+ Max pool size : 6
5421
+ Processes : 1
5422
+ Requests in top-level queue : 0
5423
+
5424
+ .---------- Application groups -----------
5425
+ /webapps/foo#default:
5426
+ App root: /webapps/foo
5427
+ Requests in queue: 0
5428
+ * PID: 77283 Sessions: 0 Processed: 1 Uptime: 2s
5429
+ CPU: 1% Memory : 8M Last used: 2s ago</pre>
5430
+ </div>
5431
+ </div>
5432
+ <div class="paragraph"><p>As you can see, the PID of the application process is <strong>77283</strong>. Now let’s see what happens if we restart Nginx:</p></div>
5433
+ <div class="listingblock">
5434
+ <div class="content monospaced">
5435
+ <pre>$ sudo /path-to/nginx -s stop
5436
+ $ sudo /path-to/nginx
5437
+ $ sudo passenger-status</pre>
5438
+ </div>
5439
+ </div>
5440
+ <div class="paragraph"><p>The application process should remain there, unchanged:</p></div>
5441
+ <div class="listingblock">
5442
+ <div class="content monospaced">
5443
+ <pre>$ sudo passenger-status
5444
+ Version: 4.1.0
5445
+ Date : 2013-06-14 09:21:51 -0400
5446
+ .---------- General information -----------
5447
+ Max pool size : 6
5448
+ Processes : 1
5449
+ Requests in top-level queue : 0
5450
+
5451
+ .---------- Application groups -----------
5452
+ /webapps/foo#default:
5453
+ App root: /webapps/foo
5454
+ Requests in queue: 0
5455
+ * PID: 77283 Sessions: 0 Processed: 1 Uptime: 18s
5456
+ CPU: 1% Memory : 8M Last used: 18s ago</pre>
5457
+ </div>
5458
+ </div>
5459
+ </div>
5460
+ <div class="sect3">
5461
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="configuring_flying_passenger"></span><h4 data-comment-topic="configuring-flying-passenger-n558np" data-anchor="configuring_flying_passenger">8.9.3. Configuring Flying Passenger</h4>
5462
+ <div class="paragraph"><p>Flying Passenger gets <strong>some</strong> configuration from the web server, but not all. In particular, most web server directives that are only valid in the <span class="monospaced">http</span> context, e.g. <a href="#PassengerLogLevel">passenger_log_level</a>, have no effect when using Flying Passenger. Instead, you are supposed to pass these configuration directives through command line options to the Flying Passenger daemon. Configuration directives that have no effect on Flying Passenger are documented as such. You can assume that configuration directives that are not documented as such, work fine on Flying Passenger.</p></div>
5463
+ <div class="paragraph"><p>For example, to achieve the same effect as setting passenger_log_level to 2, run the Flying Passenger daemon as follows:</p></div>
5464
+ <div class="listingblock">
5465
+ <div class="content monospaced">
5466
+ <pre>$ sudo flying-passenger --socket-file=/var/run/flying-passenger.sock --log-level=2</pre>
5467
+ </div>
5468
+ </div>
5469
+ <div class="paragraph"><p>Currently, not all configuration directives have a Flying Passenger equivalent. Run the following command to see an overview of available options:</p></div>
5470
+ <div class="listingblock">
5471
+ <div class="content monospaced">
5472
+ <pre>$ flying-passenger --help</pre>
5473
+ </div>
5474
+ </div>
5475
+ </div>
5476
+ <div class="sect3">
5477
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_managing_the_flying_passenger_daemon"></span><h4 data-comment-topic="managing-the-flying-passenger-daemon-vjmzdh" data-anchor="_managing_the_flying_passenger_daemon">8.9.4. Managing the Flying Passenger daemon</h4>
5478
+ <div class="paragraph"><p>The Flying Passenger daemon runs in the foreground by default. This is undesirable on server environments. You can make it go into the background by passing <span class="monospaced">--daemonize</span>, <span class="monospaced">--log-file</span> and <span class="monospaced">--pid-file</span>:</p></div>
5479
+ <div class="listingblock">
5480
+ <div class="content monospaced">
5481
+ <pre>$ sudo flying-passenger --socket-file=/var/run/flying-passenger.sock \
5482
+ --daemonize --log-file=/var/log/flying-passenger.log \
5483
+ --pid-file=/var/run/flying-passenger.pid</pre>
5484
+ </div>
5485
+ </div>
5486
+ <div class="paragraph"><p>You can shut down a Flying Passenger daemon by sending SIGINT or SIGTERM to it:</p></div>
5487
+ <div class="listingblock">
5488
+ <div class="content monospaced">
5489
+ <pre>$ kill `cat /var/run/flying-passenger.pid`</pre>
5490
+ </div>
5491
+ </div>
5492
+ <div class="paragraph"><p>We recommend using <a href="http://cr.yp.to/daemontools.html">daemontools</a> or <a href="http://smarden.org/runit/">runit</a> for managing the Flying Passenger daemon. These tools will allow automatically starting the Flying Passenger daemon at boot, and will automatically restart the daemon if it crashes. You can create and enable a daemontools/runit service as folows:</p></div>
5493
+ <div class="listingblock">
5494
+ <div class="content monospaced">
5495
+ <pre>$ sudo mkdir /etc/service/flying-passenger
5496
+ $ sudo nano /etc/service/flying-passenger/run
5497
+ #!/bin/sh
5498
+ exec /path-to/flying-passenger \
5499
+ --socket-file=/var/run/flying-passenger.sock \
5500
+ --log-file=/var/log/flying-passenger.log \
5501
+ --pid-file=/var/run/flying-passenger.pid</pre>
5502
+ </div>
5503
+ </div>
5504
+ <div class="paragraph"><p>Immediately after creating the <span class="monospaced">run</span> file, daemontools/runit automatically runs it to start the daemon. Note that the location (<span class="monospaced">/etc/service</span>) depends on the OS or Linux distros. Sometimes it’s <span class="monospaced">/service</span>. Also note that we start the Flying Passenger daemon without <span class="monospaced">--daemonize</span>.</p></div>
5505
+ <div class="paragraph"><p>To shut down a daemontools/runit-managed daemon, you need to use <span class="monospaced">svc -d /etc/service/flying-passenger</span> (daemontools) or <span class="monospaced">sv stop /etc/service/flying-passenger</span> (runit) instead of sending a signal to the process.</p></div>
5506
+ </div>
5507
+ <div class="sect3">
5508
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="flying_passenger_caveats"></span><h4 data-comment-topic="caveats-and-limitations-15wakf" data-anchor="flying_passenger_caveats">8.9.5. Caveats and limitations</h4>
5509
+ <div class="paragraph"><p>Beware of the following caveats and limitations when using Flying Passenger:</p></div>
5510
+ <div class="ulist"><ul>
5511
+ <li>
5512
+ <p>
5513
+ The Nginx executable <strong>must</strong> be compiled with the same version of Phusion Passenger as the Flying Passenger daemon. Failing to meet this requirement may result in cryptic errors, or may result in certain features not working, until you’ve fixed the situation. When upgrading Phusion Passenger, you must restart both Nginx and the Flying Passenger daemon.
5514
+ </p>
5515
+ </li>
5516
+ <li>
5517
+ <p>
5518
+ The <a href="#PassengerRoot">passenger_root</a> directive has no effect. When using Flying Passenger, you are not supposed to set <span class="monospaced">passenger_root</span>.
5519
+ </p>
5520
+ </li>
5521
+ <li>
5522
+ <p>
5523
+ When you add a new application to the web server configuration, Flying Passenger will automatically pick up the application’s settings and spawn this new application upon the first request to it. However it is not capable of automatically starting the new app before a request has been sent to it (i.e. <a href="#PassengerPreStart">passenger_pre_start</a>-like behavior is not available in this case). As a workaround, you can send an HTTP request to your application after starting the daemon, which forces it to spawn application processes.
5524
+ </p>
5525
+ </li>
5526
+ <li>
5527
+ <p>
5528
+ When you remove an application from the web server configuration, Flying Passenger will not detect the removal and will not shut down the associated application processes. Killing the application processes will also not help, because Flying Passenger will restart them per the (now-removed, but still in the Flying Passenger daemon’s memory) <a href="#PassengerMinInstances">passenger_min_instances</a> settings. At the moment, there are two ways to get rid of those processes:
5529
+ </p>
5530
+ <div class="ulist"><ul>
5531
+ <li>
5532
+ <p>
5533
+ Before removing the application from the web server configuration, explicitly set its <span class="monospaced">passenger_min_instances</span> to 0. Next, send a request to it, which will cause the Flying Passenger daemon to take over the new <span class="monospaced">passenger_min_instances 0</span> option. You can then proceed with removing the application from the web server configuration, and restarting the web server. Finally, kill the PIDs associated to those application processes and remove the application configuration.
5534
+ </p>
5535
+ </li>
5536
+ <li>
5537
+ <p>
5538
+ Restart the Flying Passenger daemon.
5539
+ </p>
5540
+ </li>
5541
+ </ul></div>
5542
+ </li>
5543
+ </ul></div>
5544
+ </div>
5545
+ </div>
5546
+ </div>
5547
+ </div>
5548
+ <div class="sect1">
5549
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_under_the_hood"></span><h2 data-comment-topic="under-the-hood-8uney" data-anchor="_under_the_hood">9. Under the hood</h2>
5550
+ <div class="sectionbody">
5551
+ <div class="paragraph"><p>Phusion Passenger hides a lot of complexity for the end user (i.e. the web server
5552
+ system administrator), but sometimes it is desirable to know what is going on.
5553
+ This section describes a few things that Phusion Passenger does under the hood.</p></div>
5554
+ <div class="sect2">
5555
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_page_caching_support"></span><h3 data-comment-topic="page-caching-support-nafhf6" data-anchor="_page_caching_support">9.1. Page caching support</h3>
5556
+ <div class="paragraph"><p>For each HTTP request, Phusion Passenger will automatically look for a corresponding
5557
+ page cache file, and serve that if it exists. It does this by appending ".html" to
5558
+ the filename that the URI normally maps to, and checking whether that file exists.
5559
+ This check occurs after checking whether the original mapped filename exists (as part
5560
+ of static asset serving). All this is done without the need for special mod_rewrite
5561
+ rules.</p></div>
5562
+ <div class="paragraph"><p>For example, suppose that the browser requests <em>/foo/bar</em>.</p></div>
5563
+ <div class="olist arabic"><ol class="arabic">
5564
+ <li>
5565
+ <p>
5566
+ Phusion Passenger will first check whether this URI maps to a static file, i.e.
5567
+ whether the file <em>foo/bar</em> exists in the web application’s <em>public</em> directory.
5568
+ If it does then Phusion Passenger will serve this file through the web server immediately.
5569
+ </p>
5570
+ </li>
5571
+ <li>
5572
+ <p>
5573
+ If that doesn’t exist, then Phusion Passenger will check whether the file
5574
+ <em>foo/bar.html</em> exists. If it does then Phusion Passenger will serve this file
5575
+ through the web server immediately.
5576
+ </p>
5577
+ </li>
5578
+ <li>
5579
+ <p>
5580
+ If <em>foo/bar.html</em> doesn’t exist either, then Phusion Passenger will forward the
5581
+ request to the underlying web application.
5035
5582
  </p>
5036
5583
  </li>
5037
5584
  </ol></div>
@@ -5478,6 +6025,332 @@ has no effect.</p></div>
5478
6025
  </div>
5479
6026
  </div>
5480
6027
  </div>
6028
+ <div class="sect1">
6029
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="about_environment_variables"></span><h2 data-comment-topic="appendix-d-about-environment-variables-1t2cuff" data-anchor="about_environment_variables">13. Appendix D: About environment variables</h2>
6030
+ <div class="sectionbody">
6031
+ <div class="paragraph"><p>The Phusion Passenger compilation process can be customized with environment variables.</p></div>
6032
+ <div class="paragraph"><p>Environment variables are named values that affect how the system works. For example they tell the system where to look for commands (the <span class="monospaced">PATH</span> variable) or where to look for libraries (<span class="monospaced">LD_LIBRARY_PATH</span>). Their names are often in all-uppercase. Sometimes people refer to an environment variable with a dollar sign <span class="monospaced">$</span> in front, but that’s the same thing: when people say "the $PATH environment variable" they mean "the PATH environment variable". This is because the dollar sign <span class="monospaced">$</span> is a shell syntax for refering to an environment variable, as you will learn later.</p></div>
6033
+ <div class="paragraph"><p>Environment variables are set on a <strong>per-process</strong> basis, but they are <strong>inherited</strong> by child processes. This means that if you set environment variables in process A, another already running process B will not see these new environment variables. But if A spawns a child process C, then C will have all environment variables that A had. If you once again change the environment variables in A, then C will not see the changes.</p></div>
6034
+ <div class="paragraph"><p>The per-process nature of environment variables some implications. When you set environment variables in your <span class="monospaced">bashrc</span> or other bash startup files…</p></div>
6035
+ <div class="ulist"><ul>
6036
+ <li>
6037
+ <p>
6038
+ …only newly spawned bash shells see them.
6039
+ </p>
6040
+ </li>
6041
+ <li>
6042
+ <p>
6043
+ …the web server usually does not see them, because the web server tends to be started from init scripts, not from bash.
6044
+ </p>
6045
+ </li>
6046
+ <li>
6047
+ <p>
6048
+ …cron jobs do not see them, because cron jobs' environment variables are entirely dictated by their crontabs.
6049
+ </p>
6050
+ </li>
6051
+ </ul></div>
6052
+ <div class="admonitionblock">
6053
+ <table><tr>
6054
+ <td class="icon">
6055
+ <img src="./images/icons/note.png" alt="Note">
6056
+ </td>
6057
+ <td class="content">Because this chapter is meant for beginners, it assumes that the reader uses the bash shell. This chapter does not describe instructions for zsh, csh or other shells. We assume that users of other shells are familiar with the Bourne shell syntax, and know how to apply the instructions in this chapter in their shells' native syntaxes.</td>
6058
+ </tr></table>
6059
+ </div>
6060
+ <div class="sect2">
6061
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_working_with_environment_variables"></span><h3 data-comment-topic="working-with-environment-variables-1kmvq8w" data-anchor="_working_with_environment_variables">13.1. Working with environment variables</h3>
6062
+ <div class="paragraph"><p>You can see all environment variables in your shell by running the following command:</p></div>
6063
+ <div class="listingblock">
6064
+ <div class="content">
6065
+ <!-- Generator: GNU source-highlight 2.11.1
6066
+ by Lorenzo Bettini
6067
+ http://www.lorenzobettini.it
6068
+ http://www.gnu.org/software/src-highlite -->
6069
+ <pre><tt>env</tt></pre>
6070
+ </div>
6071
+ </div>
6072
+ <div class="paragraph"><p>You can set an evironment variable with the syntax <span class="monospaced">export &lt;NAME&gt;=&lt;VALUE&gt;</span>. For example, to set the <span class="monospaced">APXS2</span> variable to the value <span class="monospaced">/usr/sbin/apxs2</span>:</p></div>
6073
+ <div class="listingblock">
6074
+ <div class="content">
6075
+ <!-- Generator: GNU source-highlight 2.11.1
6076
+ by Lorenzo Bettini
6077
+ http://www.lorenzobettini.it
6078
+ http://www.gnu.org/software/src-highlite -->
6079
+ <pre><tt><span style="font-weight: bold"><span style="color: #0000FF">export</span></span> <span style="color: #009900">APXS2</span><span style="color: #990000">=</span>/usr/sbin/apxs<span style="color: #993399">2</span></tt></pre>
6080
+ </div>
6081
+ </div>
6082
+ <div class="paragraph"><p>Any process that you run from your shell from that point on will have said environment variable:</p></div>
6083
+ <div class="listingblock">
6084
+ <div class="content">
6085
+ <!-- Generator: GNU source-highlight 2.11.1
6086
+ by Lorenzo Bettini
6087
+ http://www.lorenzobettini.it
6088
+ http://www.gnu.org/software/src-highlite -->
6089
+ <pre><tt><span style="font-weight: bold"><span style="color: #0000FF">export</span></span> <span style="color: #009900">APXS2</span><span style="color: #990000">=</span>/usr/sbin/apxs<span style="color: #993399">2</span>
6090
+ ruby -e <span style="color: #FF0000">'p ENV["APXS2"]'</span>
6091
+ <span style="font-style: italic"><span style="color: #9A1900"># =&gt; "/usr/sbin/apxs2"</span></span></tt></pre>
6092
+ </div>
6093
+ </div>
6094
+ <div class="admonitionblock">
6095
+ <table><tr>
6096
+ <td class="icon">
6097
+ <img src="./images/icons/note.png" alt="Note">
6098
+ </td>
6099
+ <td class="content">
6100
+ <div class="title">The "export" keyword is important</div>
6101
+ <div class="paragraph"><p>You <strong>must</strong> set the <span class="monospaced">export</span> keyword. If you omit the <span class="monospaced">export</span> keyword then the environment variable will not be visible to other processes:</p></div>
6102
+ <div class="listingblock">
6103
+ <div class="content">
6104
+ <!-- Generator: GNU source-highlight 2.11.1
6105
+ by Lorenzo Bettini
6106
+ http://www.lorenzobettini.it
6107
+ http://www.gnu.org/software/src-highlite -->
6108
+ <pre><tt><span style="color: #009900">APXS2</span><span style="color: #990000">=</span>/usr/sbin/apxs<span style="color: #993399">2</span>
6109
+ ruby -e <span style="color: #FF0000">'p ENV["APXS2"]'</span>
6110
+ <span style="font-style: italic"><span style="color: #9A1900"># =&gt; nil</span></span></tt></pre>
6111
+ </div>
6112
+ </div>
6113
+ </td>
6114
+ </tr></table>
6115
+ </div>
6116
+ <div class="paragraph"><p>You can reference an environment variable in your shell by typing the <span class="monospaced">$</span> sign followed by the environment variable’s name. For example, to see the value of the <span class="monospaced">PATH</span> variable:</p></div>
6117
+ <div class="listingblock">
6118
+ <div class="content">
6119
+ <!-- Generator: GNU source-highlight 2.11.1
6120
+ by Lorenzo Bettini
6121
+ http://www.lorenzobettini.it
6122
+ http://www.gnu.org/software/src-highlite -->
6123
+ <pre><tt>echo <span style="color: #009900">$PATH</span></tt></pre>
6124
+ </div>
6125
+ </div>
6126
+ <div class="paragraph"><p>You can also use this trick to extend the value of an environment variable:</p></div>
6127
+ <div class="listingblock">
6128
+ <div class="content">
6129
+ <!-- Generator: GNU source-highlight 2.11.1
6130
+ by Lorenzo Bettini
6131
+ http://www.lorenzobettini.it
6132
+ http://www.gnu.org/software/src-highlite -->
6133
+ <pre><tt><span style="font-weight: bold"><span style="color: #0000FF">export</span></span> <span style="color: #009900">PATH</span><span style="color: #990000">=</span>/usr/bin
6134
+
6135
+ <span style="font-style: italic"><span style="color: #9A1900"># Prepends '/opt/local/bin', so that it becomes /opt/local/bin:/usr/bin</span></span>
6136
+ <span style="font-weight: bold"><span style="color: #0000FF">export</span></span> <span style="color: #009900">PATH</span><span style="color: #990000">=</span>/opt/local/bin<span style="color: #990000">:</span><span style="color: #009900">$PATH</span>
6137
+ <span style="font-style: italic"><span style="color: #9A1900"># Appends '/usr/local/bin', so that it becomes /opt/local/bin:/usr/bin:/usr/local/bin</span></span>
6138
+ <span style="font-weight: bold"><span style="color: #0000FF">export</span></span> <span style="color: #009900">PATH</span><span style="color: #990000">=</span><span style="color: #009900">$PATH</span><span style="color: #990000">:</span>/usr/local/bin</tt></pre>
6139
+ </div>
6140
+ </div>
6141
+ </div>
6142
+ <div class="sect2">
6143
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_the_path_environment_variable"></span><h3 data-comment-topic="the-path-environment-variable-vlp05e" data-anchor="_the_path_environment_variable">13.2. The PATH environment variable</h3>
6144
+ <div class="paragraph"><p>The <span class="monospaced">PATH</span> environment variable dictates where the system looks for command. It is a colon-separated list of directories. If you get a "command not found" error while you know that the command is installed, then setting <span class="monospaced">PATH</span> will help. For example suppose that the command <span class="monospaced">frobnicator</span> is in <span class="monospaced">/opt/local/bin</span>:</p></div>
6145
+ <div class="listingblock">
6146
+ <div class="content">
6147
+ <!-- Generator: GNU source-highlight 2.11.1
6148
+ by Lorenzo Bettini
6149
+ http://www.lorenzobettini.it
6150
+ http://www.gnu.org/software/src-highlite -->
6151
+ <pre><tt>user@localhost bash$ frobnicator
6152
+ bash<span style="color: #990000">:</span> frobnicator<span style="color: #990000">:</span> <span style="font-weight: bold"><span style="color: #0000FF">command</span></span> not found</tt></pre>
6153
+ </div>
6154
+ </div>
6155
+ <div class="paragraph"><p>We verify that <span class="monospaced">/opt/local/bin</span> is not in <span class="monospaced">PATH</span>:</p></div>
6156
+ <div class="listingblock">
6157
+ <div class="content">
6158
+ <!-- Generator: GNU source-highlight 2.11.1
6159
+ by Lorenzo Bettini
6160
+ http://www.lorenzobettini.it
6161
+ http://www.gnu.org/software/src-highlite -->
6162
+ <pre><tt>user@localhost bash$ echo <span style="color: #009900">$PATH</span>
6163
+ /bin<span style="color: #990000">:</span>/usr/bin<span style="color: #990000">:</span>/usr/local/bin</tt></pre>
6164
+ </div>
6165
+ </div>
6166
+ <div class="paragraph"><p>We can run <span class="monospaced">frobnicator</span> through it’s full path…</p></div>
6167
+ <div class="listingblock">
6168
+ <div class="content">
6169
+ <!-- Generator: GNU source-highlight 2.11.1
6170
+ by Lorenzo Bettini
6171
+ http://www.lorenzobettini.it
6172
+ http://www.gnu.org/software/src-highlite -->
6173
+ <pre><tt>user@localhost bash$ /opt/local/bin/frobnicator
6174
+ <span style="font-style: italic"><span style="color: #9A1900"># =&gt; success!</span></span></tt></pre>
6175
+ </div>
6176
+ </div>
6177
+ <div class="paragraph"><p>…or we can add <span class="monospaced">/opt/local/bin</span> to <span class="monospaced">PATH</span>.</p></div>
6178
+ <div class="listingblock">
6179
+ <div class="content">
6180
+ <!-- Generator: GNU source-highlight 2.11.1
6181
+ by Lorenzo Bettini
6182
+ http://www.lorenzobettini.it
6183
+ http://www.gnu.org/software/src-highlite -->
6184
+ <pre><tt>user@localhost bash$ <span style="font-weight: bold"><span style="color: #0000FF">export</span></span> <span style="color: #009900">PATH</span><span style="color: #990000">=</span><span style="color: #009900">$PATH</span><span style="color: #990000">:</span>/opt/local/bin
6185
+ user@localhost bash$ frobnicator
6186
+ <span style="font-style: italic"><span style="color: #9A1900"># =&gt; success!</span></span></tt></pre>
6187
+ </div>
6188
+ </div>
6189
+ </div>
6190
+ <div class="sect2">
6191
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_making_environment_variables_permanent"></span><h3 data-comment-topic="making-environment-variables-permanent-1wjyhzt" data-anchor="_making_environment_variables_permanent">13.3. Making environment variables permanent</h3>
6192
+ <div class="paragraph"><p>When you exit your shell, the evironment variable changes are lost. There is no standard method to set environment variables system-wide, so you have to set them in different configuration files for different services.</p></div>
6193
+ <div class="sect3">
6194
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_bash"></span><h4 data-comment-topic="bash-19xsxec" data-anchor="_bash">13.3.1. bash</h4>
6195
+ <div class="paragraph"><p>To make environment variables permanent for future bash sessions <strong>for the current user</strong>, add them to your <span class="monospaced">~/.bashrc</span>:</p></div>
6196
+ <div class="listingblock">
6197
+ <div class="content">
6198
+ <!-- Generator: GNU source-highlight 2.11.1
6199
+ by Lorenzo Bettini
6200
+ http://www.lorenzobettini.it
6201
+ http://www.gnu.org/software/src-highlite -->
6202
+ <pre><tt>echo <span style="color: #FF0000">'export FOO=bar'</span> <span style="color: #990000">&gt;&gt;</span> <span style="color: #990000">~/.</span>bashrc
6203
+ echo <span style="color: #FF0000">'export PATH=/usr/local/bin:$PATH'</span> <span style="color: #990000">&gt;&gt;</span> <span style="color: #990000">~/.</span>bashrc</tt></pre>
6204
+ </div>
6205
+ </div>
6206
+ <div class="paragraph"><p>To make them permanent for future bash sessions <strong>for all users</strong>, add them to <span class="monospaced">/etc/bashrc</span>.</p></div>
6207
+ <div class="admonitionblock">
6208
+ <table><tr>
6209
+ <td class="icon">
6210
+ <img src="./images/icons/note.png" alt="Note">
6211
+ </td>
6212
+ <td class="content">Depending on the system, the bashrc file may have a different filename. On Debian and Ubuntu, it’s <span class="monospaced">/etc/bash.bashrc</span>.</td>
6213
+ </tr></table>
6214
+ </div>
6215
+ </div>
6216
+ <div class="sect3">
6217
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_apache"></span><h4 data-comment-topic="apache-9hqtyj" data-anchor="_apache">13.3.2. Apache</h4>
6218
+ <div class="admonitionblock">
6219
+ <table><tr>
6220
+ <td class="icon">
6221
+ <img src="./images/icons/note.png" alt="Note">
6222
+ </td>
6223
+ <td class="content">This subsection describes how to set environment variables on Apache itself, not on apps served through Phusion Passenger for Apache. The environment variables you set here will be passed to all apps, but you cannot customize them on a per-app basis. See also <a href="#env_vars_passenger_apps">Setting environment variables on Phusion Passenger-served apps</a>.</td>
6224
+ </tr></table>
6225
+ </div>
6226
+ <div class="paragraph"><p>On Debian and Ubuntu, with an Apache installed through apt, Apache environment variables are defined in the file <span class="monospaced">/etc/apache2/envvars</span>. This is a shell script so environment variables must be specified with the shell syntax.</p></div>
6227
+ <div class="paragraph"><p>On Red Hat, Fedora, CentOS and ScientificLinux, with an Apache installed through YUM, Apache environment variables are defined in <span class="monospaced">/etc/sysconfig/httpd</span>.</p></div>
6228
+ <div class="paragraph"><p>On OS X they are defined in <span class="monospaced">/System/Library/LaunchDaemons/org.apache.httpd.plist</span>, as explained <a href="/System/Library/LaunchDaemons/org.apache.httpd.plist">here on Stack Overflow</a>.</p></div>
6229
+ <div class="paragraph"><p>On other systems, or if you did not install Apache through the system’s package manager, the configuration file for environment variables is specific to the vendor that supplied Apache. There may not even be such a configuration file. You should contact the vendor for support.</p></div>
6230
+ </div>
6231
+ <div class="sect3">
6232
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_nginx"></span><h4 data-comment-topic="nginx-157dpwy" data-anchor="_nginx">13.3.3. Nginx</h4>
6233
+ <div class="admonitionblock">
6234
+ <table><tr>
6235
+ <td class="icon">
6236
+ <img src="./images/icons/note.png" alt="Note">
6237
+ </td>
6238
+ <td class="content">This subsection describes how to set environment variables on Nginx itself, not on apps served through Phusion Passenger for Nginx. The environment variables you set here will be passed to all apps, but you cannot customize them on a per-app basis. See also <a href="#env_vars_passenger_apps">Setting environment variables on Phusion Passenger-served apps</a>.</td>
6239
+ </tr></table>
6240
+ </div>
6241
+ <div class="paragraph"><p>If you installed Nginx through <a href="#install_on_debian_ubuntu">the Brightbox packages</a>, then you can define environment variables in <span class="monospaced">/etc/default/nginx</span>. This is a shell script so you must use the <span class="monospaced">export FOO=bar</span> syntax.</p></div>
6242
+ <div class="paragraph"><p>Otherwise, environment variables are best set through the script which starts Nginx. For example, if you installed Nginx from source and you used
6243
+ &lt;&lt;nginx_init_script,the Nginx init script described earlier in this manual,
6244
+ then you should edit that script to define the environment variables. Those init scripts are regular shell scripts, so use the <span class="monospaced">export FOO=bar</span> syntax. Just make sure your set your environment variables before the script starts Nginx.</p></div>
6245
+ <div class="admonitionblock">
6246
+ <table><tr>
6247
+ <td class="icon">
6248
+ <img src="./images/icons/note.png" alt="Note">
6249
+ </td>
6250
+ <td class="content">Setting environment variables on Nginx has no effect on the <a href="#flying_passenger">Flying Passenger daemon</a> because the daemon is started seperately. You should set the environment variables in the shell right before starting the daemon.</td>
6251
+ </tr></table>
6252
+ </div>
6253
+ </div>
6254
+ <div class="sect3">
6255
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_cron"></span><h4 data-comment-topic="cron-1nuc9cz" data-anchor="_cron">13.3.4. cron</h4>
6256
+ <div class="paragraph"><p>To make environment variables permanent for cron jobs, add those variables to the relevant crontab. But note that inside crontabs you cannot refer to existing environment variables with the <span class="monospaced">$</span> syntax because crontabs are not shell scripts. You have to specify the entire value.</p></div>
6257
+ <div class="listingblock">
6258
+ <div class="title">What to put in "crontab -e"</div>
6259
+ <div class="content monospaced">
6260
+ <pre># Environment variable definitions
6261
+ FOO=bar
6262
+ APXS2=/usr/sbin/apxs2
6263
+
6264
+ # **WRONG!** You cannot refer to existing variables with the `$` syntax!
6265
+ PATH=/usr/bin:$PATH
6266
+ # **WRONG!** You cannot use the 'export' keyword!
6267
+ export PATH=/usr/bin:/usr/local/bin
6268
+ # Correct:
6269
+ PATH=/usr/bin:/usr/local/bin
6270
+
6271
+ # Jobs:
6272
+ # m h dom mon dow command
6273
+ * * * * * frobnicator</pre>
6274
+ </div>
6275
+ </div>
6276
+ </div>
6277
+ <div class="sect3">
6278
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="env_vars_passenger_apps"></span><h4 data-comment-topic="phusion-passenger-served-apps-uiewl5" data-anchor="env_vars_passenger_apps">13.3.5. Phusion Passenger-served apps</h4>
6279
+ <div class="paragraph"><p>You can pass environment variables to Phusion Passenger-served apps through various methods:</p></div>
6280
+ <div class="ulist"><ul>
6281
+ <li>
6282
+ <p>
6283
+ When running Apache, use the <span class="monospaced">PassEnv</span> and <span class="monospaced">SetEnv</span> directives of <a href="http://httpd.apache.org/docs/2.4/mod/mod_env.html">mod_env</a>. This is supported starting from Phusion Passenger 4.0.
6284
+ </p>
6285
+ </li>
6286
+ <li>
6287
+ <p>
6288
+ When running Nginx, use the <span class="monospaced">env</span> directive. Unlike Apache, Nginx’s <span class="monospaced">env</span> directive can only be set globally and cannot be customized on a per-virtual host basis.
6289
+ </p>
6290
+ </li>
6291
+ <li>
6292
+ <p>
6293
+ Through your <span class="monospaced">bashrc</span>. Starting from version 4.0, Phusion Passenger 4.0 spawns applications through bash and inherit all bash environment variables. Phusion Passenger Standalone tends to be started from the shell and thus inherits all environment variables set by the shell.
6294
+ </p>
6295
+ </li>
6296
+ <li>
6297
+ <p>
6298
+ Through Apache and Nginx, as described earlier in this chapter. Any environment variables that you set on Apache and Nginx itself are inherited by Phusion Passenger, and thus by Phusion Passenger-served apps as well.
6299
+ </p>
6300
+ </li>
6301
+ <li>
6302
+ <p>
6303
+ Through the application itself. Most programming languages provide APIs for setting environment variables. For example in Ruby you can write:
6304
+ </p>
6305
+ <div class="listingblock">
6306
+ <div class="content">
6307
+ <!-- Generator: GNU source-highlight 2.11.1
6308
+ by Lorenzo Bettini
6309
+ http://www.lorenzobettini.it
6310
+ http://www.gnu.org/software/src-highlite -->
6311
+ <pre><tt>ENV<span style="color: #990000">[</span><span style="color: #FF0000">'FOO'</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">'bar'</span></tt></pre>
6312
+ </div>
6313
+ </div>
6314
+ <div class="paragraph"><p>In Python you can write:</p></div>
6315
+ <div class="listingblock">
6316
+ <div class="content">
6317
+ <!-- Generator: GNU source-highlight 2.11.1
6318
+ by Lorenzo Bettini
6319
+ http://www.lorenzobettini.it
6320
+ http://www.gnu.org/software/src-highlite -->
6321
+ <pre><tt><span style="font-weight: bold"><span style="color: #000080">import</span></span> os
6322
+ os<span style="color: #990000">.</span>environ<span style="color: #990000">[</span><span style="color: #FF0000">'FOO'</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">'bar'</span></tt></pre>
6323
+ </div>
6324
+ </div>
6325
+ </li>
6326
+ </ul></div>
6327
+ </div>
6328
+ </div>
6329
+ <div class="sect2">
6330
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="env_vars_and_sudo"></span><h3 data-comment-topic="environment-variables-and-sudo-10lphxn" data-anchor="env_vars_and_sudo">13.4. Environment variables and sudo</h3>
6331
+ <div class="paragraph"><p>The <span class="monospaced">sudo</span> command resets all environment variables before running the specified command, for security reasons. So if you set environment variables before running <span class="monospaced">sudo passenger-install-xxx-module</span>, <span class="monospaced">sudo passenger-status</span> or any other commands, then the environment variables are not correctly passed to the command. You can solve this by running sudo with <span class="monospaced">-E</span> (preserve environment variables):</p></div>
6332
+ <div class="listingblock">
6333
+ <div class="content">
6334
+ <!-- Generator: GNU source-highlight 2.11.1
6335
+ by Lorenzo Bettini
6336
+ http://www.lorenzobettini.it
6337
+ http://www.gnu.org/software/src-highlite -->
6338
+ <pre><tt>user@localhost bash$ <span style="font-weight: bold"><span style="color: #0000FF">export</span></span> <span style="color: #009900">APXS2</span><span style="color: #990000">=</span>/usr/sbin/apxs<span style="color: #993399">2</span>
6339
+ user@localhost bash$ sudo -E passenger-install-apache<span style="color: #993399">2</span>-module</tt></pre>
6340
+ </div>
6341
+ </div>
6342
+ <div class="paragraph"><p>Alternatively, you can obtain a root prompt with sudo first, and <strong>then</strong> set the environment variables, before running any further commands:</p></div>
6343
+ <div class="listingblock">
6344
+ <div class="content monospaced">
6345
+ <pre>user@localhost bash$ sudo -s
6346
+ Password: ...
6347
+ root@localhost bash# export APXS2=/usr/sbin/apxs2
6348
+ root@localhost bash# passenger-install-apache2-module</pre>
6349
+ </div>
6350
+ </div>
6351
+ </div>
6352
+ </div>
6353
+ </div>
5481
6354
  </div>
5482
6355
  <div id="footnotes"><hr></div>
5483
6356
  <div id="footer">