passenger 3.0.21 → 3.9.1.beta

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 (835) hide show
  1. data/DEVELOPERS.TXT +4 -10
  2. data/NEWS +19 -27
  3. data/Rakefile +20 -19
  4. data/bin/passenger +3 -2
  5. data/bin/passenger-config +35 -5
  6. data/bin/passenger-install-apache2-module +12 -12
  7. data/bin/passenger-install-nginx-module +55 -38
  8. data/bin/passenger-memory-stats +3 -1
  9. data/bin/passenger-status +7 -35
  10. data/build/agents.rb +107 -21
  11. data/build/apache2.rb +11 -46
  12. data/build/basics.rb +61 -9
  13. data/build/common_library.rb +59 -142
  14. data/build/cxx_tests.rb +111 -110
  15. data/build/documentation.rb +33 -0
  16. data/build/misc.rb +30 -12
  17. data/build/nginx.rb +10 -39
  18. data/build/oxt_tests.rb +1 -0
  19. data/build/ruby_extension.rb +1 -5
  20. data/build/test_basics.rb +3 -2
  21. data/dev/copy_boost_headers.rb +2 -1
  22. data/doc/Architectural overview.html +49 -90
  23. data/doc/DebuggingAndStressTesting.txt.md +49 -0
  24. data/doc/Packaging.txt.md +254 -0
  25. data/doc/Security of user switching support.html +35 -66
  26. data/doc/Users guide Apache.html +588 -758
  27. data/doc/Users guide Apache.idmap.txt +253 -136
  28. data/doc/Users guide Apache.txt +154 -109
  29. data/doc/Users guide Nginx.html +544 -660
  30. data/doc/Users guide Nginx.idmap.txt +179 -91
  31. data/doc/Users guide Nginx.txt +192 -118
  32. data/doc/Users guide Standalone.html +65 -48
  33. data/doc/Users guide Standalone.idmap.txt +10 -2
  34. data/doc/Users guide Standalone.txt +4 -0
  35. data/doc/images/glyphicons-halflings-white.png +0 -0
  36. data/doc/images/glyphicons-halflings.png +0 -0
  37. data/doc/images/phusion_banner_small.png +0 -0
  38. data/doc/images/{smart-lv2.png → smart.png} +0 -0
  39. data/doc/images/{smart-lv2.svg → smart.svg} +0 -0
  40. data/doc/templates/bootstrap.min.css +397 -0
  41. data/doc/templates/markdown.html.erb +117 -0
  42. data/doc/users_guide_snippets/analysis_and_system_maintenance.txt +2 -1
  43. data/doc/users_guide_snippets/appendix_c_spawning_methods.txt +26 -48
  44. data/doc/users_guide_snippets/passenger_spawn_method.txt +18 -30
  45. data/doc/users_guide_snippets/support_information.txt +30 -0
  46. data/ext/apache2/Bucket.cpp +9 -26
  47. data/ext/apache2/Bucket.h +13 -10
  48. data/ext/apache2/Configuration.cpp +70 -58
  49. data/ext/apache2/Configuration.hpp +19 -47
  50. data/ext/apache2/DirectoryMapper.h +7 -7
  51. data/ext/apache2/Hooks.cpp +150 -313
  52. data/ext/boost/algorithm/string/detail/case_conv.hpp +4 -2
  53. data/ext/boost/algorithm/string/detail/find_format.hpp +20 -20
  54. data/ext/boost/algorithm/string/detail/find_format_all.hpp +23 -23
  55. data/ext/boost/algorithm/string/detail/find_format_store.hpp +2 -2
  56. data/ext/boost/algorithm/string/detail/formatter.hpp +25 -0
  57. data/ext/boost/algorithm/string/formatter.hpp +20 -3
  58. data/ext/boost/assert.hpp +85 -4
  59. data/ext/boost/bind/bind.hpp +1 -1
  60. data/ext/boost/concept/detail/backward_compatibility.hpp +1 -1
  61. data/ext/boost/concept_check.hpp +140 -64
  62. data/ext/boost/config.hpp +1 -1
  63. data/ext/boost/config/auto_link.hpp +8 -6
  64. data/ext/boost/config/compiler/borland.hpp +12 -2
  65. data/ext/boost/config/compiler/clang.hpp +89 -30
  66. data/ext/boost/config/compiler/codegear.hpp +3 -2
  67. data/ext/boost/config/compiler/common_edg.hpp +7 -5
  68. data/ext/boost/config/compiler/cray.hpp +61 -0
  69. data/ext/boost/config/compiler/digitalmars.hpp +9 -1
  70. data/ext/boost/config/compiler/gcc.hpp +33 -24
  71. data/ext/boost/config/compiler/gcc_xml.hpp +4 -0
  72. data/ext/boost/config/compiler/hp_acc.hpp +12 -1
  73. data/ext/boost/config/compiler/intel.hpp +78 -4
  74. data/ext/boost/config/compiler/metrowerks.hpp +4 -1
  75. data/ext/boost/config/compiler/mpw.hpp +4 -1
  76. data/ext/boost/config/compiler/nvcc.hpp +8 -66
  77. data/ext/boost/config/compiler/pathscale.hpp +80 -0
  78. data/ext/boost/config/compiler/pgi.hpp +5 -5
  79. data/ext/boost/config/compiler/sunpro_cc.hpp +4 -1
  80. data/ext/boost/config/compiler/vacpp.hpp +37 -13
  81. data/ext/boost/config/compiler/visualc.hpp +24 -11
  82. data/ext/boost/config/platform/bsd.hpp +1 -1
  83. data/ext/boost/config/platform/cray.hpp +18 -0
  84. data/ext/boost/config/platform/cygwin.hpp +10 -0
  85. data/ext/boost/config/platform/linux.hpp +5 -0
  86. data/ext/boost/config/platform/macos.hpp +5 -4
  87. data/ext/boost/config/platform/symbian.hpp +5 -2
  88. data/ext/boost/config/platform/vms.hpp +25 -0
  89. data/ext/boost/config/platform/win32.hpp +7 -1
  90. data/ext/boost/config/select_compiler_config.hpp +8 -25
  91. data/ext/boost/config/select_platform_config.hpp +8 -1
  92. data/ext/boost/config/select_stdlib_config.hpp +9 -1
  93. data/ext/boost/config/stdlib/dinkumware.hpp +6 -9
  94. data/ext/boost/config/stdlib/libcomo.hpp +1 -4
  95. data/ext/boost/config/stdlib/libcpp.hpp +36 -0
  96. data/ext/boost/config/stdlib/libstdcpp3.hpp +37 -11
  97. data/ext/boost/config/stdlib/modena.hpp +1 -4
  98. data/ext/boost/config/stdlib/msl.hpp +1 -4
  99. data/ext/boost/config/stdlib/roguewave.hpp +9 -6
  100. data/ext/boost/config/stdlib/sgi.hpp +12 -4
  101. data/ext/boost/config/stdlib/stlport.hpp +11 -4
  102. data/ext/boost/config/stdlib/vacpp.hpp +11 -4
  103. data/ext/boost/config/suffix.hpp +71 -6
  104. data/ext/boost/config/warning_disable.hpp +1 -1
  105. data/ext/boost/container/container_fwd.hpp +177 -0
  106. data/ext/boost/cstdint.hpp +17 -12
  107. data/ext/boost/current_function.hpp +2 -1
  108. data/ext/boost/date_time/c_time.hpp +17 -1
  109. data/ext/boost/date_time/compiler_config.hpp +13 -15
  110. data/ext/boost/date_time/date_formatting.hpp +7 -1
  111. data/ext/boost/date_time/filetime_functions.hpp +4 -4
  112. data/ext/boost/date_time/gregorian_calendar.ipp +2 -2
  113. data/ext/boost/date_time/strings_from_facet.hpp +3 -3
  114. data/ext/boost/date_time/time_facet.hpp +101 -101
  115. data/ext/boost/detail/endian.hpp +4 -2
  116. data/ext/boost/detail/fenv.hpp +74 -0
  117. data/ext/boost/detail/sp_typeinfo.hpp +6 -0
  118. data/ext/boost/exception/detail/clone_current_exception.hpp +47 -0
  119. data/ext/boost/exception/detail/exception_ptr.hpp +194 -122
  120. data/ext/boost/exception/detail/type_info.hpp +3 -3
  121. data/ext/boost/exception/diagnostic_information.hpp +37 -21
  122. data/ext/boost/exception/exception.hpp +21 -1
  123. data/ext/boost/exception/info.hpp +0 -1
  124. data/ext/boost/function.hpp +2 -2
  125. data/ext/boost/function/function_base.hpp +15 -9
  126. data/ext/boost/function/function_template.hpp +26 -48
  127. data/ext/boost/integer_fwd.hpp +0 -16
  128. data/ext/boost/integer_traits.hpp +2 -2
  129. data/ext/boost/iterator.hpp +1 -1
  130. data/ext/boost/iterator/iterator_adaptor.hpp +1 -7
  131. data/ext/boost/iterator/iterator_facade.hpp +13 -13
  132. data/ext/boost/iterator/transform_iterator.hpp +5 -20
  133. data/ext/boost/lexical_cast.hpp +1655 -673
  134. data/ext/boost/math/policies/policy.hpp +982 -0
  135. data/ext/boost/math/special_functions/detail/fp_traits.hpp +570 -0
  136. data/ext/boost/math/special_functions/detail/round_fwd.hpp +80 -0
  137. data/ext/boost/math/special_functions/fpclassify.hpp +533 -0
  138. data/ext/boost/math/special_functions/math_fwd.hpp +1070 -0
  139. data/ext/boost/math/special_functions/sign.hpp +145 -0
  140. data/ext/boost/math/tools/config.hpp +321 -0
  141. data/ext/boost/math/tools/promotion.hpp +150 -0
  142. data/ext/boost/math/tools/real_cast.hpp +29 -0
  143. data/ext/boost/math/tools/user.hpp +97 -0
  144. data/ext/boost/move/move.hpp +1222 -0
  145. data/ext/boost/mpl/O1_size.hpp +40 -0
  146. data/ext/boost/mpl/O1_size_fwd.hpp +24 -0
  147. data/ext/boost/mpl/advance.hpp +76 -0
  148. data/ext/boost/mpl/advance_fwd.hpp +28 -0
  149. data/ext/boost/mpl/at.hpp +52 -0
  150. data/ext/boost/mpl/at_fwd.hpp +24 -0
  151. data/ext/boost/mpl/aux_/O1_size_impl.hpp +87 -0
  152. data/ext/boost/mpl/aux_/advance_backward.hpp +128 -0
  153. data/ext/boost/mpl/aux_/advance_forward.hpp +127 -0
  154. data/ext/boost/mpl/aux_/arithmetic_op.hpp +92 -0
  155. data/ext/boost/mpl/aux_/at_impl.hpp +45 -0
  156. data/ext/boost/mpl/aux_/begin_end_impl.hpp +101 -0
  157. data/ext/boost/mpl/aux_/clear_impl.hpp +35 -0
  158. data/ext/boost/mpl/aux_/comparison_op.hpp +83 -0
  159. data/ext/boost/mpl/aux_/config/forwarding.hpp +27 -0
  160. data/ext/boost/mpl/aux_/config/typeof.hpp +38 -0
  161. data/ext/boost/mpl/aux_/contains_impl.hpp +61 -0
  162. data/ext/boost/mpl/aux_/find_if_pred.hpp +31 -0
  163. data/ext/boost/mpl/aux_/fold_impl.hpp +43 -0
  164. data/ext/boost/mpl/aux_/has_begin.hpp +23 -0
  165. data/ext/boost/mpl/aux_/has_size.hpp +23 -0
  166. data/ext/boost/mpl/aux_/has_tag.hpp +23 -0
  167. data/ext/boost/mpl/aux_/inserter_algorithm.hpp +159 -0
  168. data/ext/boost/mpl/aux_/is_msvc_eti_arg.hpp +64 -0
  169. data/ext/boost/mpl/aux_/iter_apply.hpp +47 -0
  170. data/ext/boost/mpl/aux_/iter_fold_if_impl.hpp +210 -0
  171. data/ext/boost/mpl/aux_/iter_fold_impl.hpp +42 -0
  172. data/ext/boost/mpl/aux_/lambda_spec.hpp +49 -0
  173. data/ext/boost/mpl/aux_/largest_int.hpp +63 -0
  174. data/ext/boost/mpl/aux_/msvc_eti_base.hpp +77 -0
  175. data/ext/boost/mpl/aux_/msvc_type.hpp +62 -0
  176. data/ext/boost/mpl/aux_/numeric_cast_utils.hpp +77 -0
  177. data/ext/boost/mpl/aux_/numeric_op.hpp +315 -0
  178. data/ext/boost/mpl/aux_/preprocessed/gcc/advance_backward.hpp +97 -0
  179. data/ext/boost/mpl/aux_/preprocessed/gcc/advance_forward.hpp +97 -0
  180. data/ext/boost/mpl/aux_/preprocessed/gcc/equal_to.hpp +94 -0
  181. data/ext/boost/mpl/aux_/preprocessed/gcc/fold_impl.hpp +180 -0
  182. data/ext/boost/mpl/aux_/preprocessed/gcc/greater.hpp +94 -0
  183. data/ext/boost/mpl/aux_/preprocessed/gcc/greater_equal.hpp +94 -0
  184. data/ext/boost/mpl/aux_/preprocessed/gcc/iter_fold_if_impl.hpp +133 -0
  185. data/ext/boost/mpl/aux_/preprocessed/gcc/iter_fold_impl.hpp +180 -0
  186. data/ext/boost/mpl/aux_/preprocessed/gcc/less.hpp +94 -0
  187. data/ext/boost/mpl/aux_/preprocessed/gcc/less_equal.hpp +94 -0
  188. data/ext/boost/mpl/aux_/preprocessed/gcc/list.hpp +323 -0
  189. data/ext/boost/mpl/aux_/preprocessed/gcc/minus.hpp +146 -0
  190. data/ext/boost/mpl/aux_/preprocessed/gcc/not_equal_to.hpp +94 -0
  191. data/ext/boost/mpl/aux_/preprocessed/gcc/plus.hpp +146 -0
  192. data/ext/boost/mpl/aux_/preprocessed/gcc/reverse_fold_impl.hpp +231 -0
  193. data/ext/boost/mpl/aux_/preprocessed/gcc/times.hpp +146 -0
  194. data/ext/boost/mpl/aux_/preprocessed/gcc/vector.hpp +323 -0
  195. data/ext/boost/mpl/aux_/preprocessor/default_params.hpp +67 -0
  196. data/ext/boost/mpl/aux_/push_back_impl.hpp +70 -0
  197. data/ext/boost/mpl/aux_/push_front_impl.hpp +71 -0
  198. data/ext/boost/mpl/aux_/reverse_fold_impl.hpp +44 -0
  199. data/ext/boost/mpl/aux_/size_impl.hpp +52 -0
  200. data/ext/boost/mpl/aux_/traits_lambda_spec.hpp +63 -0
  201. data/ext/boost/mpl/back_fwd.hpp +24 -0
  202. data/ext/boost/mpl/back_inserter.hpp +34 -0
  203. data/ext/boost/mpl/begin_end.hpp +57 -0
  204. data/ext/boost/mpl/begin_end_fwd.hpp +27 -0
  205. data/ext/boost/mpl/clear.hpp +39 -0
  206. data/ext/boost/mpl/clear_fwd.hpp +24 -0
  207. data/ext/boost/mpl/comparison.hpp +24 -0
  208. data/ext/boost/mpl/contains.hpp +41 -0
  209. data/ext/boost/mpl/contains_fwd.hpp +25 -0
  210. data/ext/boost/mpl/deref.hpp +41 -0
  211. data/ext/boost/mpl/distance.hpp +78 -0
  212. data/ext/boost/mpl/distance_fwd.hpp +28 -0
  213. data/ext/boost/mpl/empty_fwd.hpp +24 -0
  214. data/ext/boost/mpl/equal_to.hpp +21 -0
  215. data/ext/boost/mpl/find.hpp +38 -0
  216. data/ext/boost/mpl/find_if.hpp +50 -0
  217. data/ext/boost/mpl/fold.hpp +48 -0
  218. data/ext/boost/mpl/front_fwd.hpp +24 -0
  219. data/ext/boost/mpl/front_inserter.hpp +33 -0
  220. data/ext/boost/mpl/greater.hpp +21 -0
  221. data/ext/boost/mpl/greater_equal.hpp +21 -0
  222. data/ext/boost/mpl/inserter.hpp +32 -0
  223. data/ext/boost/mpl/iter_fold.hpp +49 -0
  224. data/ext/boost/mpl/iter_fold_if.hpp +117 -0
  225. data/ext/boost/mpl/iterator_range.hpp +42 -0
  226. data/ext/boost/mpl/iterator_tags.hpp +27 -0
  227. data/ext/boost/mpl/less.hpp +21 -0
  228. data/ext/boost/mpl/less_equal.hpp +21 -0
  229. data/ext/boost/mpl/limits/list.hpp +21 -0
  230. data/ext/boost/mpl/limits/vector.hpp +21 -0
  231. data/ext/boost/mpl/list.hpp +57 -0
  232. data/ext/boost/mpl/list/aux_/O1_size.hpp +33 -0
  233. data/ext/boost/mpl/list/aux_/begin_end.hpp +44 -0
  234. data/ext/boost/mpl/list/aux_/clear.hpp +34 -0
  235. data/ext/boost/mpl/list/aux_/empty.hpp +34 -0
  236. data/ext/boost/mpl/list/aux_/front.hpp +33 -0
  237. data/ext/boost/mpl/list/aux_/include_preprocessed.hpp +35 -0
  238. data/ext/boost/mpl/list/aux_/item.hpp +55 -0
  239. data/ext/boost/mpl/list/aux_/iterator.hpp +76 -0
  240. data/ext/boost/mpl/list/aux_/pop_front.hpp +34 -0
  241. data/ext/boost/mpl/list/aux_/preprocessed/plain/list10.hpp +149 -0
  242. data/ext/boost/mpl/list/aux_/preprocessed/plain/list20.hpp +169 -0
  243. data/ext/boost/mpl/list/aux_/push_back.hpp +36 -0
  244. data/ext/boost/mpl/list/aux_/push_front.hpp +39 -0
  245. data/ext/boost/mpl/list/aux_/size.hpp +33 -0
  246. data/ext/boost/mpl/list/aux_/tag.hpp +24 -0
  247. data/ext/boost/mpl/list/list0.hpp +42 -0
  248. data/ext/boost/mpl/list/list10.hpp +43 -0
  249. data/ext/boost/mpl/list/list20.hpp +43 -0
  250. data/ext/boost/mpl/long.hpp +22 -0
  251. data/ext/boost/mpl/long_fwd.hpp +27 -0
  252. data/ext/boost/mpl/minus.hpp +21 -0
  253. data/ext/boost/mpl/multiplies.hpp +53 -0
  254. data/ext/boost/mpl/negate.hpp +81 -0
  255. data/ext/boost/mpl/not_equal_to.hpp +21 -0
  256. data/ext/boost/mpl/numeric_cast.hpp +41 -0
  257. data/ext/boost/mpl/pair.hpp +70 -0
  258. data/ext/boost/mpl/plus.hpp +21 -0
  259. data/ext/boost/mpl/pop_back_fwd.hpp +24 -0
  260. data/ext/boost/mpl/pop_front_fwd.hpp +24 -0
  261. data/ext/boost/mpl/prior.hpp +19 -0
  262. data/ext/boost/mpl/push_back.hpp +53 -0
  263. data/ext/boost/mpl/push_back_fwd.hpp +24 -0
  264. data/ext/boost/mpl/push_front.hpp +52 -0
  265. data/ext/boost/mpl/push_front_fwd.hpp +24 -0
  266. data/ext/boost/mpl/remove_if.hpp +83 -0
  267. data/ext/boost/mpl/reverse_fold.hpp +50 -0
  268. data/ext/boost/mpl/same_as.hpp +55 -0
  269. data/ext/boost/mpl/sequence_tag.hpp +124 -0
  270. data/ext/boost/mpl/sequence_tag_fwd.hpp +26 -0
  271. data/ext/boost/mpl/size.hpp +42 -0
  272. data/ext/boost/mpl/size_fwd.hpp +24 -0
  273. data/ext/boost/mpl/tag.hpp +52 -0
  274. data/ext/boost/mpl/times.hpp +21 -0
  275. data/ext/boost/mpl/vector.hpp +57 -0
  276. data/ext/boost/mpl/vector/aux_/O1_size.hpp +56 -0
  277. data/ext/boost/mpl/vector/aux_/at.hpp +116 -0
  278. data/ext/boost/mpl/vector/aux_/back.hpp +59 -0
  279. data/ext/boost/mpl/vector/aux_/begin_end.hpp +49 -0
  280. data/ext/boost/mpl/vector/aux_/clear.hpp +55 -0
  281. data/ext/boost/mpl/vector/aux_/empty.hpp +68 -0
  282. data/ext/boost/mpl/vector/aux_/front.hpp +56 -0
  283. data/ext/boost/mpl/vector/aux_/include_preprocessed.hpp +55 -0
  284. data/ext/boost/mpl/vector/aux_/item.hpp +103 -0
  285. data/ext/boost/mpl/vector/aux_/iterator.hpp +130 -0
  286. data/ext/boost/mpl/vector/aux_/pop_back.hpp +40 -0
  287. data/ext/boost/mpl/vector/aux_/pop_front.hpp +40 -0
  288. data/ext/boost/mpl/vector/aux_/preprocessed/plain/vector10.hpp +829 -0
  289. data/ext/boost/mpl/vector/aux_/preprocessed/plain/vector20.hpp +1144 -0
  290. data/ext/boost/mpl/vector/aux_/preprocessed/typeof_based/vector10.hpp +139 -0
  291. data/ext/boost/mpl/vector/aux_/preprocessed/typeof_based/vector20.hpp +159 -0
  292. data/ext/boost/mpl/vector/aux_/push_back.hpp +40 -0
  293. data/ext/boost/mpl/vector/aux_/push_front.hpp +40 -0
  294. data/ext/boost/mpl/vector/aux_/size.hpp +49 -0
  295. data/ext/boost/mpl/vector/aux_/tag.hpp +32 -0
  296. data/ext/boost/mpl/vector/aux_/vector0.hpp +52 -0
  297. data/ext/boost/mpl/vector/vector0.hpp +34 -0
  298. data/ext/boost/mpl/vector/vector10.hpp +45 -0
  299. data/ext/boost/mpl/vector/vector20.hpp +45 -0
  300. data/ext/boost/none.hpp +1 -1
  301. data/ext/boost/numeric/conversion/bounds.hpp +24 -0
  302. data/ext/boost/numeric/conversion/cast.hpp +61 -0
  303. data/ext/boost/numeric/conversion/conversion_traits.hpp +39 -0
  304. data/ext/boost/numeric/conversion/converter.hpp +68 -0
  305. data/ext/boost/numeric/conversion/converter_policies.hpp +186 -0
  306. data/ext/boost/numeric/conversion/detail/bounds.hpp +58 -0
  307. data/ext/boost/numeric/conversion/detail/conversion_traits.hpp +97 -0
  308. data/ext/boost/numeric/conversion/detail/converter.hpp +602 -0
  309. data/ext/boost/numeric/conversion/detail/int_float_mixture.hpp +72 -0
  310. data/ext/boost/numeric/conversion/detail/is_subranged.hpp +234 -0
  311. data/ext/boost/numeric/conversion/detail/meta.hpp +120 -0
  312. data/ext/boost/numeric/conversion/detail/numeric_cast_traits.hpp +138 -0
  313. data/ext/boost/numeric/conversion/detail/preprocessed/numeric_cast_traits_common.hpp +1741 -0
  314. data/ext/boost/numeric/conversion/detail/preprocessed/numeric_cast_traits_long_long.hpp +347 -0
  315. data/ext/boost/numeric/conversion/detail/sign_mixture.hpp +72 -0
  316. data/ext/boost/numeric/conversion/detail/udt_builtin_mixture.hpp +69 -0
  317. data/ext/boost/numeric/conversion/int_float_mixture_enum.hpp +29 -0
  318. data/ext/boost/numeric/conversion/numeric_cast_traits.hpp +31 -0
  319. data/ext/boost/numeric/conversion/sign_mixture_enum.hpp +29 -0
  320. data/ext/boost/numeric/conversion/udt_builtin_mixture_enum.hpp +26 -0
  321. data/ext/boost/operators.hpp +3 -1
  322. data/ext/boost/optional/optional.hpp +146 -79
  323. data/ext/boost/optional/optional_fwd.hpp +8 -1
  324. data/ext/boost/preprocessor/cat.hpp +2 -2
  325. data/ext/boost/preprocessor/config/config.hpp +39 -4
  326. data/ext/boost/preprocessor/facilities/intercept.hpp +277 -0
  327. data/ext/boost/preprocessor/facilities/overload.hpp +25 -0
  328. data/ext/boost/preprocessor/iteration/detail/iter/forward1.hpp +3 -3
  329. data/ext/boost/preprocessor/iteration/iterate.hpp +3 -3
  330. data/ext/boost/preprocessor/punctuation/paren.hpp +23 -0
  331. data/ext/boost/preprocessor/repetition/enum_shifted_params.hpp +44 -0
  332. data/ext/boost/preprocessor/seq/cat.hpp +5 -4
  333. data/ext/boost/preprocessor/seq/size.hpp +0 -1
  334. data/ext/boost/preprocessor/tuple/eat.hpp +83 -34
  335. data/ext/boost/preprocessor/tuple/elem.hpp +161 -355
  336. data/ext/boost/preprocessor/tuple/rem.hpp +110 -48
  337. data/ext/boost/preprocessor/tuple/to_list.hpp +90 -36
  338. data/ext/boost/preprocessor/variadic/elem.hpp +94 -0
  339. data/ext/boost/preprocessor/variadic/size.hpp +30 -0
  340. data/ext/boost/range/begin.hpp +17 -6
  341. data/ext/boost/range/concepts.hpp +37 -2
  342. data/ext/boost/range/detail/safe_bool.hpp +72 -0
  343. data/ext/boost/range/end.hpp +14 -9
  344. data/ext/boost/range/iterator_range_core.hpp +120 -12
  345. data/ext/boost/range/size.hpp +21 -5
  346. data/ext/boost/smart_ptr/detail/shared_count.hpp +88 -0
  347. data/ext/boost/smart_ptr/detail/sp_counted_base.hpp +3 -0
  348. data/ext/boost/smart_ptr/detail/sp_counted_base_aix.hpp +142 -0
  349. data/ext/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp +9 -0
  350. data/ext/boost/smart_ptr/detail/sp_counted_impl.hpp +10 -2
  351. data/ext/boost/smart_ptr/detail/sp_has_sync.hpp +5 -1
  352. data/ext/boost/smart_ptr/detail/spinlock.hpp +4 -1
  353. data/ext/boost/smart_ptr/detail/spinlock_gcc_arm.hpp +20 -3
  354. data/ext/boost/smart_ptr/detail/spinlock_pool.hpp +4 -0
  355. data/ext/boost/smart_ptr/make_shared.hpp +591 -22
  356. data/ext/boost/smart_ptr/shared_array.hpp +29 -1
  357. data/ext/boost/smart_ptr/shared_ptr.hpp +29 -13
  358. data/ext/boost/smart_ptr/weak_ptr.hpp +24 -12
  359. data/ext/boost/src/pthread/once.cpp +9 -7
  360. data/ext/boost/src/pthread/thread.cpp +32 -28
  361. data/ext/boost/src/pthread/timeconv.inl +4 -5
  362. data/ext/boost/src/tss_null.cpp +5 -1
  363. data/ext/boost/static_assert.hpp +8 -2
  364. data/ext/boost/thread/detail/config.hpp +19 -4
  365. data/ext/boost/thread/detail/move.hpp +11 -5
  366. data/ext/boost/thread/detail/thread.hpp +59 -43
  367. data/ext/boost/thread/exceptions.hpp +9 -9
  368. data/ext/boost/thread/future.hpp +150 -82
  369. data/ext/boost/thread/locks.hpp +101 -60
  370. data/ext/boost/thread/pthread/condition_variable.hpp +79 -32
  371. data/ext/boost/thread/pthread/condition_variable_fwd.hpp +12 -3
  372. data/ext/boost/thread/pthread/mutex.hpp +17 -14
  373. data/ext/boost/thread/pthread/once.hpp +3 -4
  374. data/ext/boost/thread/pthread/pthread_mutex_scoped_lock.hpp +12 -2
  375. data/ext/boost/thread/pthread/recursive_mutex.hpp +19 -19
  376. data/ext/boost/thread/pthread/shared_mutex.hpp +13 -13
  377. data/ext/boost/thread/pthread/thread_data.hpp +40 -12
  378. data/ext/boost/thread/thread_time.hpp +5 -0
  379. data/ext/boost/throw_exception.hpp +1 -1
  380. data/ext/boost/token_functions.hpp +34 -10
  381. data/ext/boost/type_traits/add_rvalue_reference.hpp +66 -0
  382. data/ext/boost/type_traits/alignment_of.hpp +1 -1
  383. data/ext/boost/type_traits/detail/bool_trait_def.hpp +26 -3
  384. data/ext/boost/type_traits/detail/bool_trait_undef.hpp +3 -2
  385. data/ext/boost/type_traits/detail/cv_traits_impl.hpp +1 -1
  386. data/ext/boost/type_traits/detail/size_t_trait_def.hpp +6 -4
  387. data/ext/boost/type_traits/detail/type_trait_def.hpp +8 -2
  388. data/ext/boost/type_traits/function_traits.hpp +1 -1
  389. data/ext/boost/type_traits/has_nothrow_constructor.hpp +53 -0
  390. data/ext/boost/type_traits/has_nothrow_copy.hpp +19 -5
  391. data/ext/boost/type_traits/has_trivial_constructor.hpp +51 -0
  392. data/ext/boost/type_traits/has_trivial_copy.hpp +20 -5
  393. data/ext/boost/type_traits/has_trivial_destructor.hpp +12 -5
  394. data/ext/boost/type_traits/intrinsics.hpp +119 -71
  395. data/ext/boost/type_traits/is_const.hpp +5 -5
  396. data/ext/boost/type_traits/is_convertible.hpp +14 -13
  397. data/ext/boost/type_traits/is_enum.hpp +1 -1
  398. data/ext/boost/type_traits/is_floating_point.hpp +27 -0
  399. data/ext/boost/type_traits/is_function.hpp +3 -3
  400. data/ext/boost/type_traits/is_fundamental.hpp +1 -1
  401. data/ext/boost/type_traits/is_member_function_pointer.hpp +2 -2
  402. data/ext/boost/type_traits/is_member_pointer.hpp +2 -2
  403. data/ext/boost/type_traits/is_pod.hpp +11 -3
  404. data/ext/boost/type_traits/is_pointer.hpp +2 -2
  405. data/ext/boost/type_traits/is_signed.hpp +8 -3
  406. data/ext/boost/type_traits/is_union.hpp +8 -0
  407. data/ext/boost/type_traits/is_unsigned.hpp +9 -4
  408. data/ext/boost/type_traits/is_volatile.hpp +5 -5
  409. data/ext/boost/type_traits/remove_cv.hpp +4 -3
  410. data/ext/boost/type_traits/remove_pointer.hpp +51 -2
  411. data/ext/boost/type_traits/remove_reference.hpp +2 -2
  412. data/ext/boost/type_traits/type_with_alignment.hpp +8 -2
  413. data/ext/boost/utility/declval.hpp +44 -0
  414. data/ext/boost/utility/detail/in_place_factory_prefix.hpp +36 -0
  415. data/ext/boost/utility/detail/in_place_factory_suffix.hpp +23 -0
  416. data/ext/boost/utility/detail/result_of_iterate.hpp +142 -0
  417. data/ext/boost/utility/in_place_factory.hpp +88 -0
  418. data/ext/boost/utility/result_of.hpp +103 -0
  419. data/ext/boost/utility/swap.hpp +55 -0
  420. data/ext/common/AnsiColorConstants.h +36 -0
  421. data/ext/common/ApplicationPool2/Common.h +87 -0
  422. data/ext/common/ApplicationPool2/ComponentInfo.h +53 -0
  423. data/ext/common/ApplicationPool2/Group.h +648 -0
  424. data/ext/common/ApplicationPool2/Implementation.cpp +580 -0
  425. data/ext/common/ApplicationPool2/Options.h +576 -0
  426. data/ext/common/ApplicationPool2/PipeWatcher.h +61 -0
  427. data/ext/common/ApplicationPool2/Pool.h +1181 -0
  428. data/ext/common/ApplicationPool2/Process.h +425 -0
  429. data/ext/common/ApplicationPool2/README.md +96 -0
  430. data/ext/common/ApplicationPool2/Session.h +158 -0
  431. data/ext/common/ApplicationPool2/Socket.h +246 -0
  432. data/ext/common/ApplicationPool2/Spawner.h +2212 -0
  433. data/ext/common/ApplicationPool2/SuperGroup.h +749 -0
  434. data/ext/common/BackgroundEventLoop.cpp +129 -0
  435. data/ext/common/BackgroundEventLoop.h +61 -0
  436. data/ext/common/Constants.h +3 -1
  437. data/ext/common/EventedBufferedInput.h +331 -0
  438. data/ext/common/EventedMessageServer.h +17 -34
  439. data/ext/common/EventedServer.h +2 -2
  440. data/ext/common/Exceptions.h +71 -19
  441. data/ext/common/FileDescriptor.h +8 -6
  442. data/ext/common/HttpConstants.h +167 -0
  443. data/ext/common/IniFile.h +24 -0
  444. data/ext/common/Logging.h +62 -849
  445. data/ext/common/MessageReadersWriters.h +19 -0
  446. data/ext/common/MessageServer.h +11 -14
  447. data/ext/common/MultiLibeio.cpp +198 -0
  448. data/ext/common/MultiLibeio.h +67 -0
  449. data/ext/common/ResourceLocator.h +24 -41
  450. data/ext/common/SafeLibev.h +186 -14
  451. data/ext/common/StaticString.h +23 -3
  452. data/ext/common/UnionStation.h +972 -0
  453. data/ext/common/Utils.cpp +168 -24
  454. data/ext/common/Utils.h +25 -3
  455. data/ext/common/Utils/CachedFileStat.hpp +4 -3
  456. data/ext/common/Utils/FileChangeChecker.h +2 -2
  457. data/ext/common/Utils/HashMap.h +50 -0
  458. data/ext/common/Utils/IOUtils.cpp +229 -68
  459. data/ext/common/Utils/IOUtils.h +134 -3
  460. data/ext/common/Utils/Lock.h +28 -0
  461. data/ext/common/Utils/MemoryBarrier.h +52 -0
  462. data/ext/common/Utils/PriorityQueue.h +54 -0
  463. data/ext/common/Utils/ProcessMetricsCollector.h +9 -11
  464. data/ext/common/Utils/ScopeGuard.h +50 -1
  465. data/ext/common/Utils/SmallVector.h +653 -0
  466. data/ext/common/Utils/StrIntUtils.cpp +26 -2
  467. data/ext/common/Utils/StrIntUtils.h +18 -2
  468. data/ext/common/Utils/StringMap.h +125 -8
  469. data/ext/common/Utils/Template.h +212 -0
  470. data/ext/common/Utils/fib.c +699 -0
  471. data/ext/common/Utils/fib.h +101 -0
  472. data/ext/common/Utils/fibpriv.h +67 -0
  473. data/ext/common/Utils/json-forwards.h +249 -0
  474. data/ext/common/Utils/json.h +1855 -0
  475. data/ext/common/Utils/jsoncpp.cpp +4230 -0
  476. data/ext/common/agents/Base.cpp +1126 -0
  477. data/ext/common/{AgentBase.h → agents/Base.h} +5 -1
  478. data/ext/common/agents/EnvPrinter.c +16 -0
  479. data/ext/common/agents/HelperAgent/AgentOptions.h +81 -0
  480. data/ext/common/{HelperAgent → agents/HelperAgent}/BacktracesServer.h +3 -2
  481. data/ext/common/agents/HelperAgent/FileBackedPipe.h +732 -0
  482. data/ext/common/agents/HelperAgent/Main.cpp +497 -0
  483. data/ext/common/agents/HelperAgent/RequestHandler.cpp +283 -0
  484. data/ext/common/agents/HelperAgent/RequestHandler.h +2139 -0
  485. data/ext/common/agents/HelperAgent/ScgiRequestParser.h +451 -0
  486. data/ext/common/{LoggingAgent → agents/LoggingAgent}/DataStoreId.h +1 -1
  487. data/ext/common/{LoggingAgent → agents/LoggingAgent}/FilterSupport.cpp +1 -1
  488. data/ext/common/{LoggingAgent → agents/LoggingAgent}/FilterSupport.h +0 -0
  489. data/ext/common/{LoggingAgent → agents/LoggingAgent}/LoggingServer.h +18 -16
  490. data/ext/common/{LoggingAgent → agents/LoggingAgent}/Main.cpp +15 -13
  491. data/ext/common/{LoggingAgent → agents/LoggingAgent}/RemoteSender.h +6 -6
  492. data/ext/common/agents/SpawnPreparer.cpp +127 -0
  493. data/ext/common/{Watchdog.cpp → agents/Watchdog/Main.cpp} +63 -25
  494. data/ext/libeio/Changes +72 -0
  495. data/ext/{google/COPYING → libeio/LICENSE} +17 -9
  496. data/ext/libeio/Makefile.am +15 -0
  497. data/ext/libeio/Makefile.in +694 -0
  498. data/ext/libeio/aclocal.m4 +9418 -0
  499. data/ext/libeio/autogen.sh +3 -0
  500. data/ext/libeio/config.guess +1501 -0
  501. data/ext/libeio/config.h.in +136 -0
  502. data/ext/libeio/config.sub +1705 -0
  503. data/ext/libeio/configure +14822 -0
  504. data/ext/libeio/configure.ac +22 -0
  505. data/ext/libeio/demo.c +194 -0
  506. data/ext/libeio/ecb.h +457 -0
  507. data/ext/libeio/eio.c +2816 -0
  508. data/ext/libeio/eio.h +411 -0
  509. data/ext/libeio/install-sh +520 -0
  510. data/ext/libeio/libeio.m4 +211 -0
  511. data/ext/libeio/ltmain.sh +9636 -0
  512. data/ext/libeio/missing +376 -0
  513. data/ext/libeio/xthread.h +166 -0
  514. data/ext/libev/Changes +125 -7
  515. data/ext/libev/Makefile.am +5 -3
  516. data/ext/libev/Makefile.in +209 -120
  517. data/ext/libev/aclocal.m4 +6027 -4619
  518. data/ext/libev/autogen.sh +1 -4
  519. data/ext/libev/config.h.in +11 -7
  520. data/ext/libev/configure +7312 -14993
  521. data/ext/libev/configure.ac +12 -5
  522. data/ext/libev/depcomp +630 -0
  523. data/ext/libev/ev++.h +48 -32
  524. data/ext/libev/ev.c +1173 -391
  525. data/ext/libev/ev.h +315 -181
  526. data/ext/libev/ev_epoll.c +66 -15
  527. data/ext/libev/ev_kqueue.c +20 -18
  528. data/ext/libev/ev_poll.c +27 -23
  529. data/ext/libev/ev_port.c +39 -19
  530. data/ext/libev/ev_select.c +23 -17
  531. data/ext/libev/ev_vars.h +25 -8
  532. data/ext/libev/ev_win32.c +6 -6
  533. data/ext/libev/ev_wrap.h +22 -2
  534. data/ext/libev/event.c +18 -17
  535. data/ext/libev/event.h +16 -4
  536. data/ext/libev/libev.m4 +10 -6
  537. data/ext/libev/ltmain.sh +7353 -5811
  538. data/ext/nginx/Configuration.c +74 -42
  539. data/ext/nginx/Configuration.h +3 -5
  540. data/ext/nginx/ContentHandler.c +26 -83
  541. data/ext/nginx/ContentHandler.h +1 -1
  542. data/ext/nginx/config +13 -9
  543. data/ext/nginx/ngx_http_passenger_module.c +3 -7
  544. data/ext/oxt/detail/backtrace_enabled.hpp +5 -102
  545. data/ext/oxt/detail/context.hpp +90 -0
  546. data/ext/oxt/detail/spin_lock_darwin.hpp +4 -0
  547. data/ext/oxt/detail/spin_lock_gcc_x86.hpp +4 -0
  548. data/ext/oxt/detail/spin_lock_pthreads.hpp +14 -0
  549. data/ext/oxt/detail/tracable_exception_enabled.hpp +2 -2
  550. data/ext/oxt/dynamic_thread_group.hpp +27 -1
  551. data/ext/oxt/implementation.cpp +415 -0
  552. data/ext/oxt/{thread.cpp → initialize.hpp} +13 -6
  553. data/ext/oxt/macros.hpp +32 -1
  554. data/ext/oxt/spin_lock.hpp +6 -11
  555. data/ext/oxt/system_calls.cpp +204 -16
  556. data/ext/oxt/system_calls.hpp +85 -45
  557. data/ext/oxt/thread.hpp +13 -117
  558. data/ext/ruby/passenger_native_support.c +82 -237
  559. data/helper-scripts/backtrace-sanitizer.rb +114 -0
  560. data/helper-scripts/classic-rails-loader.rb +135 -0
  561. data/helper-scripts/classic-rails-preloader.rb +161 -0
  562. data/helper-scripts/node-loader.js +314 -0
  563. data/helper-scripts/rack-loader.rb +104 -0
  564. data/helper-scripts/rack-preloader.rb +132 -0
  565. data/helper-scripts/wsgi-loader.py +231 -0
  566. data/helper-scripts/wsgi-preloader.py +1 -0
  567. data/lib/phusion_passenger.rb +159 -61
  568. data/lib/phusion_passenger/abstract_installer.rb +182 -87
  569. data/lib/phusion_passenger/admin_tools/server_instance.rb +25 -19
  570. data/lib/phusion_passenger/analytics_logger.rb +5 -4
  571. data/lib/phusion_passenger/classic_rails/{request_handler.rb → thread_handler_extension.rb} +4 -40
  572. data/lib/phusion_passenger/classic_rails_extensions/init.rb +5 -3
  573. data/lib/phusion_passenger/common_library.rb +441 -0
  574. data/lib/phusion_passenger/console_text_template.rb +4 -16
  575. data/lib/phusion_passenger/constants.rb +1 -8
  576. data/lib/phusion_passenger/debug_logging.rb +5 -2
  577. data/lib/phusion_passenger/dependencies.rb +51 -13
  578. data/lib/phusion_passenger/loader_shared_helpers.rb +318 -0
  579. data/lib/phusion_passenger/message_channel.rb +3 -47
  580. data/lib/phusion_passenger/message_client.rb +2 -2
  581. data/lib/phusion_passenger/native_support.rb +36 -15
  582. data/lib/phusion_passenger/packaging.rb +8 -11
  583. data/lib/phusion_passenger/platform_info.rb +25 -17
  584. data/lib/phusion_passenger/platform_info/apache.rb +10 -7
  585. data/lib/phusion_passenger/platform_info/binary_compatibility.rb +10 -30
  586. data/lib/phusion_passenger/platform_info/compiler.rb +93 -34
  587. data/lib/phusion_passenger/platform_info/ruby.rb +37 -97
  588. data/lib/phusion_passenger/preloader_shared_helpers.rb +121 -0
  589. data/lib/phusion_passenger/public_api.rb +1 -4
  590. data/lib/phusion_passenger/rack/{request_handler.rb → thread_handler_extension.rb} +14 -63
  591. data/lib/phusion_passenger/rails3_extensions/init.rb +9 -8
  592. data/lib/phusion_passenger/request_handler.rb +500 -0
  593. data/lib/phusion_passenger/request_handler/thread_handler.rb +360 -0
  594. data/lib/phusion_passenger/ruby_core_enhancements.rb +142 -0
  595. data/lib/phusion_passenger/standalone/command.rb +36 -15
  596. data/lib/phusion_passenger/standalone/package_runtime_command.rb +16 -8
  597. data/lib/phusion_passenger/standalone/runtime_installer.rb +169 -72
  598. data/lib/phusion_passenger/standalone/start_command.rb +44 -39
  599. data/lib/phusion_passenger/standalone/utils.rb +5 -5
  600. data/lib/phusion_passenger/utils.rb +35 -914
  601. data/lib/phusion_passenger/utils/ansi_colors.rb +59 -0
  602. data/lib/phusion_passenger/utils/file_system_watcher.rb +1 -1
  603. data/lib/phusion_passenger/utils/robust_interruption.rb +134 -0
  604. data/lib/phusion_passenger/utils/tee_input.rb +174 -0
  605. data/lib/phusion_passenger/utils/tmpio.rb +33 -0
  606. data/lib/phusion_passenger/utils/unseekable_socket.rb +6 -0
  607. data/resources/mime.types +5 -1
  608. data/{lib/phusion_passenger/templates → resources}/standalone_default_root/index.html +0 -0
  609. data/{lib/phusion_passenger → resources}/templates/apache2/apache_must_be_compiled_with_compatible_mpm.txt.erb +0 -0
  610. data/{lib/phusion_passenger → resources}/templates/apache2/config_snippets.txt.erb +0 -0
  611. data/{lib/phusion_passenger → resources}/templates/apache2/deployment_example.txt.erb +0 -0
  612. data/{lib/phusion_passenger → resources}/templates/apache2/no_write_permission_to_passenger_root.txt.erb +0 -0
  613. data/{lib/phusion_passenger → resources}/templates/apache2/possible_solutions_for_compilation_and_installation_problems.txt.erb +0 -0
  614. data/{lib/phusion_passenger → resources}/templates/apache2/run_installer_as_root.txt.erb +0 -0
  615. data/{lib/phusion_passenger → resources}/templates/apache2/welcome.txt.erb +0 -0
  616. data/{lib/phusion_passenger → resources}/templates/error_layout.css +6 -0
  617. data/resources/templates/error_layout.html.template +89 -0
  618. data/resources/templates/general_error.html.template +1 -0
  619. data/resources/templates/general_error_with_html.html.template +1 -0
  620. data/{lib/phusion_passenger → resources}/templates/nginx/ask_for_extra_configure_flags.txt.erb +0 -0
  621. data/{lib/phusion_passenger → resources}/templates/nginx/cannot_write_to_dir.txt.erb +0 -0
  622. data/{lib/phusion_passenger → resources}/templates/nginx/config_snippets.txt.erb +0 -0
  623. data/{lib/phusion_passenger → resources}/templates/nginx/config_snippets_inserted.txt.erb +0 -0
  624. data/{lib/phusion_passenger → resources}/templates/nginx/confirm_extra_configure_flags.txt.erb +0 -0
  625. data/{lib/phusion_passenger → resources}/templates/nginx/deployment_example.txt.erb +0 -0
  626. data/resources/templates/nginx/not_available_when_natively_packaged.txt.erb +8 -0
  627. data/{lib/phusion_passenger → resources}/templates/nginx/pcre_could_not_be_downloaded.txt.erb +0 -0
  628. data/{lib/phusion_passenger → resources}/templates/nginx/pcre_could_not_be_extracted.txt.erb +0 -0
  629. data/{lib/phusion_passenger → resources}/templates/nginx/possible_solutions_for_compilation_and_installation_problems.txt.erb +0 -0
  630. data/{lib/phusion_passenger → resources}/templates/nginx/possible_solutions_for_download_and_extraction_problems.txt.erb +0 -0
  631. data/{lib/phusion_passenger → resources}/templates/nginx/query_download_and_install.txt.erb +0 -0
  632. data/{lib/phusion_passenger → resources}/templates/nginx/run_installer_as_root.txt.erb +0 -0
  633. data/{lib/phusion_passenger → resources}/templates/nginx/welcome.txt.erb +0 -0
  634. data/{lib/phusion_passenger → resources}/templates/standalone/cannot_write_to_dir.txt.erb +0 -0
  635. data/{lib/phusion_passenger → resources}/templates/standalone/config.erb +26 -5
  636. data/{lib/phusion_passenger → resources}/templates/standalone/possible_solutions_for_download_and_extraction_problems.txt.erb +0 -0
  637. data/{lib/phusion_passenger → resources}/templates/standalone/run_installer_as_root.txt.erb +0 -0
  638. data/{lib/phusion_passenger → resources}/templates/standalone/welcome.txt.erb +0 -0
  639. data/resources/templates/undisclosed_error.html.template +25 -0
  640. data/test/config.json.example +42 -0
  641. data/test/cxx/ApplicationPool2/DirectSpawnerTest.cpp +86 -0
  642. data/test/cxx/ApplicationPool2/OptionsTest.cpp +44 -0
  643. data/test/cxx/ApplicationPool2/PoolTest.cpp +1234 -0
  644. data/test/cxx/ApplicationPool2/ProcessTest.cpp +131 -0
  645. data/test/cxx/ApplicationPool2/SmartSpawnerTest.cpp +229 -0
  646. data/test/cxx/ApplicationPool2/SpawnerTestCases.cpp +744 -0
  647. data/test/cxx/BufferedIOTest.cpp +7 -7
  648. data/test/cxx/CxxTestMain.cpp +65 -2
  649. data/test/cxx/FileBackedPipeTest.cpp +626 -0
  650. data/test/cxx/FileChangeCheckerTest.cpp +20 -18
  651. data/test/cxx/FilterSupportTest.cpp +5 -5
  652. data/test/cxx/IOUtilsTest.cpp +11 -4
  653. data/test/cxx/MessageReadersWritersTest.cpp +1 -1
  654. data/test/cxx/MessageServerTest.cpp +31 -30
  655. data/test/cxx/RequestHandlerTest.cpp +777 -0
  656. data/test/cxx/ScgiRequestParserTest.cpp +36 -16
  657. data/test/cxx/ServerInstanceDirTest.cpp +1 -1
  658. data/test/cxx/StringMapTest.cpp +61 -0
  659. data/test/cxx/TemplateTest.cpp +118 -0
  660. data/test/cxx/TestSupport.cpp +25 -68
  661. data/test/cxx/TestSupport.h +81 -41
  662. data/test/cxx/{LoggingTest.cpp → UnionStationTest.cpp} +79 -74
  663. data/test/cxx/UtilsTest.cpp +59 -5
  664. data/test/integration_tests/apache2_tests.rb +2 -2
  665. data/test/integration_tests/nginx_tests.rb +1 -1
  666. data/test/integration_tests/spec_helper.rb +7 -5
  667. data/test/oxt/oxt_test_main.cpp +2 -0
  668. data/test/oxt/syscall_interruption_test.cpp +1 -0
  669. data/test/ruby/classic_rails/loader_spec.rb +48 -0
  670. data/test/ruby/classic_rails/preloader_spec.rb +54 -0
  671. data/test/ruby/rack/loader_spec.rb +62 -0
  672. data/test/ruby/rack/preloader_spec.rb +74 -0
  673. data/test/ruby/{abstract_request_handler_spec.rb → request_handler_spec.rb} +31 -68
  674. data/test/ruby/shared/loader_spec.rb +241 -0
  675. data/test/ruby/shared/rails/analytics_logging_extensions_spec.rb +141 -182
  676. data/test/ruby/shared/ruby_loader_spec.rb +55 -0
  677. data/test/ruby/spec_helper.rb +8 -53
  678. data/test/ruby/utils/file_system_watcher_spec.rb +9 -1
  679. data/test/ruby/utils_spec.rb +10 -683
  680. data/test/stub/rack/config.ru +28 -3
  681. data/test/stub/rack/start.rb +47 -0
  682. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/Rakefile +0 -0
  683. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/app/controllers/application_controller.rb +0 -2
  684. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/app/controllers/bar_controller_1.rb +0 -0
  685. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/app/controllers/bar_controller_2.rb +0 -0
  686. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/app/controllers/foo_controller.rb +0 -0
  687. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/app/helpers/application_helper.rb +0 -0
  688. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/config/boot.rb +0 -0
  689. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/config/database.yml +3 -3
  690. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/config/environment.rb +5 -2
  691. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/config/environments/development.rb +0 -0
  692. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/config/environments/production.rb +0 -0
  693. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/config/environments/staging.rb +0 -0
  694. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/config/initializers/inflections.rb +0 -0
  695. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/config/initializers/mime_types.rb +0 -0
  696. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/config/routes.rb +1 -0
  697. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/script/about +0 -0
  698. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/script/console +0 -0
  699. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/script/dbconsole +0 -0
  700. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/script/destroy +0 -0
  701. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/script/generate +0 -0
  702. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/script/performance/benchmarker +0 -0
  703. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/script/performance/profiler +0 -0
  704. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/script/performance/request +0 -0
  705. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/script/plugin +0 -0
  706. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/script/process/inspector +0 -0
  707. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/script/process/reaper +0 -0
  708. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/script/process/spawner +0 -0
  709. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/script/runner +0 -0
  710. data/test/stub/{rails_apps/2.3/foobar → rails2.3}/script/server +0 -0
  711. data/test/stub/{rails_apps/3.0/empty → rails3.0}/Gemfile +0 -0
  712. data/test/stub/rails3.0/Gemfile.lock +80 -0
  713. data/test/stub/{rails_apps/3.0/empty → rails3.0}/Rakefile +0 -0
  714. data/test/stub/{rails_apps/3.0/empty → rails3.0}/app/controllers/application_controller.rb +0 -0
  715. data/test/stub/{rails_apps/3.0/empty → rails3.0}/app/helpers/application_helper.rb +0 -0
  716. data/test/stub/{rails_apps/3.0/empty → rails3.0}/app/views/layouts/application.html.erb +0 -0
  717. data/test/stub/{rails_apps/3.0/empty → rails3.0}/config.ru +0 -0
  718. data/test/stub/{rails_apps/3.0/empty → rails3.0}/config/application.rb +0 -0
  719. data/test/stub/{rails_apps/3.0/empty → rails3.0}/config/boot.rb +0 -0
  720. data/test/stub/{rails_apps/3.0/empty → rails3.0}/config/database.yml +0 -0
  721. data/test/stub/{rails_apps/3.0/empty → rails3.0}/config/environment.rb +0 -0
  722. data/test/stub/{rails_apps/3.0/empty → rails3.0}/config/environments/development.rb +0 -0
  723. data/test/stub/{rails_apps/3.0/empty → rails3.0}/config/environments/production.rb +0 -0
  724. data/test/stub/{rails_apps/3.0/empty → rails3.0}/config/environments/test.rb +0 -0
  725. data/test/stub/{rails_apps/3.0/empty → rails3.0}/config/initializers/backtrace_silencers.rb +0 -0
  726. data/test/stub/{rails_apps/3.0/empty → rails3.0}/config/initializers/inflections.rb +0 -0
  727. data/test/stub/{rails_apps/3.0/empty → rails3.0}/config/initializers/mime_types.rb +0 -0
  728. data/test/stub/{rails_apps/3.0/empty → rails3.0}/config/initializers/passenger.rb +0 -0
  729. data/test/stub/{rails_apps/3.0/empty → rails3.0}/config/initializers/secret_token.rb +0 -0
  730. data/test/stub/{rails_apps/3.0/empty → rails3.0}/config/initializers/session_store.rb +0 -0
  731. data/test/stub/{rails_apps/3.0/empty → rails3.0}/config/locales/en.yml +0 -0
  732. data/test/stub/{rails_apps/3.0/empty → rails3.0}/config/routes.rb +0 -0
  733. data/test/stub/{rails_apps/3.0/empty → rails3.0}/db/seeds.rb +0 -0
  734. data/test/stub/{rails_apps/3.0/empty → rails3.0}/doc/README_FOR_APP +0 -0
  735. data/test/stub/{rails_apps/3.0/empty → rails3.0}/public/404.html +0 -0
  736. data/test/stub/{rails_apps/3.0/empty → rails3.0}/public/422.html +0 -0
  737. data/test/stub/{rails_apps/3.0/empty → rails3.0}/public/500.html +0 -0
  738. data/test/stub/{rails_apps/3.0/empty → rails3.0}/public/favicon.ico +0 -0
  739. data/test/stub/{rails_apps/3.0/empty → rails3.0}/public/index.html +0 -0
  740. data/test/stub/{rails_apps/3.0/empty → rails3.0}/public/robots.txt +0 -0
  741. data/test/stub/{rails_apps/3.0/empty → rails3.0}/script/rails +0 -0
  742. data/test/stub/{rails_apps/3.0/empty → rails3.0}/test/performance/browsing_test.rb +0 -0
  743. data/test/stub/{rails_apps/3.0/empty → rails3.0}/test/test_helper.rb +0 -0
  744. data/test/stub/start_error.pl +24 -0
  745. data/test/stub/wsgi/passenger_wsgi.py +71 -3
  746. data/test/support/apache2_controller.rb +2 -2
  747. data/test/support/placebo-preloader.rb +88 -0
  748. data/test/support/test_helper.rb +1 -14
  749. data/test/tut/tut.h +11 -4
  750. metadata +590 -326
  751. data.tar.gz.asc +0 -12
  752. data/PACKAGING.TXT +0 -25
  753. data/build/config.rb +0 -46
  754. data/ext/apache2/HelperAgent.cpp +0 -364
  755. data/ext/boost/call_traits.hpp +0 -24
  756. data/ext/boost/detail/call_traits.hpp +0 -164
  757. data/ext/common/AbstractSpawnManager.h +0 -110
  758. data/ext/common/AgentBase.cpp +0 -432
  759. data/ext/common/ApplicationPool/Client.h +0 -788
  760. data/ext/common/ApplicationPool/Interface.h +0 -295
  761. data/ext/common/ApplicationPool/Pool.h +0 -1327
  762. data/ext/common/ApplicationPool/Server.h +0 -479
  763. data/ext/common/MessageChannel.h +0 -494
  764. data/ext/common/PoolOptions.h +0 -518
  765. data/ext/common/Process.h +0 -253
  766. data/ext/common/Session.h +0 -436
  767. data/ext/common/SpawnManager.h +0 -611
  768. data/ext/google/ChangeLog +0 -167
  769. data/ext/google/dense_hash_map +0 -310
  770. data/ext/google/dense_hash_set +0 -287
  771. data/ext/google/sparse_hash_map +0 -294
  772. data/ext/google/sparse_hash_set +0 -275
  773. data/ext/google/sparsehash/densehashtable.h +0 -1062
  774. data/ext/google/sparsehash/sparseconfig.h +0 -55
  775. data/ext/google/sparsehash/sparsehashtable.h +0 -1015
  776. data/ext/google/sparsetable +0 -1468
  777. data/ext/google/type_traits.h +0 -250
  778. data/ext/nginx/HelperAgent.cpp +0 -1355
  779. data/ext/nginx/ScgiRequestParser.h +0 -375
  780. data/ext/oxt/backtrace.cpp +0 -185
  781. data/ext/oxt/tracable_exception.cpp +0 -89
  782. data/helper-scripts/passenger-spawn-server +0 -106
  783. data/lib/phusion_passenger/abstract_request_handler.rb +0 -766
  784. data/lib/phusion_passenger/abstract_server.rb +0 -372
  785. data/lib/phusion_passenger/abstract_server_collection.rb +0 -335
  786. data/lib/phusion_passenger/app_process.rb +0 -174
  787. data/lib/phusion_passenger/classic_rails/application_spawner.rb +0 -344
  788. data/lib/phusion_passenger/classic_rails/framework_spawner.rb +0 -311
  789. data/lib/phusion_passenger/exceptions.rb +0 -103
  790. data/lib/phusion_passenger/html_template.rb +0 -107
  791. data/lib/phusion_passenger/rack/application_spawner.rb +0 -231
  792. data/lib/phusion_passenger/spawn_manager.rb +0 -359
  793. data/lib/phusion_passenger/templates/app_exited_during_initialization.html.erb +0 -38
  794. data/lib/phusion_passenger/templates/app_init_error.html.erb +0 -64
  795. data/lib/phusion_passenger/templates/database_error.html.erb +0 -66
  796. data/lib/phusion_passenger/templates/error_layout.html.erb +0 -39
  797. data/lib/phusion_passenger/templates/framework_init_error.html.erb +0 -39
  798. data/lib/phusion_passenger/templates/general_error.html.erb +0 -22
  799. data/lib/phusion_passenger/templates/load_error.html.erb +0 -46
  800. data/lib/phusion_passenger/templates/version_not_found.html.erb +0 -34
  801. data/lib/phusion_passenger/utils/rewindable_input.rb +0 -125
  802. data/lib/phusion_passenger/wsgi/application_spawner.rb +0 -108
  803. data/test/config.yml.example +0 -41
  804. data/test/cxx/ApplicationPool_PoolTest.cpp +0 -33
  805. data/test/cxx/ApplicationPool_PoolTestCases.cpp +0 -1029
  806. data/test/cxx/ApplicationPool_ServerTest.cpp +0 -308
  807. data/test/cxx/ApplicationPool_Server_PoolTest.cpp +0 -80
  808. data/test/cxx/MessageChannelTest.cpp +0 -557
  809. data/test/cxx/PoolOptionsTest.cpp +0 -116
  810. data/test/cxx/SpawnManagerTest.cpp +0 -161
  811. data/test/ruby/abstract_server_collection_spec.rb +0 -247
  812. data/test/ruby/abstract_server_spec.rb +0 -61
  813. data/test/ruby/app_process_spec.rb +0 -43
  814. data/test/ruby/classic_rails/application_spawner_spec.rb +0 -89
  815. data/test/ruby/classic_rails/framework_spawner_spec.rb +0 -92
  816. data/test/ruby/rack/application_spawner_spec.rb +0 -116
  817. data/test/ruby/shared/abstract_server_spec.rb +0 -23
  818. data/test/ruby/shared/spawners/classic_rails/framework_spawner_spec.rb +0 -38
  819. data/test/ruby/shared/spawners/classic_rails/lack_of_rails_gem_version_spec.rb +0 -19
  820. data/test/ruby/shared/spawners/classic_rails/spawner_spec.rb +0 -15
  821. data/test/ruby/shared/spawners/non_preloading_spawner_spec.rb +0 -27
  822. data/test/ruby/shared/spawners/preloading_spawner_spec.rb +0 -29
  823. data/test/ruby/shared/spawners/reload_all_spec.rb +0 -36
  824. data/test/ruby/shared/spawners/reload_single_spec.rb +0 -52
  825. data/test/ruby/shared/spawners/spawn_server_spec.rb +0 -28
  826. data/test/ruby/shared/spawners/spawner_spec.rb +0 -273
  827. data/test/ruby/shared/utils/pseudo_io_spec.rb +0 -60
  828. data/test/ruby/spawn_manager_spec.rb +0 -134
  829. data/test/ruby/wsgi/application_spawner_spec.rb +0 -50
  830. data/test/stub/message_channel.rb +0 -11
  831. data/test/stub/message_channel_2.rb +0 -12
  832. data/test/stub/message_channel_3.rb +0 -19
  833. data/test/stub/rails_apps/3.0/empty/Gemfile.lock +0 -73
  834. data/test/stub/spawn_server.rb +0 -22
  835. metadata.gz.asc +0 -12
@@ -1,52 +1,26 @@
1
- Phusion Passenger users guide
2
- =============================
1
+ Phusion Passenger users guide, Apache version
2
+ =============================================
3
3
 
4
4
  image:images/phusion_banner.png[link="http://www.phusion.nl/"]
5
5
 
6
- Phusion Passenger is an Apache module, which makes deploying Ruby and Ruby on
7
- Rails applications on Apache a breeze. It follows the usual Ruby on Rails
8
- conventions, such as "Don't-Repeat-Yourself" and ease of setup, while at the
9
- same time providing enough flexibility.
6
+ Phusion Passenger is an application server which can directly integrate into Apache. It is designed to be easy to use, fast, stable and reliable and is used by link:http://trends.builtwith.com/Web-Server/Phusion-Passenger[hundreds of thousands of websites] all over the world.
7
+
8
+ Phusion Passenger is a so-called polyglot application server because it supports applications written in multiple programming languages. At this time, Ruby and Python are supported.
10
9
 
11
10
  This users guide will teach you:
12
11
 
13
12
  - How to install Phusion Passenger.
14
13
  - How to configure Phusion Passenger.
15
- - How to deploy a Ruby on Rails application.
16
- - How to deploy a link:http://rack.rubyforge.org/[Rack]-based Ruby application.
14
+ - How to deploy Ruby and Python applications.
17
15
  - How to solve common problems.
18
16
 
19
17
  This guide assumes that the reader is somewhat familiar with Apache and with
20
- using the commandline.
18
+ using the command line.
21
19
 
22
20
 
23
21
  == Support information ==
24
22
 
25
- === Supported operating systems ===
26
-
27
- Phusion Passenger works on any POSIX-compliant operating system. In other
28
- words: practically any operating system on earth, except Microsoft Windows.
29
-
30
- Phusion Passenger is confirmed on a large number of operating systems and Linux
31
- distributions, including, but not limited to, Ubuntu, Debian, CentOS/Fedora/RHEL,
32
- Gentoo, Mac OS X, FreeBSD and Solaris. Both 32-bit and 64-bit platforms are supported.
33
-
34
- The only POSIX-compliant operating system on which Phusion Passenger for Apache is
35
- known not to work at this time, is OpenBSD. Please use Phusion Passenger for Nginx
36
- instead.
37
-
38
- Please
39
- link:http://code.google.com/p/phusion-passenger/issues/list[report a bug]
40
- or
41
- link:http://groups.google.com/group/phusion-passenger[join our discussion forum]
42
- if it doesn't work on your POSIX-compliant operating system.
43
-
44
- === Where to get support ===
45
-
46
- * link:http://code.google.com/p/phusion-passenger/issues/list[Issue tracker] - report
47
- bugs here.
48
- * link:http://groups.google.com/group/phusion-passenger[Discussion forum] - post a
49
- message here if you're experiencing problems.
23
+ include::users_guide_snippets/support_information.txt[]
50
24
 
51
25
 
52
26
  == Installing, upgrading and uninstalling Phusion Passenger ==
@@ -58,8 +32,8 @@ if it doesn't work on your POSIX-compliant operating system.
58
32
 
59
33
  There are three ways to install Phusion Passenger:
60
34
 
61
- 1. By installing the Phusion Passenger gem, as instructed on the
62
- link:http://www.modrails.com/install.html[``Install'' page on the Phusion
35
+ 1. By installing the Phusion Passenger Ruby gem, as instructed on the
36
+ link:https://www.phusionpassenger.com/download[``Download'' page on the Phusion
63
37
  Passenger website].
64
38
  2. By downloading the source tarball from the Phusion Passenger website
65
39
  ('passenger-x.x.x.tar.gz').
@@ -219,12 +193,6 @@ Phusion Passenger.
219
193
 
220
194
  === Operating system-specific instructions and information ===
221
195
 
222
- ==== MacOS X ====
223
-
224
- Ben Ruebenstein has written an excellent
225
- link:http://benr75.com/articles/2008/04/12/setup-mod_rails-phusion-mac-os-x-leopard[tutorial
226
- on installing Phusion Passenger on OS X].
227
-
228
196
  ==== Ubuntu Linux ====
229
197
 
230
198
  Ben Hughes has written an link:http://www.railsgarden.com/2008/04/12/configurating-passenger-mod_rails-on-slicehost-with-ubuntu-710/[article on installing Phusion Passenger on Ubuntu].
@@ -715,6 +683,114 @@ touch /webapps/rackapp/tmp/restart.txt
715
683
  include::users_guide_snippets/rackup_specifications.txt[]
716
684
 
717
685
 
686
+ == Deploying a WSGI (Python) application
687
+
688
+ Phusion Passenger supports all WSGI-compliant Python web applications. Suppose that you have a WSGI application in '/webapps/wsgiapp'. Then that folder must contain at least three entries:
689
+
690
+ - 'passenger_wsgi.py', which Phusion Passenger will use as the main entry point for your application. This file must export a WSGI object called `application`.
691
+ - 'public/', a folder containing public static web assets, like images and stylesheets.
692
+ - 'tmp/', used for 'restart.txt' (our application restart mechanism). This will be explained in a following subsection.
693
+
694
+ So '/webapps/wsgiapp' must, at minimum, look like this:
695
+ ----------------------
696
+ /webapps/wsgiapp
697
+ |
698
+ +-- config.ru
699
+ |
700
+ +-- public/
701
+ |
702
+ +-- tmp/
703
+ ----------------------
704
+
705
+ === Tutorial/example: writing and deploying a Hello World WSGI application ===
706
+
707
+ First we create a Phusion Passenger-compliant WSGI directory structure:
708
+
709
+ -------------------------------------------
710
+ $ mkdir /webapps/wsgi_example
711
+ $ mkdir /webapps/wsgi_example/public
712
+ $ mkdir /webapps/wsgi_example/tmp
713
+ -------------------------------------------
714
+
715
+ Next, we write a minimal "hello world" WSGI application:
716
+
717
+ -------------------------------------------
718
+ $ cd /webapps/wsgi_example
719
+ $ some_awesome_editor passenger_wsgi.py
720
+ ...type in some source code...
721
+ $ cat passenger_wsgi.py
722
+ def application(environ, start_response):
723
+ start_response(200, [('Content-Type', 'text/plain')])
724
+ return ["hello world!\n"]
725
+ -------------------------------------------
726
+
727
+ Finally, we deploy it by adding the following configuration options to
728
+ the Apache configuration file:
729
+
730
+ -------------------------------------------
731
+ <VirtualHost *:80>
732
+ ServerName www.wsgiexample.com
733
+ DocumentRoot /webapps/wsgi_example/public
734
+ <Directory /webapps/wsgi_example/public>
735
+ Allow from all
736
+ Options -MultiViews
737
+ </Directory>
738
+ </VirtualHost>
739
+ -------------------------------------------
740
+
741
+ And we're done! After an Apache restart, the above WSGI application will be available
742
+ under the URL 'http://www.wsgiexample.com/'.
743
+
744
+ === Deploying to a virtual host's root ===
745
+
746
+ Add a virtual host entry to your Apache configuration file. Make sure that the
747
+ following conditions are met:
748
+
749
+ - The virtual host's document root must point to your WSGI application's
750
+ 'public' folder.
751
+ - The WSGI per-directory permissions must allow access to this folder.
752
+ - MultiViews must be disabled for this folder.
753
+
754
+ For example:
755
+ -------------------------------------------
756
+ <VirtualHost *:80>
757
+ ServerName www.wsgiapp.com
758
+ DocumentRoot /webapps/wsgiapp/public
759
+ <Directory /webapps/wsgiapp/public>
760
+ Allow from all
761
+ Options -MultiViews
762
+ </Directory>
763
+ </VirtualHost>
764
+ -------------------------------------------
765
+
766
+ You may also need to tweak your file/folder permissions. Make sure that the
767
+ following folders are readable and executable by Apache:
768
+
769
+ * this 'public' folder.
770
+ * the application's 'config' folder.
771
+ * all parent folders. That is, /webapps/wsgiapp and /webapps must also be readable and executable by Apache.
772
+
773
+ Then restart Apache. The application has now been deployed.
774
+
775
+ === Redeploying (restarting the WSGI application) ===
776
+
777
+ Deploying a new version of a WSGI application is as simple as
778
+ re-uploading the application files, and restarting the application.
779
+
780
+ There are two ways to restart the application:
781
+
782
+ 1. By restarting Apache.
783
+ 2. By creating or modifying the file 'tmp/restart.txt' in the WSGI
784
+ application's <<application_root,root folder>>. Phusion Passenger will
785
+ automatically restart the application.
786
+
787
+ For example, to restart our example application, we type this in the
788
+ command line:
789
+ -------------------------------------------
790
+ touch /webapps/wsgiapp/tmp/restart.txt
791
+ -------------------------------------------
792
+
793
+
718
794
  == Configuring Phusion Passenger ==
719
795
 
720
796
  After installation, Phusion Passenger does not need any further configurations.
@@ -737,8 +813,14 @@ This required option may only occur once, in the global server configuration.
737
813
  === PassengerRuby <filename> ===
738
814
  This option allows one to specify the Ruby interpreter to use.
739
815
 
740
- This option may only occur once, in the global server configuration.
741
- The default is 'ruby'.
816
+ This option may occur in the following places:
817
+
818
+ * In the global server configuration.
819
+ * In a virtual host configuration block.
820
+ * In a `<Directory>` or `<Location>` block.
821
+ * In '.htaccess', if `AllowOverride Options` is on.
822
+
823
+ In each place, it may be specified at most once. The default value is 'ruby', meaning that the Ruby interpreter will be looked up according to the `PATH` environment variable.
742
824
 
743
825
  [[PassengerAppRoot]]
744
826
  === PassengerAppRoot <path/to/root> ===
@@ -793,22 +875,6 @@ This option may occur in the following places:
793
875
 
794
876
  In each place, it may be specified at most once. The default value is 'smart-lv2'.
795
877
 
796
- [[PassengerUseGlobalQueue]]
797
- === PassengerUseGlobalQueue <on|off> ===
798
- Turns the use of global queuing on or off.
799
-
800
- This option may occur in the following places:
801
-
802
- * In the global server configuration.
803
- * In a virtual host configuration block.
804
-
805
- In each place, it may be specified at most once. The default value is 'on'.
806
-
807
- 'This feature is sponsored by http://www.37signals.com/[37signals].'
808
-
809
- include::users_guide_snippets/global_queueing_explained.txt[]
810
-
811
-
812
878
  === PassengerEnabled <on|off> ===
813
879
  You can set this option to 'off' to completely disable Phusion Passenger for
814
880
  a certain location. This is useful if, for example, you want to integrate a PHP
@@ -1353,6 +1419,30 @@ applications, each which must be available at all times.
1353
1419
  This option may only occur once, in the global server configuration.
1354
1420
  The default value is '300'.
1355
1421
 
1422
+ ==== PassengerMaxPreloaderIdleTime <integer> ====
1423
+ The ApplicationSpawner server (explained in <<spawning_methods_explained,Spawning
1424
+ methods explained>>) has an idle timeout, just like the backend processes spawned by
1425
+ Phusion Passenger do. That is, it will automatically shutdown if it hasn't done
1426
+ anything for a given period.
1427
+
1428
+ This option allows you to set the ApplicationSpawner server's idle timeout, in
1429
+ seconds. A value of '0' means that it should never idle timeout.
1430
+
1431
+ Setting a higher value will mean that the ApplicationSpawner server is kept around
1432
+ longer, which may slightly increase memory usage. But as long as the
1433
+ ApplicationSpawner server is running, the time to spawn a Ruby on Rails backend
1434
+ process only takes about 10% of the time that is normally needed, assuming that
1435
+ you're using the 'smart' or 'smart-lv2' <<PassengerSpawnMethod,spawning method>>. So if your
1436
+ system has enough memory, is it recommended that you set this option to a high
1437
+ value or to '0'.
1438
+
1439
+ This option may occur in the following places:
1440
+
1441
+ * In the global server configuration.
1442
+ * In a virtual host configuration block.
1443
+
1444
+ In each place, it may be specified at most once. The default value is '300' (5 minutes).
1445
+
1356
1446
  [[PassengerMaxRequests]]
1357
1447
  ==== PassengerMaxRequests <integer> ====
1358
1448
  The maximum number of requests an application process will process. After
@@ -1918,7 +2008,10 @@ This option may occur in the following places:
1918
2008
  In each place, it may be specified at most once. The default value is 'off'.
1919
2009
 
1920
2010
 
1921
- === Ruby on Rails-specific options ===
2011
+ === Classic Ruby on Rails (<= 2.x)-specific options ===
2012
+
2013
+ These options only have effect on classic Ruby on Rails 1.x and 2.x applications.
2014
+ Ruby on Rails >= 3.x applications are considered Rack applications.
1922
2015
 
1923
2016
  ==== RailsAutoDetect <on|off> ====
1924
2017
  Whether Phusion Passenger should automatically detect whether a virtual host's
@@ -1981,54 +2074,6 @@ This option may occur in the following places:
1981
2074
 
1982
2075
  In each place, it may be specified at most once. The default value is 'production'.
1983
2076
 
1984
- ==== RailsFrameworkSpawnerIdleTime <integer> ====
1985
- The FrameworkSpawner server (explained in <<spawning_methods_explained,Spawning
1986
- methods explained>>) has an idle timeout, just like the backend processes spawned by
1987
- Phusion Passenger do. That is, it will automatically shutdown if it hasn't done
1988
- anything for a given period.
1989
-
1990
- This option allows you to set the FrameworkSpawner server's idle timeout, in
1991
- seconds. A value of '0' means that it should never idle timeout.
1992
-
1993
- Setting a higher value will mean that the FrameworkSpawner server is kept around
1994
- longer, which may slightly increase memory usage. But as long as the
1995
- FrameworkSpawner server is running, the time to spawn a Ruby on Rails backend
1996
- process only takes about 40% of the time that is normally needed, assuming that
1997
- you're using the 'smart' <<PassengerSpawnMethod,spawning method>>. So if your
1998
- system has enough memory, is it recommended that you set this option to a high
1999
- value or to '0'.
2000
-
2001
- This option may occur in the following places:
2002
-
2003
- * In the global server configuration.
2004
- * In a virtual host configuration block.
2005
-
2006
- In each place, it may be specified at most once. The default value is '1800' (30 minutes).
2007
-
2008
- ==== RailsAppSpawnerIdleTime <integer> ====
2009
- The ApplicationSpawner server (explained in <<spawning_methods_explained,Spawning
2010
- methods explained>>) has an idle timeout, just like the backend processes spawned by
2011
- Phusion Passenger do. That is, it will automatically shutdown if it hasn't done
2012
- anything for a given period.
2013
-
2014
- This option allows you to set the ApplicationSpawner server's idle timeout, in
2015
- seconds. A value of '0' means that it should never idle timeout.
2016
-
2017
- Setting a higher value will mean that the ApplicationSpawner server is kept around
2018
- longer, which may slightly increase memory usage. But as long as the
2019
- ApplicationSpawner server is running, the time to spawn a Ruby on Rails backend
2020
- process only takes about 10% of the time that is normally needed, assuming that
2021
- you're using the 'smart' or 'smart-lv2' <<PassengerSpawnMethod,spawning method>>. So if your
2022
- system has enough memory, is it recommended that you set this option to a high
2023
- value or to '0'.
2024
-
2025
- This option may occur in the following places:
2026
-
2027
- * In the global server configuration.
2028
- * In a virtual host configuration block.
2029
-
2030
- In each place, it may be specified at most once. The default value is '600' (10 minutes).
2031
-
2032
2077
  === Rack and Rails >= 3 specific options ===
2033
2078
 
2034
2079
  ==== RackAutoDetect <on|off> ====
@@ -1,9 +1,9 @@
1
1
  <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
- <meta name="generator" content="AsciiDoc 8.6.7">
6
- <title>Phusion Passenger users guide, Nginx version</title>
2
+ <html lang="en">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
+ <meta name="generator" content="AsciiDoc 8.6.7">
6
+ <title>Phusion Passenger users guide, Nginx version</title>
7
7
  <style type="text/css">
8
8
  /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
9
9
 
@@ -603,7 +603,7 @@ div.exampleblock > div.content, div.sidebarblock > div.content, div.listingblock
603
603
  div.verseblock { border-left-width: 0; margin-left: 3em; }
604
604
  div.quoteblock { border-left-width: 3px; margin-left: 0; margin-right: 0;}
605
605
  div.admonitionblock td.content { border-left: 3px solid #E8E8E8; }
606
- </style>
606
+ </style>
607
607
  <script type="text/javascript">
608
608
  /*<![CDATA[*/
609
609
  var asciidoc = { // Namespace.
@@ -795,14 +795,11 @@ install: function(toclevels) {
795
795
  }
796
796
 
797
797
  }
798
- asciidoc.install();
798
+ asciidoc.install(3);
799
799
  /*]]>*/
800
- </script>
801
- <style type="text/css">
800
+ </script><style type="text/css">
802
801
  body {
803
- margin: 1em auto 1em auto;
804
- padding: 0 1em 0 1em;
805
- max-width: 800px;
802
+ margin: 1em 10% 1em 10%;
806
803
  }
807
804
 
808
805
  a.image {
@@ -881,10 +878,6 @@ a.image {
881
878
  margin: 2em;
882
879
  }
883
880
 
884
- pre {
885
- overflow: auto;
886
- }
887
-
888
881
  @media print {
889
882
  body {
890
883
  font-size: 18pt;
@@ -1045,40 +1038,27 @@ pre {
1045
1038
  border-bottom-right-radius: 0;
1046
1039
  }
1047
1040
 
1048
- /* http://nicolasgallagher.com/jump-links-and-viewport-positioning/ */
1049
- .anchor_helper {
1050
- position: relative;
1051
- display: block;
1052
- top: -50px;
1053
- width: 1px;
1054
- height: 1px;
1055
- }
1056
-
1057
1041
  </style>
1058
- </head>
1042
+ </head>
1059
1043
  <body class="article">
1060
1044
  <div id="topbar" style="display: none">
1061
1045
  <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>
1046
+ <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
1047
  </div>
1065
1048
  <a href="javascript:void(0)" id="current_section"></a>
1066
1049
  </div>
1067
1050
  <div id="header">
1068
- <h1>Phusion Passenger users guide, Nginx version</h1>
1051
+ <h1>Phusion Passenger users guide, Nginx version</h1>
1069
1052
  <div id="preamble">
1070
1053
  <div class="sectionbody">
1071
1054
  <div class="paragraph"><p><span class="image">
1072
1055
  <a class="image" href="http://www.phusion.nl/">
1073
- <img src="images/phusion_banner.png" alt="images/phusion_banner.png">
1074
- </a>
1056
+ <img src="images/phusion_banner.png" alt="images/phusion_banner.png"></a>
1075
1057
  </span></p></div>
1076
- <div class="paragraph"><p>Phusion Passenger is an Nginx module, which makes deploying Ruby and Ruby on
1077
- Rails applications on Nginx a breeze. It follows the usual Ruby on Rails
1078
- conventions, such as "Don’t-Repeat-Yourself" and ease of setup, while at the
1079
- same time providing enough flexibility.</p></div>
1058
+ <div class="paragraph"><p>Phusion Passenger is an application server which can directly integrate into Nginx. It is designed to be easy to use, fast, stable and reliable and is used by <a href="http://trends.builtwith.com/Web-Server/Phusion-Passenger">hundreds of thousands of websites</a> all over the world.</p></div>
1059
+ <div class="paragraph"><p>Phusion Passenger is a so-called polyglot application server because it supports applications written in multiple programming languages. At this time, Ruby and Python are supported.</p></div>
1080
1060
  <div class="paragraph"><p>This users guide will teach you:</p></div>
1081
- <div class="ulist"><ul>
1061
+ <div class="ulist"><ul>
1082
1062
  <li>
1083
1063
  <p>
1084
1064
  How to install Nginx with Phusion Passenger support.
@@ -1091,12 +1071,7 @@ How to configure Phusion Passenger.
1091
1071
  </li>
1092
1072
  <li>
1093
1073
  <p>
1094
- How to deploy a Ruby on Rails application.
1095
- </p>
1096
- </li>
1097
- <li>
1098
- <p>
1099
- How to deploy a <a href="http://rack.rubyforge.org/">Rack</a>-based Ruby application.
1074
+ How to deploy Ruby and Python applications.
1100
1075
  </p>
1101
1076
  </li>
1102
1077
  <li>
@@ -1106,145 +1081,35 @@ How to solve common problems.
1106
1081
  </li>
1107
1082
  </ul></div>
1108
1083
  <div class="paragraph"><p>This guide assumes that the reader is somewhat familiar with Nginx and with
1109
- using the commandline.</p></div>
1084
+ using the command line.</p></div>
1085
+ </div>
1110
1086
  </div>
1111
- </div>
1112
1087
  <div id="toc">
1113
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><div id="toctitle">Table of Contents</div>
1114
- <div class="foo toclevel2"><a href="#_support_information">1. Support information</a></div>
1115
- <div class="foo toclevel3"><a href="#_supported_operating_systems">1.1. Supported operating systems</a></div>
1116
- <div class="foo toclevel3"><a href="#_where_to_get_support">1.2. Where to get support</a></div>
1117
- <div class="foo toclevel2"><a href="#_installing_phusion_passenger">2. Installing Phusion Passenger</a></div>
1118
- <div class="foo toclevel3"><a href="#_overview">2.1. Overview</a></div>
1119
- <div class="foo toclevel3"><a href="#specifying_ruby_installation">2.2. Specifying the correct Ruby installation</a></div>
1120
- <div class="foo toclevel3"><a href="#_installing_phusion_passenger_for_nginx_through_the_installer">2.3. Installing Phusion Passenger for Nginx through the installer</a></div>
1121
- <div class="foo toclevel4"><a href="#_obtaining_the_phusion_passenger_files_and_running_the_installer">2.3.1. Obtaining the Phusion Passenger files and running the installer</a></div>
1122
- <div class="foo toclevel4"><a href="#_non_interactive_automatic_installation">2.3.2. Non-interactive/automatic installation</a></div>
1123
- <div class="foo toclevel3"><a href="#_installing_phusion_passenger_for_nginx_manually">2.4. Installing Phusion Passenger for Nginx manually</a></div>
1124
- <div class="foo toclevel3"><a href="#_upgrading_or_downgrading_phusion_passenger_or_nginx_itself">2.5. Upgrading or downgrading Phusion Passenger or Nginx itself</a></div>
1125
- <div class="foo toclevel3"><a href="#_unloading_disabling_phusion_passenger_from_nginx_without_uninstalling_it">2.6. Unloading (disabling) Phusion Passenger from Nginx without uninstalling it</a></div>
1126
- <div class="foo toclevel3"><a href="#_uninstalling_phusion_passenger">2.7. Uninstalling Phusion Passenger</a></div>
1127
- <div class="foo toclevel2"><a href="#deploying_a_ror_app">3. Deploying a Ruby on Rails 1.x or 2.x (but NOT Rails &gt;= 3) application</a></div>
1128
- <div class="foo toclevel3"><a href="#_deploying_to_a_virtual_host_8217_s_root">3.1. Deploying to a virtual host’s root</a></div>
1129
- <div class="foo toclevel3"><a href="#deploying_rails_to_sub_uri">3.2. Deploying to a sub URI</a></div>
1130
- <div class="foo toclevel3"><a href="#_redeploying_restarting_the_ruby_on_rails_application">3.3. Redeploying (restarting the Ruby on Rails application)</a></div>
1131
- <div class="foo toclevel3"><a href="#_migrations">3.4. Migrations</a></div>
1132
- <div class="foo toclevel3"><a href="#_capistrano_integration">3.5. Capistrano integration</a></div>
1133
- <div class="foo toclevel2"><a href="#deploying_a_rack_app">4. Deploying a Rack-based Ruby application (including Rails &gt;= 3)</a></div>
1134
- <div class="foo toclevel3"><a href="#_tutorial_example_writing_and_deploying_a_hello_world_rack_application">4.1. Tutorial/example: writing and deploying a Hello World Rack application</a></div>
1135
- <div class="foo toclevel3"><a href="#_deploying_to_a_virtual_host_8217_s_root_2">4.2. Deploying to a virtual host’s root</a></div>
1136
- <div class="foo toclevel3"><a href="#deploying_rack_to_sub_uri">4.3. Deploying to a sub URI</a></div>
1137
- <div class="foo toclevel3"><a href="#_redeploying_restarting_the_rack_application">4.4. Redeploying (restarting the Rack application)</a></div>
1138
- <div class="foo toclevel3"><a href="#_rackup_specifications_for_various_web_frameworks">4.5. Rackup specifications for various web frameworks</a></div>
1139
- <div class="foo toclevel4"><a href="#_camping">4.5.1. Camping</a></div>
1140
- <div class="foo toclevel4"><a href="#_halcyon">4.5.2. Halcyon</a></div>
1141
- <div class="foo toclevel4"><a href="#_mack">4.5.3. Mack</a></div>
1142
- <div class="foo toclevel4"><a href="#_merb">4.5.4. Merb</a></div>
1143
- <div class="foo toclevel4"><a href="#_ramaze">4.5.5. Ramaze</a></div>
1144
- <div class="foo toclevel4"><a href="#_sinatra">4.5.6. Sinatra</a></div>
1145
- <div class="foo toclevel2"><a href="#_configuring_phusion_passenger">5. Configuring Phusion Passenger</a></div>
1146
- <div class="foo toclevel3"><a href="#_passenger_root_lt_directory_gt">5.1. passenger_root &lt;directory&gt;</a></div>
1147
- <div class="foo toclevel3"><a href="#_passenger_ruby_lt_filename_gt">5.2. passenger_ruby &lt;filename&gt;</a></div>
1148
- <div class="foo toclevel3"><a href="#PassengerSpawnMethod">5.3. passenger_spawn_method &lt;string&gt;</a></div>
1149
- <div class="foo toclevel3"><a href="#PassengerRollingRestarts">5.4. passenger_rolling_restarts &lt;on|off&gt;</a></div>
1150
- <div class="foo toclevel3"><a href="#_passenger_resist_deployment_errors_lt_on_off_gt">5.5. passenger_resist_deployment_errors &lt;on|off&gt;</a></div>
1151
- <div class="foo toclevel3"><a href="#_important_deployment_options">5.6. Important deployment options</a></div>
1152
- <div class="foo toclevel4"><a href="#_passenger_enabled_lt_on_off_gt">5.6.1. passenger_enabled &lt;on|off&gt;</a></div>
1153
- <div class="foo toclevel4"><a href="#PassengerBaseURI">5.6.2. passenger_base_uri &lt;uri&gt;</a></div>
1154
- <div class="foo toclevel3"><a href="#_connection_handling_options">5.7. Connection handling options</a></div>
1155
- <div class="foo toclevel4"><a href="#PassengerUseGlobalQueue">5.7.1. passenger_use_global_queue &lt;on|off&gt;</a></div>
1156
- <div class="foo toclevel4"><a href="#_passenger_ignore_client_abort_lt_on_off_gt">5.7.2. passenger_ignore_client_abort &lt;on|off&gt;</a></div>
1157
- <div class="foo toclevel4"><a href="#_passenger_set_cgi_param_lt_cgi_environment_name_gt_lt_value_gt">5.7.3. passenger_set_cgi_param &lt;CGI environment name&gt; &lt;value&gt;</a></div>
1158
- <div class="foo toclevel4"><a href="#_passenger_pass_header_lt_header_name_gt">5.7.4. passenger_pass_header &lt;header name&gt;</a></div>
1159
- <div class="foo toclevel4"><a href="#_passenger_buffer_response_lt_on_off_gt">5.7.5. passenger_buffer_response &lt;on|off&gt;</a></div>
1160
- <div class="foo toclevel4"><a href="#_passenger_buffer_size">5.7.6. passenger_buffer_size</a></div>
1161
- <div class="foo toclevel4"><a href="#_passenger_buffers">5.7.7. passenger_buffers</a></div>
1162
- <div class="foo toclevel4"><a href="#_passenger_busy_buffer_size">5.7.8. passenger_busy_buffer_size</a></div>
1163
- <div class="foo toclevel3"><a href="#_security_options">5.8. Security options</a></div>
1164
- <div class="foo toclevel4"><a href="#PassengerUserSwitching">5.8.1. passenger_user_switching &lt;on|off&gt;</a></div>
1165
- <div class="foo toclevel4"><a href="#_passenger_user_lt_username_gt">5.8.2. passenger_user &lt;username&gt;</a></div>
1166
- <div class="foo toclevel4"><a href="#_passenger_group_lt_group_name_gt">5.8.3. passenger_group &lt;group name&gt;</a></div>
1167
- <div class="foo toclevel4"><a href="#PassengerDefaultUser">5.8.4. passenger_default_user &lt;username&gt;</a></div>
1168
- <div class="foo toclevel4"><a href="#PassengerDefaultGroup">5.8.5. Passenger_default_group &lt;group name&gt;</a></div>
1169
- <div class="foo toclevel4"><a href="#_passenger_friendly_error_pages_lt_on_off_gt">5.8.6. passenger_friendly_error_pages &lt;on|off&gt;</a></div>
1170
- <div class="foo toclevel3"><a href="#_resource_control_and_optimization_options">5.9. Resource control and optimization options</a></div>
1171
- <div class="foo toclevel4"><a href="#PassengerMaxPoolSize">5.9.1. passenger_max_pool_size &lt;integer&gt;</a></div>
1172
- <div class="foo toclevel4"><a href="#PassengerMinInstances">5.9.2. passenger_min_instances &lt;integer&gt;</a></div>
1173
- <div class="foo toclevel4"><a href="#_passenger_max_instances_lt_integer_gt">5.9.3. passenger_max_instances &lt;integer&gt;</a></div>
1174
- <div class="foo toclevel4"><a href="#_passenger_max_instances_per_app_lt_integer_gt">5.9.4. passenger_max_instances_per_app &lt;integer&gt;</a></div>
1175
- <div class="foo toclevel4"><a href="#PassengerPoolIdleTime">5.9.5. passenger_pool_idle_time &lt;integer&gt;</a></div>
1176
- <div class="foo toclevel4"><a href="#PassengerMaxRequests">5.9.6. passenger_max_requests &lt;integer&gt;</a></div>
1177
- <div class="foo toclevel4"><a href="#PassengerMaxRequestTime">5.9.7. passenger_max_request_time &lt;seconds&gt;</a></div>
1178
- <div class="foo toclevel4"><a href="#PassengerMemoryLimit">5.9.8. passenger_memory_limit &lt;integer&gt;</a></div>
1179
- <div class="foo toclevel4"><a href="#PassengerPreStart">5.9.9. passenger_pre_start &lt;url&gt;</a></div>
1180
- <div class="foo toclevel3"><a href="#_logging_and_debugging_options">5.10. Logging and debugging options</a></div>
1181
- <div class="foo toclevel4"><a href="#_passenger_log_level_lt_integer_gt">5.10.1. passenger_log_level &lt;integer&gt;</a></div>
1182
- <div class="foo toclevel4"><a href="#_passenger_debug_log_file_lt_filename_gt">5.10.2. passenger_debug_log_file &lt;filename&gt;</a></div>
1183
- <div class="foo toclevel4"><a href="#_passenger_debugger_lt_on_off_gt">5.10.3. passenger_debugger &lt;on|off&gt;</a></div>
1184
- <div class="foo toclevel3"><a href="#_ruby_on_rails_specific_options">5.11. Ruby on Rails-specific options</a></div>
1185
- <div class="foo toclevel4"><a href="#RailsEnv">5.11.1. rails_env &lt;string&gt;</a></div>
1186
- <div class="foo toclevel4"><a href="#_rails_framework_spawner_idle_time_lt_integer_gt">5.11.2. rails_framework_spawner_idle_time &lt;integer&gt;</a></div>
1187
- <div class="foo toclevel4"><a href="#_rails_app_spawner_idle_time_lt_integer_gt">5.11.3. rails_app_spawner_idle_time &lt;integer&gt;</a></div>
1188
- <div class="foo toclevel3"><a href="#_rack_and_rails_gt_3_specific_options">5.12. Rack and Rails &gt;= 3 specific options</a></div>
1189
- <div class="foo toclevel4"><a href="#RackEnv">5.12.1. rack_env &lt;string&gt;</a></div>
1190
- <div class="foo toclevel3"><a href="#_deprecated_options">5.13. Deprecated options</a></div>
1191
- <div class="foo toclevel4"><a href="#_rails_spawn_method">5.13.1. rails_spawn_method</a></div>
1192
- <div class="foo toclevel2"><a href="#_analysis_and_system_maintenance">6. Analysis and system maintenance</a></div>
1193
- <div class="foo toclevel3"><a href="#_inspecting_memory_usage">6.1. Inspecting memory usage</a></div>
1194
- <div class="foo toclevel3"><a href="#_inspecting_phusion_passenger_8217_s_internal_status">6.2. Inspecting Phusion Passenger’s internal status</a></div>
1195
- <div class="foo toclevel3"><a href="#debugging_frozen">6.3. Debugging frozen applications</a></div>
1196
- <div class="foo toclevel3"><a href="#_accessing_individual_application_processes">6.4. Accessing individual application processes</a></div>
1197
- <div class="foo toclevel3"><a href="#_attaching_an_irb_console_to_an_application_process">6.5. Attaching an IRB console to an application process</a></div>
1198
- <div class="foo toclevel2"><a href="#_tips">7. Tips</a></div>
1199
- <div class="foo toclevel3"><a href="#user_switching">7.1. User switching (security)</a></div>
1200
- <div class="foo toclevel3"><a href="#reducing_memory_usage">7.2. Reducing memory consumption of Ruby on Rails applications by 33%</a></div>
1201
- <div class="foo toclevel3"><a href="#capistrano">7.3. Capistrano recipe</a></div>
1202
- <div class="foo toclevel3"><a href="#bundler_support">7.4. Bundler support</a></div>
1203
- <div class="foo toclevel3"><a href="#moving_phusion_passenger">7.5. Moving Phusion Passenger to a different directory</a></div>
1204
- <div class="foo toclevel3"><a href="#_installing_multiple_ruby_on_rails_versions">7.6. Installing multiple Ruby on Rails versions</a></div>
1205
- <div class="foo toclevel3"><a href="#_making_the_application_restart_after_each_request">7.7. Making the application restart after each request</a></div>
1206
- <div class="foo toclevel3"><a href="#sub_uri_deployment_uri_fix">7.8. How to fix broken images/CSS/JavaScript URIs in sub-URI deployments</a></div>
1207
- <div class="foo toclevel2"><a href="#_under_the_hood">8. Under the hood</a></div>
1208
- <div class="foo toclevel3"><a href="#_page_caching_support">8.1. Page caching support</a></div>
1209
- <div class="foo toclevel3"><a href="#application_detection">8.2. How Phusion Passenger detects whether a virtual host is a web application</a></div>
1210
- <div class="foo toclevel2"><a href="#_appendix_a_about_this_document">9. Appendix A: About this document</a></div>
1211
- <div class="foo toclevel2"><a href="#_appendix_b_terminology">10. Appendix B: Terminology</a></div>
1212
- <div class="foo toclevel3"><a href="#application_root">10.1. Application root</a></div>
1213
- <div class="foo toclevel3"><a href="#idle_process">10.2. Idle process</a></div>
1214
- <div class="foo toclevel3"><a href="#inactive_process">10.3. Inactive process</a></div>
1215
- <div class="foo toclevel2"><a href="#spawning_methods_explained">11. Appendix C: Spawning methods explained</a></div>
1216
- <div class="foo toclevel3"><a href="#_the_most_straightforward_and_traditional_way_conservative_spawning">11.1. The most straightforward and traditional way: conservative spawning</a></div>
1217
- <div class="foo toclevel3"><a href="#_the_smart_spawning_method">11.2. The smart spawning method</a></div>
1218
- <div class="foo toclevel4"><a href="#_how_it_works">11.2.1. How it works</a></div>
1219
- <div class="foo toclevel4"><a href="#_summary_of_benefits">11.2.2. Summary of benefits</a></div>
1220
- <div class="foo toclevel3"><a href="#_smart_spawning_gotcha_1_unintentional_file_descriptor_sharing">11.3. Smart spawning gotcha #1: unintentional file descriptor sharing</a></div>
1221
- <div class="foo toclevel4"><a href="#_example_1_memcached_connection_sharing_harmful">11.3.1. Example 1: Memcached connection sharing (harmful)</a></div>
1222
- <div class="foo toclevel4"><a href="#_example_2_log_file_sharing_not_harmful">11.3.2. Example 2: Log file sharing (not harmful)</a></div>
1223
- <div class="foo toclevel3"><a href="#_smart_spawning_gotcha_2_the_need_to_revive_threads">11.4. Smart spawning gotcha #2: the need to revive threads</a></div>
1224
- <div class="foo toclevel3"><a href="#_smart_spawning_gotcha_3_code_load_order">11.5. Smart spawning gotcha #3: code load order</a></div>
1225
- </div>
1088
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><div id="toctitle">Table of Contents</div>
1089
+ <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
1090
+ </div>
1226
1091
  </div>
1227
1092
  <div id="content">
1228
1093
 
1229
1094
  <div class="sect1">
1230
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_support_information"></span><h2 data-comment-topic="support-information-nl5gdn" data-anchor="_support_information">1. Support information</h2>
1095
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h2 id="_support_information" data-comment-topic="support-information-nl5gdn">1. Support information</h2>
1231
1096
  <div class="sectionbody">
1232
1097
  <div class="sect2">
1233
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_supported_operating_systems"></span><h3 data-comment-topic="supported-operating-systems-a5n2x4" data-anchor="_supported_operating_systems">1.1. Supported operating systems</h3>
1098
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_supported_operating_systems" data-comment-topic="supported-operating-systems-a5n2x4">1.1. Supported operating systems</h3>
1234
1099
  <div class="paragraph"><p>Phusion Passenger works on any POSIX-compliant operating system. In other
1235
1100
  words: practically any operating system on earth, except Microsoft Windows.</p></div>
1236
1101
  <div class="paragraph"><p>Phusion Passenger is confirmed on a large number of operating systems and Linux
1237
1102
  distributions, including, but not limited to, Ubuntu, Debian, CentOS/Fedora/RHEL,
1238
- Gentoo, Mac OS X, FreeBSD and Solaris. Both 32-bit and 64-bit platforms are supported.
1239
- Please
1103
+ Gentoo, Mac OS X, FreeBSD and Solaris. Both 32-bit and 64-bit platforms are supported.</p></div>
1104
+ <div class="paragraph"><p>Please
1240
1105
  <a href="http://code.google.com/p/phusion-passenger/issues/list">report a bug</a>
1241
1106
  or
1242
1107
  <a href="http://groups.google.com/group/phusion-passenger">join our discussion forum</a>
1243
1108
  if it doesn’t work on your POSIX-compliant operating system.</p></div>
1244
1109
  </div>
1245
1110
  <div class="sect2">
1246
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_where_to_get_support"></span><h3 data-comment-topic="where-to-get-support-2s9na5" data-anchor="_where_to_get_support">1.2. Where to get support</h3>
1247
- <div class="ulist"><ul>
1111
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_where_to_get_support" data-comment-topic="where-to-get-support-2s9na5">1.2. Where to get support</h3>
1112
+ <div class="ulist"><ul>
1248
1113
  <li>
1249
1114
  <p>
1250
1115
  <a href="http://code.google.com/p/phusion-passenger/issues/list">Issue tracker</a> - report
@@ -1257,20 +1122,26 @@ if it doesn’t work on your POSIX-compliant operating system.</p></div>
1257
1122
  message here if you’re experiencing problems.
1258
1123
  </p>
1259
1124
  </li>
1125
+ <li>
1126
+ <p>
1127
+ <a href="https://www.phusionpassenger.com/commercial_support">Commercial support contracts</a> are also available.
1128
+ </p>
1129
+ </li>
1260
1130
  </ul></div>
1131
+ <div class="paragraph"><p>Please consult <a href="https://www.phusionpassenger.com/support">the Phusion Passenger website</a> for a full list of support resources.</p></div>
1261
1132
  </div>
1262
1133
  </div>
1263
1134
  </div>
1264
1135
  <div class="sect1">
1265
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_installing_phusion_passenger"></span><h2 data-comment-topic="installing-phusion-passenger-hn03ac" data-anchor="_installing_phusion_passenger">2. Installing Phusion Passenger</h2>
1136
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h2 id="_installing_phusion_passenger" data-comment-topic="installing-phusion-passenger-hn03ac">2. Installing Phusion Passenger</h2>
1266
1137
  <div class="sectionbody">
1267
1138
  <div class="sect2">
1268
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_overview"></span><h3 data-comment-topic="overview-kvhzi4" data-anchor="_overview">2.1. Overview</h3>
1139
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_overview" data-comment-topic="overview-kvhzi4">2.1. Overview</h3>
1269
1140
  <div class="paragraph"><p>As you might already know, Nginx does not support loadable modules, in contrast
1270
1141
  to most other web servers (e.g. Apache). Therefore, to install Phusion Passenger
1271
1142
  for Nginx, one must recompile and reinstall Nginx with Phusion Passenger support.
1272
1143
  There are two ways to do this:</p></div>
1273
- <div class="olist arabic"><ol class="arabic">
1144
+ <div class="olist arabic"><ol class="arabic">
1274
1145
  <li>
1275
1146
  <p>
1276
1147
  By running the Phusion Passenger installer for Nginx. This installer will
@@ -1290,18 +1161,18 @@ By manually configuring and compiling Nginx with Phusion Passenger support,
1290
1161
  </li>
1291
1162
  </ol></div>
1292
1163
  <div class="admonitionblock">
1293
- <table><tr>
1164
+ <table><tr>
1294
1165
  <td class="icon">
1295
- <img src="./images/icons/tip.png" alt="Tip">
1166
+ <img src="./images/icons/tip.png" alt="Tip">
1296
1167
  </td>
1297
1168
  <td class="content">You might have to run the installation commands in the following sections
1298
1169
  as <em>root</em>. If the installer fails because of permission errors, it will tell
1299
1170
  you.</td>
1300
- </tr></table>
1171
+ </tr></table>
1301
1172
  </div>
1302
1173
  </div>
1303
1174
  <div class="sect2">
1304
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="specifying_ruby_installation"></span><h3 data-comment-topic="specifying-the-correct-ruby-installation-jvqdv6" data-anchor="specifying_ruby_installation">2.2. Specifying the correct Ruby installation</h3>
1175
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="specifying_ruby_installation" data-comment-topic="specifying-the-correct-ruby-installation-jvqdv6">2.2. Specifying the correct Ruby installation</h3>
1305
1176
  <div class="paragraph"><p>If your system has multiple Ruby installations — which is likely the case on
1306
1177
  MacOS X, or if you’ve also installed
1307
1178
  <a href="http://www.rubyenterpriseedition.com">Ruby Enterprise Edition</a> — then you
@@ -1312,7 +1183,7 @@ Passenger will automatically detect it.</p></div>
1312
1183
  <div class="paragraph"><p>To specify a Ruby installation, prepend your Ruby installation’s <span class="monospaced">bin</span>
1313
1184
  directory to the <span class="monospaced">PATH</span> environment variable. For example, if you have the
1314
1185
  following Ruby installations:</p></div>
1315
- <div class="ulist"><ul>
1186
+ <div class="ulist"><ul>
1316
1187
  <li>
1317
1188
  <p>
1318
1189
  /usr/bin/ruby
@@ -1332,9 +1203,9 @@ following Ruby installations:</p></div>
1332
1203
  </div>
1333
1204
  </div>
1334
1205
  <div class="sect2">
1335
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_installing_phusion_passenger_for_nginx_through_the_installer"></span><h3 data-comment-topic="installing-phusion-passenger-for-nginx-through-the-installer-1lqxes1" data-anchor="_installing_phusion_passenger_for_nginx_through_the_installer">2.3. Installing Phusion Passenger for Nginx through the installer</h3>
1206
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_installing_phusion_passenger_for_nginx_through_the_installer" data-comment-topic="installing-phusion-passenger-for-nginx-through-the-installer-1lqxes1">2.3. Installing Phusion Passenger for Nginx through the installer</h3>
1336
1207
  <div class="sect3">
1337
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_obtaining_the_phusion_passenger_files_and_running_the_installer"></span><h4 data-comment-topic="obtaining-the-phusion-passenger-files-and-running-the-installer-6l6ula" data-anchor="_obtaining_the_phusion_passenger_files_and_running_the_installer">2.3.1. Obtaining the Phusion Passenger files and running the installer</h4>
1208
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_obtaining_the_phusion_passenger_files_and_running_the_installer" data-comment-topic="obtaining-the-phusion-passenger-files-and-running-the-installer-6l6ula">2.3.1. Obtaining the Phusion Passenger files and running the installer</h4>
1338
1209
  <div class="paragraph"><p>You must obtain the Phusion Passenger files in order to run the installer.
1339
1210
  This can be done either by installing the Phusion Passenger gem, or by
1340
1211
  downloading the source tarball.</p></div>
@@ -1375,18 +1246,18 @@ tar xzvf ~/YourDownloadsFolder/passenger-x.x.x.tar.gz</pre>
1375
1246
  </div>
1376
1247
  <div class="paragraph"><p>Please follow the instructions given by the installer.</p></div>
1377
1248
  <div class="admonitionblock">
1378
- <table><tr>
1249
+ <table><tr>
1379
1250
  <td class="icon">
1380
- <img src="./images/icons/important.png" alt="Important">
1251
+ <img src="./images/icons/important.png" alt="Important">
1381
1252
  </td>
1382
1253
  <td class="content">Please do not remove the passenger-x.x.x folder after installation.
1383
1254
  Furthermore, the passenger-x.x.x folder must be accessible by Nginx.</td>
1384
- </tr></table>
1255
+ </tr></table>
1385
1256
  </div>
1386
1257
  </div>
1387
1258
  </div>
1388
1259
  <div class="sect3">
1389
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_non_interactive_automatic_installation"></span><h4 data-comment-topic="non-interactive-automatic-installation-1u97717" data-anchor="_non_interactive_automatic_installation">2.3.2. Non-interactive/automatic installation</h4>
1260
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_non_interactive_automatic_installation" data-comment-topic="non-interactive-automatic-installation-1u97717">2.3.2. Non-interactive/automatic installation</h4>
1390
1261
  <div class="paragraph"><p>By default, the installer is interactive. If you want to automate installation,
1391
1262
  then you can do so by passing various answers to the installer through command
1392
1263
  line options.</p></div>
@@ -1395,7 +1266,7 @@ options.</p></div>
1395
1266
  </div>
1396
1267
  </div>
1397
1268
  <div class="sect2">
1398
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_installing_phusion_passenger_for_nginx_manually"></span><h3 data-comment-topic="installing-phusion-passenger-for-nginx-manually-1qg1e2x" data-anchor="_installing_phusion_passenger_for_nginx_manually">2.4. Installing Phusion Passenger for Nginx manually</h3>
1269
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_installing_phusion_passenger_for_nginx_manually" data-comment-topic="installing-phusion-passenger-for-nginx-manually-1qg1e2x">2.4. Installing Phusion Passenger for Nginx manually</h3>
1399
1270
  <div class="paragraph"><p>You can also install Phusion Passenger the way you install any other Nginx module.
1400
1271
  To do this, run Nginx’s configure script with <span class="monospaced">--add-module=/path-to-passenger-root/ext/nginx</span>.</p></div>
1401
1272
  <div class="paragraph"><p>If you installed Phusion Passenger via the gem, then <em>path-to-passenger-root</em>
@@ -1421,7 +1292,7 @@ line into your Nginx configuration file:</p></div>
1421
1292
  <div class="paragraph"><p>After having done so, restart Nginx.</p></div>
1422
1293
  </div>
1423
1294
  <div class="sect2">
1424
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_upgrading_or_downgrading_phusion_passenger_or_nginx_itself"></span><h3 data-comment-topic="upgrading-or-downgrading-phusion-passenger-or-nginx-itself-8dulxz" data-anchor="_upgrading_or_downgrading_phusion_passenger_or_nginx_itself">2.5. Upgrading or downgrading Phusion Passenger or Nginx itself</h3>
1295
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_upgrading_or_downgrading_phusion_passenger_or_nginx_itself" data-comment-topic="upgrading-or-downgrading-phusion-passenger-or-nginx-itself-8dulxz">2.5. Upgrading or downgrading Phusion Passenger or Nginx itself</h3>
1425
1296
  <div class="paragraph"><p>Whether you’re upgrading/downgrading Phusion Passenger or Nginx itself (or perhaps both),
1426
1297
  Nginx will have to be recompiled and reinstalled. The procedure is exactly the same as
1427
1298
  a normal installation so just follow the instructions in section 2.3 or 2.4.</p></div>
@@ -1441,7 +1312,7 @@ removed, otherwise Phusion Passenger may malfunction.</p></div>
1441
1312
  <div class="paragraph"><p>When you’re done, restart Nginx.</p></div>
1442
1313
  </div>
1443
1314
  <div class="sect2">
1444
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_unloading_disabling_phusion_passenger_from_nginx_without_uninstalling_it"></span><h3 data-comment-topic="unloading-disabling-phusion-passenger-from-nginx-without-uninstalling-it-v447e0" data-anchor="_unloading_disabling_phusion_passenger_from_nginx_without_uninstalling_it">2.6. Unloading (disabling) Phusion Passenger from Nginx without uninstalling it</h3>
1315
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_unloading_disabling_phusion_passenger_from_nginx_without_uninstalling_it" data-comment-topic="unloading-disabling-phusion-passenger-from-nginx-without-uninstalling-it-v447e0">2.6. Unloading (disabling) Phusion Passenger from Nginx without uninstalling it</h3>
1445
1316
  <div class="paragraph"><p>You can temporarily unload (disable) Phusion Passenger from Nginx, without
1446
1317
  uninstalling the Phusion Passenger files, so that Nginx behaves as if Phusion
1447
1318
  Passenger was never installed in the first place. This might be useful to you if,
@@ -1469,7 +1340,6 @@ http {
1469
1340
  listen 80;
1470
1341
  root /webapps/foo/public;
1471
1342
  passenger_enabled on;
1472
- passenger_use_global_queue on;
1473
1343
  }
1474
1344
  }</pre>
1475
1345
  </div>
@@ -1499,11 +1369,11 @@ http {
1499
1369
  <div class="paragraph"><p>After you’ve done this, save the file and restart Nginx.</p></div>
1500
1370
  </div>
1501
1371
  <div class="sect2">
1502
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_uninstalling_phusion_passenger"></span><h3 data-comment-topic="uninstalling-phusion-passenger-wuycvb" data-anchor="_uninstalling_phusion_passenger">2.7. Uninstalling Phusion Passenger</h3>
1372
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_uninstalling_phusion_passenger" data-comment-topic="uninstalling-phusion-passenger-wuycvb">2.7. Uninstalling Phusion Passenger</h3>
1503
1373
  <div class="paragraph"><p>To uninstall Phusion Passenger, please first remove all Phusion Passenger
1504
1374
  configuration directives from your Nginx configuration file(s). After you’ve
1505
1375
  done this, you need to remove the Phusion Passenger files.</p></div>
1506
- <div class="ulist"><ul>
1376
+ <div class="ulist"><ul>
1507
1377
  <li>
1508
1378
  <p>
1509
1379
  If you installed Phusion Passenger via a gem, then type <span class="monospaced">gem uninstall passenger</span>.
@@ -1525,7 +1395,7 @@ Nginx binary.</p></div>
1525
1395
  </div>
1526
1396
  </div>
1527
1397
  <div class="sect1">
1528
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="deploying_a_ror_app"></span><h2 data-comment-topic="deploying-a-ruby-on-rails-1-x-or-2-x-but-not-rails-3-application-b69gqa" data-anchor="deploying_a_ror_app">3. Deploying a Ruby on Rails 1.x or 2.x (but NOT Rails &gt;= 3) application</h2>
1398
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h2 id="deploying_a_ror_app" data-comment-topic="deploying-a-ruby-on-rails-1-x-or-2-x-but-not-rails-3-application-b69gqa">3. Deploying a Ruby on Rails 1.x or 2.x (but NOT Rails &gt;= 3) application</h2>
1529
1399
  <div class="sectionbody">
1530
1400
  <div class="paragraph"><p>Suppose you have a Ruby on Rails application in <em>/webapps/mycook</em>, and you own
1531
1401
  the domain <em>www.mycook.com</em>. You can either deploy your application to the
@@ -1533,17 +1403,17 @@ virtual host’s root (i.e. the application will be accessible from the root URL
1533
1403
  <em>http://www.mycook.com/</em>), or in a sub URI (i.e. the application will be
1534
1404
  accessible from a sub URL, such as <em>http://www.mycook.com/railsapplication</em>).</p></div>
1535
1405
  <div class="admonitionblock">
1536
- <table><tr>
1406
+ <table><tr>
1537
1407
  <td class="icon">
1538
- <img src="./images/icons/note.png" alt="Note">
1408
+ <img src="./images/icons/note.png" alt="Note">
1539
1409
  </td>
1540
1410
  <td class="content">The default <span class="monospaced">RAILS_ENV</span> environment in which deployed Rails applications
1541
1411
  are run, is “production”. You can change this by changing the
1542
1412
  <a href="#RailsEnv">rails_env</a> configuration option.</td>
1543
- </tr></table>
1413
+ </tr></table>
1544
1414
  </div>
1545
1415
  <div class="sect2">
1546
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_deploying_to_a_virtual_host_8217_s_root"></span><h3 data-comment-topic="deploying-to-a-virtual-host-s-root-1mh24z5" data-anchor="_deploying_to_a_virtual_host_8217_s_root">3.1. Deploying to a virtual host’s root</h3>
1416
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_deploying_to_a_virtual_host_8217_s_root" data-comment-topic="deploying-to-a-virtual-host-s-root-1mh24z5">3.1. Deploying to a virtual host’s root</h3>
1547
1417
  <div class="paragraph"><p>Add a <em>server</em> virtual host entry to your Nginx configuration file. The virtual
1548
1418
  host’s root must point to your Ruby on Rails application’s <em>public</em> folder.</p></div>
1549
1419
  <div class="paragraph"><p>Inside the <em>server</em> block, set <em>passenger_enabled on</em>.</p></div>
@@ -1567,7 +1437,7 @@ host’s root must point to your Ruby on Rails application’s <em>public</em> f
1567
1437
  <div class="paragraph"><p>Then restart Nginx. The application has now been deployed.</p></div>
1568
1438
  </div>
1569
1439
  <div class="sect2">
1570
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="deploying_rails_to_sub_uri"></span><h3 data-comment-topic="deploying-to-a-sub-uri-1il2qj7" data-anchor="deploying_rails_to_sub_uri">3.2. Deploying to a sub URI</h3>
1440
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="deploying_rails_to_sub_uri" data-comment-topic="deploying-to-a-sub-uri-1il2qj7">3.2. Deploying to a sub URI</h3>
1571
1441
  <div class="paragraph"><p>Suppose that you already have a <em>server</em> virtual host entry:</p></div>
1572
1442
  <div class="listingblock">
1573
1443
  <div class="content monospaced">
@@ -1614,9 +1484,9 @@ option to the <em>server</em> block:</p></div>
1614
1484
  </div>
1615
1485
  <div class="paragraph"><p>Then restart Nginx. The application has now been deployed.</p></div>
1616
1486
  <div class="admonitionblock">
1617
- <table><tr>
1487
+ <table><tr>
1618
1488
  <td class="icon">
1619
- <img src="./images/icons/tip.png" alt="Tip">
1489
+ <img src="./images/icons/tip.png" alt="Tip">
1620
1490
  </td>
1621
1491
  <td class="content">
1622
1492
  <div class="paragraph"><p>You can deploy multiple Rails applications under a virtual host, by specifying
@@ -1632,15 +1502,15 @@ option to the <em>server</em> block:</p></div>
1632
1502
  </div>
1633
1503
  </div>
1634
1504
  </td>
1635
- </tr></table>
1505
+ </tr></table>
1636
1506
  </div>
1637
1507
  </div>
1638
1508
  <div class="sect2">
1639
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_redeploying_restarting_the_ruby_on_rails_application"></span><h3 data-comment-topic="redeploying-restarting-the-ruby-on-rails-application--1eso761" data-anchor="_redeploying_restarting_the_ruby_on_rails_application">3.3. Redeploying (restarting the Ruby on Rails application)</h3>
1509
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_redeploying_restarting_the_ruby_on_rails_application" data-comment-topic="redeploying-restarting-the-ruby-on-rails-application--1eso761">3.3. Redeploying (restarting the Ruby on Rails application)</h3>
1640
1510
  <div class="paragraph"><p>Deploying a new version of a Ruby on Rails application is as simple as
1641
1511
  re-uploading the application files, and restarting the application.</p></div>
1642
1512
  <div class="paragraph"><p>There are two ways to restart the application:</p></div>
1643
- <div class="olist arabic"><ol class="arabic">
1513
+ <div class="olist arabic"><ol class="arabic">
1644
1514
  <li>
1645
1515
  <p>
1646
1516
  By restarting Nginx.
@@ -1667,27 +1537,27 @@ of this file has changed in order to determine whether the application should
1667
1537
  be restarted.</p></div>
1668
1538
  </div>
1669
1539
  <div class="sect2">
1670
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_migrations"></span><h3 data-comment-topic="migrations-9yyb8w" data-anchor="_migrations">3.4. Migrations</h3>
1540
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_migrations" data-comment-topic="migrations-9yyb8w">3.4. Migrations</h3>
1671
1541
  <div class="paragraph"><p>Phusion Passenger is not related to Ruby on Rails migrations in any way. To
1672
1542
  run migrations on your deployment server, please login to your deployment
1673
1543
  server (e.g. with <em>ssh</em>) and type <span class="monospaced">rake db:migrate RAILS_ENV=production</span> in
1674
1544
  a shell console, just like one would normally run migrations.</p></div>
1675
1545
  </div>
1676
1546
  <div class="sect2">
1677
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_capistrano_integration"></span><h3 data-comment-topic="capistrano-integration-1ktunm6" data-anchor="_capistrano_integration">3.5. Capistrano integration</h3>
1547
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_capistrano_integration" data-comment-topic="capistrano-integration-1ktunm6">3.5. Capistrano integration</h3>
1678
1548
  <div class="paragraph"><p>See <a href="#capistrano">Capistrano recipe</a>.</p></div>
1679
1549
  </div>
1680
1550
  </div>
1681
1551
  </div>
1682
1552
  <div class="sect1">
1683
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="deploying_a_rack_app"></span><h2 data-comment-topic="deploying-a-rack-based-ruby-application-including-rails-3--12benx3" data-anchor="deploying_a_rack_app">4. Deploying a Rack-based Ruby application (including Rails &gt;= 3)</h2>
1553
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h2 id="deploying_a_rack_app" data-comment-topic="deploying-a-rack-based-ruby-application-including-rails-3--12benx3">4. Deploying a Rack-based Ruby application (including Rails &gt;= 3)</h2>
1684
1554
  <div class="sectionbody">
1685
1555
  <div class="paragraph"><p>Phusion Passenger supports arbitrary Ruby web applications that follow the
1686
1556
  <a href="http://rack.rubyforge.org/">Rack</a> interface.</p></div>
1687
1557
  <div class="paragraph"><p>Phusion Passenger assumes that Rack application directories have a certain layout.
1688
1558
  Suppose that you have a Rack application in <em>/webapps/rackapp</em>. Then that
1689
1559
  folder must contain at least three entries:</p></div>
1690
- <div class="ulist"><ul>
1560
+ <div class="ulist"><ul>
1691
1561
  <li>
1692
1562
  <p>
1693
1563
  <em>config.ru</em>, a Rackup file for starting the Rack application. This file must contain
@@ -1723,17 +1593,17 @@ to the virtual host’s root (i.e. the application will be accessible from the r
1723
1593
  <em>http://www.rackapp.com/</em>), or in a sub URI (i.e. the application will be
1724
1594
  accessible from a sub URL, such as <em>http://www.rackapp.com/rackapp</em>).</p></div>
1725
1595
  <div class="admonitionblock">
1726
- <table><tr>
1596
+ <table><tr>
1727
1597
  <td class="icon">
1728
- <img src="./images/icons/note.png" alt="Note">
1598
+ <img src="./images/icons/note.png" alt="Note">
1729
1599
  </td>
1730
1600
  <td class="content">The default <span class="monospaced">RACK_ENV</span> environment in which deployed Rack applications
1731
1601
  are run, is “production”. You can change this by changing the
1732
1602
  <a href="#RackEnv">rack_env</a> configuration option.</td>
1733
- </tr></table>
1603
+ </tr></table>
1734
1604
  </div>
1735
1605
  <div class="sect2">
1736
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_tutorial_example_writing_and_deploying_a_hello_world_rack_application"></span><h3 data-comment-topic="tutorial-example-writing-and-deploying-a-hello-world-rack-application-1wstx99" data-anchor="_tutorial_example_writing_and_deploying_a_hello_world_rack_application">4.1. Tutorial/example: writing and deploying a Hello World Rack application</h3>
1606
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_tutorial_example_writing_and_deploying_a_hello_world_rack_application" data-comment-topic="tutorial-example-writing-and-deploying-a-hello-world-rack-application-1wstx99">4.1. Tutorial/example: writing and deploying a Hello World Rack application</h3>
1737
1607
  <div class="paragraph"><p>First we create a Phusion Passenger-compliant Rack directory structure:</p></div>
1738
1608
  <div class="listingblock">
1739
1609
  <div class="content monospaced">
@@ -1775,7 +1645,7 @@ the Nginx configuration file:</p></div>
1775
1645
  under the URL <em>http://www.rackexample.com/</em>.</p></div>
1776
1646
  </div>
1777
1647
  <div class="sect2">
1778
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_deploying_to_a_virtual_host_8217_s_root_2"></span><h3 data-comment-topic="deploying-to-a-virtual-host-s-root-f02erj" data-anchor="_deploying_to_a_virtual_host_8217_s_root_2">4.2. Deploying to a virtual host’s root</h3>
1648
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_deploying_to_a_virtual_host_8217_s_root_2" data-comment-topic="deploying-to-a-virtual-host-s-root-f02erj">4.2. Deploying to a virtual host’s root</h3>
1779
1649
  <div class="paragraph"><p>Add a <em>server</em> virtual host entry to your Nginx configuration file. The virtual host’s
1780
1650
  root must point to your Rack application’s <em>public</em> folder. You must also set
1781
1651
  <em>passenger_enabled on</em> in the <em>server</em> block.</p></div>
@@ -1797,7 +1667,7 @@ root must point to your Rack application’s <em>public</em> folder. You must al
1797
1667
  <div class="paragraph"><p>Then restart Nginx. The application has now been deployed.</p></div>
1798
1668
  </div>
1799
1669
  <div class="sect2">
1800
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="deploying_rack_to_sub_uri"></span><h3 data-comment-topic="deploying-to-a-sub-uri-37q0ou" data-anchor="deploying_rack_to_sub_uri">4.3. Deploying to a sub URI</h3>
1670
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="deploying_rack_to_sub_uri" data-comment-topic="deploying-to-a-sub-uri-37q0ou">4.3. Deploying to a sub URI</h3>
1801
1671
  <div class="paragraph"><p>Suppose that you already have a virtual host:</p></div>
1802
1672
  <div class="listingblock">
1803
1673
  <div class="content monospaced">
@@ -1845,9 +1715,9 @@ option to the <em>server</em> block:</p></div>
1845
1715
  </div>
1846
1716
  <div class="paragraph"><p>Then restart Nginx. The application has now been deployed.</p></div>
1847
1717
  <div class="admonitionblock">
1848
- <table><tr>
1718
+ <table><tr>
1849
1719
  <td class="icon">
1850
- <img src="./images/icons/tip.png" alt="Tip">
1720
+ <img src="./images/icons/tip.png" alt="Tip">
1851
1721
  </td>
1852
1722
  <td class="content">
1853
1723
  <div class="paragraph"><p>You can deploy multiple Rack applications under a virtual host, by specifying
@@ -1863,15 +1733,15 @@ option to the <em>server</em> block:</p></div>
1863
1733
  </div>
1864
1734
  </div>
1865
1735
  </td>
1866
- </tr></table>
1736
+ </tr></table>
1867
1737
  </div>
1868
1738
  </div>
1869
1739
  <div class="sect2">
1870
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_redeploying_restarting_the_rack_application"></span><h3 data-comment-topic="redeploying-restarting-the-rack-application--xnbfam" data-anchor="_redeploying_restarting_the_rack_application">4.4. Redeploying (restarting the Rack application)</h3>
1740
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_redeploying_restarting_the_rack_application" data-comment-topic="redeploying-restarting-the-rack-application--xnbfam">4.4. Redeploying (restarting the Rack application)</h3>
1871
1741
  <div class="paragraph"><p>Deploying a new version of a Rack application is as simple as
1872
1742
  re-uploading the application files, and restarting the application.</p></div>
1873
1743
  <div class="paragraph"><p>There are two ways to restart the application:</p></div>
1874
- <div class="olist arabic"><ol class="arabic">
1744
+ <div class="olist arabic"><ol class="arabic">
1875
1745
  <li>
1876
1746
  <p>
1877
1747
  By restarting Nginx.
@@ -1894,10 +1764,10 @@ command line:</p></div>
1894
1764
  </div>
1895
1765
  </div>
1896
1766
  <div class="sect2">
1897
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_rackup_specifications_for_various_web_frameworks"></span><h3 data-comment-topic="rackup-specifications-for-various-web-frameworks-1a2cs41" data-anchor="_rackup_specifications_for_various_web_frameworks">4.5. Rackup specifications for various web frameworks</h3>
1767
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_rackup_specifications_for_various_web_frameworks" data-comment-topic="rackup-specifications-for-various-web-frameworks-1a2cs41">4.5. Rackup specifications for various web frameworks</h3>
1898
1768
  <div class="paragraph"><p>This subsection shows example <em>config.ru</em> files for various web frameworks.</p></div>
1899
1769
  <div class="sect3">
1900
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_camping"></span><h4 data-comment-topic="camping-16vz2yb" data-anchor="_camping">4.5.1. Camping</h4>
1770
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_camping" data-comment-topic="camping-16vz2yb">4.5.1. Camping</h4>
1901
1771
  <div class="listingblock">
1902
1772
  <div class="content monospaced">
1903
1773
  <pre>require 'rubygems'
@@ -1916,7 +1786,7 @@ run Rack::Adapter::Camping.new(Blog)</pre>
1916
1786
  <div class="paragraph"><p>For Camping versions 2.0 and up, using <span class="monospaced">run Blog</span> as the final line will do.</p></div>
1917
1787
  </div>
1918
1788
  <div class="sect3">
1919
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_halcyon"></span><h4 data-comment-topic="halcyon-1benlfl" data-anchor="_halcyon">4.5.2. Halcyon</h4>
1789
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_halcyon" data-comment-topic="halcyon-1benlfl">4.5.2. Halcyon</h4>
1920
1790
  <div class="listingblock">
1921
1791
  <div class="content monospaced">
1922
1792
  <pre>require 'rubygems'
@@ -1928,7 +1798,7 @@ run Halcyon::Runner.new</pre>
1928
1798
  </div>
1929
1799
  </div>
1930
1800
  <div class="sect3">
1931
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_mack"></span><h4 data-comment-topic="mack-1ezijq6" data-anchor="_mack">4.5.3. Mack</h4>
1801
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_mack" data-comment-topic="mack-1ezijq6">4.5.3. Mack</h4>
1932
1802
  <div class="listingblock">
1933
1803
  <div class="content monospaced">
1934
1804
  <pre>ENV["MACK_ENV"] = ENV["RACK_ENV"]
@@ -1940,7 +1810,7 @@ run Mack::Utils::Server.build_app</pre>
1940
1810
  </div>
1941
1811
  </div>
1942
1812
  <div class="sect3">
1943
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_merb"></span><h4 data-comment-topic="merb-ddsh55" data-anchor="_merb">4.5.4. Merb</h4>
1813
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_merb" data-comment-topic="merb-ddsh55">4.5.4. Merb</h4>
1944
1814
  <div class="listingblock">
1945
1815
  <div class="content monospaced">
1946
1816
  <pre>require 'rubygems'
@@ -1959,7 +1829,7 @@ run Merb::Rack::Application.new</pre>
1959
1829
  </div>
1960
1830
  </div>
1961
1831
  <div class="sect3">
1962
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_ramaze"></span><h4 data-comment-topic="ramaze-1p2zod" data-anchor="_ramaze">4.5.5. Ramaze</h4>
1832
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_ramaze" data-comment-topic="ramaze-1p2zod">4.5.5. Ramaze</h4>
1963
1833
  <div class="listingblock">
1964
1834
  <div class="content monospaced">
1965
1835
  <pre>require "rubygems"
@@ -1972,7 +1842,7 @@ run Ramaze::Adapter::Base</pre>
1972
1842
  </div>
1973
1843
  </div>
1974
1844
  <div class="sect3">
1975
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_sinatra"></span><h4 data-comment-topic="sinatra-a7u9ag" data-anchor="_sinatra">4.5.6. Sinatra</h4>
1845
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_sinatra" data-comment-topic="sinatra-a7u9ag">4.5.6. Sinatra</h4>
1976
1846
  <div class="listingblock">
1977
1847
  <div class="content monospaced">
1978
1848
  <pre>require 'rubygems'
@@ -1987,14 +1857,139 @@ run Sinatra::Application</pre>
1987
1857
  </div>
1988
1858
  </div>
1989
1859
  <div class="sect1">
1990
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_configuring_phusion_passenger"></span><h2 data-comment-topic="configuring-phusion-passenger-1g1svey" data-anchor="_configuring_phusion_passenger">5. Configuring Phusion Passenger</h2>
1860
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h2 id="_deploying_a_wsgi_python_application" data-comment-topic="deploying-a-wsgi-python-application-1or2efo">5. Deploying a WSGI (Python) application</h2>
1861
+ <div class="sectionbody">
1862
+ <div class="paragraph"><p>Phusion Passenger supports all WSGI-compliant Python web applications. Suppose that you have a WSGI application in <em>/webapps/wsgiapp</em>. Then that folder must contain at least three entries:</p></div>
1863
+ <div class="ulist"><ul>
1864
+ <li>
1865
+ <p>
1866
+ <em>passenger_wsgi.py</em>, which Phusion Passenger will use as the main entry point for your application. This file must export a WSGI object called <span class="monospaced">application</span>.
1867
+ </p>
1868
+ </li>
1869
+ <li>
1870
+ <p>
1871
+ <em>public/</em>, a folder containing public static web assets, like images and stylesheets.
1872
+ </p>
1873
+ </li>
1874
+ <li>
1875
+ <p>
1876
+ <em>tmp/</em>, used for <em>restart.txt</em> (our application restart mechanism). This will be explained in a following subsection.
1877
+ </p>
1878
+ </li>
1879
+ </ul></div>
1880
+ <div class="paragraph"><p>So <em>/webapps/wsgiapp</em> must, at minimum, look like this:</p></div>
1881
+ <div class="listingblock">
1882
+ <div class="content monospaced">
1883
+ <pre>/webapps/wsgiapp
1884
+ |
1885
+ +-- config.ru
1886
+ |
1887
+ +-- public/
1888
+ |
1889
+ +-- tmp/</pre>
1890
+ </div>
1891
+ </div>
1892
+ <div class="sect2">
1893
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_tutorial_example_writing_and_deploying_a_hello_world_wsgi_application" data-comment-topic="tutorial-example-writing-and-deploying-a-hello-world-wsgi-application-k5ron2">5.1. Tutorial/example: writing and deploying a Hello World WSGI application</h3>
1894
+ <div class="paragraph"><p>First we create a Phusion Passenger-compliant WSGI directory structure:</p></div>
1895
+ <div class="listingblock">
1896
+ <div class="content monospaced">
1897
+ <pre>$ mkdir /webapps/wsgi_example
1898
+ $ mkdir /webapps/wsgi_example/public
1899
+ $ mkdir /webapps/wsgi_example/tmp</pre>
1900
+ </div>
1901
+ </div>
1902
+ <div class="paragraph"><p>Next, we write a minimal "hello world" WSGI application:</p></div>
1903
+ <div class="listingblock">
1904
+ <div class="content monospaced">
1905
+ <pre>$ cd /webapps/wsgi_example
1906
+ $ some_awesome_editor passenger_wsgi.py
1907
+ ...type in some source code...
1908
+ $ cat passenger_wsgi.py
1909
+ def application(environ, start_response):
1910
+ start_response(200, [('Content-Type', 'text/plain')])
1911
+ return ["hello world!\n"]</pre>
1912
+ </div>
1913
+ </div>
1914
+ <div class="paragraph"><p>Finally, we deploy it by adding the following configuration options to
1915
+ the Nginx configuration file:</p></div>
1916
+ <div class="listingblock">
1917
+ <div class="content monospaced">
1918
+ <pre>http {
1919
+ ...
1920
+ server {
1921
+ listen 80;
1922
+ server_name www.wsgiexample.com;
1923
+ root /webapps/wsgi_example/public;
1924
+ passenger_enabled on;
1925
+ }
1926
+ ...
1927
+ }</pre>
1928
+ </div>
1929
+ </div>
1930
+ <div class="paragraph"><p>And we’re done! After an Nginx restart, the above WSGI application will be available
1931
+ under the URL <em>http://www.wsgiexample.com/</em>.</p></div>
1932
+ </div>
1933
+ <div class="sect2">
1934
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_deploying_to_a_virtual_host_8217_s_root_3" data-comment-topic="deploying-to-a-virtual-host-s-root-1chcpbj">5.2. Deploying to a virtual host’s root</h3>
1935
+ <div class="paragraph"><p>Add a <em>server</em> virtual host entry to your Nginx configuration file. The virtual host’s
1936
+ root must point to your WSGI application’s <em>public</em> folder. You must also set
1937
+ <em>passenger_enabled on</em> in the <em>server</em> block.</p></div>
1938
+ <div class="paragraph"><p>For example:</p></div>
1939
+ <div class="listingblock">
1940
+ <div class="content monospaced">
1941
+ <pre>http {
1942
+ ...
1943
+ server {
1944
+ listen 80;
1945
+ server_name www.wsgiapp.com;
1946
+ root /webapps/wsgiapp/public;
1947
+ passenger_enabled on;
1948
+ }
1949
+ ...
1950
+ }</pre>
1951
+ </div>
1952
+ </div>
1953
+ <div class="paragraph"><p>Then restart Nginx. The application has now been deployed.</p></div>
1954
+ </div>
1955
+ <div class="sect2">
1956
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_redeploying_restarting_the_wsgi_application" data-comment-topic="redeploying-restarting-the-wsgi-application--10zdh2k">5.3. Redeploying (restarting the WSGI application)</h3>
1957
+ <div class="paragraph"><p>Deploying a new version of a WSGI application is as simple as
1958
+ re-uploading the application files, and restarting the application.</p></div>
1959
+ <div class="paragraph"><p>There are two ways to restart the application:</p></div>
1960
+ <div class="olist arabic"><ol class="arabic">
1961
+ <li>
1962
+ <p>
1963
+ By restarting Nginx.
1964
+ </p>
1965
+ </li>
1966
+ <li>
1967
+ <p>
1968
+ By creating or modifying the file <em>tmp/restart.txt</em> in the WSGI
1969
+ application’s <a href="#application_root">root folder</a>. Phusion Passenger will
1970
+ automatically restart the application.
1971
+ </p>
1972
+ </li>
1973
+ </ol></div>
1974
+ <div class="paragraph"><p>For example, to restart our example application, we type this in the
1975
+ command line:</p></div>
1976
+ <div class="listingblock">
1977
+ <div class="content monospaced">
1978
+ <pre>touch /webapps/wsgiapp/tmp/restart.txt</pre>
1979
+ </div>
1980
+ </div>
1981
+ </div>
1982
+ </div>
1983
+ </div>
1984
+ <div class="sect1">
1985
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h2 id="_configuring_phusion_passenger" data-comment-topic="configuring-phusion-passenger-1g1svey">6. Configuring Phusion Passenger</h2>
1991
1986
  <div class="sectionbody">
1992
1987
  <div class="paragraph"><p>After installation, Phusion Passenger does not need any further configurations.
1993
1988
  Nevertheless, the system administrator may be interested in changing
1994
1989
  Phusion Passenger’s behavior. Phusion Passenger supports the following configuration
1995
1990
  options in the Nginx configuration file:</p></div>
1996
1991
  <div class="sect2">
1997
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_root_lt_directory_gt"></span><h3 data-comment-topic="passenger-root-directory--bqvhhz" data-anchor="_passenger_root_lt_directory_gt">5.1. passenger_root &lt;directory&gt;</h3>
1992
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_passenger_root_lt_directory_gt" data-comment-topic="passenger-root-directory--bqvhhz">6.1. passenger_root &lt;directory&gt;</h3>
1998
1993
  <div class="paragraph"><p>The location to the Phusion Passenger root directory. This configuration option
1999
1994
  is essential to Phusion Passenger, and allows Phusion Passenger to locate its own
2000
1995
  data files. The correct value is given by the installer.</p></div>
@@ -2004,17 +1999,38 @@ this option as well. Please read
2004
1999
  <div class="paragraph"><p>This required option may only occur once, in the <em>http</em> configuration block.</p></div>
2005
2000
  </div>
2006
2001
  <div class="sect2">
2007
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_ruby_lt_filename_gt"></span><h3 data-comment-topic="passenger-ruby-filename--1gnok5k" data-anchor="_passenger_ruby_lt_filename_gt">5.2. passenger_ruby &lt;filename&gt;</h3>
2002
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_passenger_ruby_lt_filename_gt" data-comment-topic="passenger-ruby-filename--1gnok5k">6.2. passenger_ruby &lt;filename&gt;</h3>
2008
2003
  <div class="paragraph"><p>This option allows one to specify the Ruby interpreter to use.</p></div>
2009
- <div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration block.
2010
- The default is <em>ruby</em>.</p></div>
2004
+ <div class="ulist"><ul>
2005
+ <li>
2006
+ <p>
2007
+ In the <em>http</em> configuration block.
2008
+ </p>
2009
+ </li>
2010
+ <li>
2011
+ <p>
2012
+ In a <em>server</em> configuration block.
2013
+ </p>
2014
+ </li>
2015
+ <li>
2016
+ <p>
2017
+ In a <em>location</em> configuration block.
2018
+ </p>
2019
+ </li>
2020
+ <li>
2021
+ <p>
2022
+ In an <em>if</em> configuration scope.
2023
+ </p>
2024
+ </li>
2025
+ </ul></div>
2026
+ <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>ruby</em>, meaning that the Ruby interpreter will be looked up according to the <span class="monospaced">PATH</span> environment variable.</p></div>
2011
2027
  </div>
2012
2028
  <div class="sect2">
2013
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerSpawnMethod"></span><h3 data-comment-topic="passenger-spawn-method-string--1sc6njl" data-anchor="PassengerSpawnMethod">5.3. passenger_spawn_method &lt;string&gt;</h3>
2029
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="PassengerSpawnMethod" data-comment-topic="passenger-spawn-method-string--1sc6njl">6.3. passenger_spawn_method &lt;string&gt;</h3>
2014
2030
  <div class="admonitionblock">
2015
- <table><tr>
2031
+ <table><tr>
2016
2032
  <td class="icon">
2017
- <img src="./images/icons/tip.png" alt="Tip">
2033
+ <img src="./images/icons/tip.png" alt="Tip">
2018
2034
  </td>
2019
2035
  <td class="content">
2020
2036
  <div class="title">"What spawn method should I use?"</div>
@@ -2023,76 +2039,62 @@ understand it, as it’s mostly a technical detail. You can basically follow thi
2023
2039
  <div class="sidebarblock">
2024
2040
  <div class="content">
2025
2041
  <div class="paragraph"><p>If your application works on Mongrel, but not on Phusion Passenger, then set
2026
- <span class="monospaced">passenger_spawn_method</span> to <em>conservative</em>. Otherwise, leave it at <em>smart-lv2</em> (the default).</p></div>
2042
+ <span class="monospaced">passenger_spawn_method</span> to <em>direct</em>. Otherwise, leave it at <em>smart</em> (the default).</p></div>
2027
2043
  </div>
2028
2044
  </div>
2029
- <div class="paragraph"><p>However, we do recommend you to try to understand it. The <em>smart</em> and <em>smart-lv2</em> spawn
2030
- methods bring many benefits.</p></div>
2045
+ <div class="paragraph"><p>However, we do recommend you to try to understand it. The <em>smart</em> spawn
2046
+ method brings many benefits.</p></div>
2031
2047
  </td>
2032
- </tr></table>
2048
+ </tr></table>
2033
2049
  </div>
2034
2050
  <div class="paragraph"><p>Internally, Phusion Passenger spawns multiple Ruby application processes in order to handle
2035
2051
  requests. But there are multiple ways with which processes can be spawned, each having
2036
2052
  its own set of pros and cons. Supported spawn methods are:</p></div>
2037
- <div class="dlist"><dl>
2053
+ <div class="dlist"><dl>
2038
2054
  <dt class="hdlist1">
2039
2055
  <em>smart</em>
2040
2056
  </dt>
2041
2057
  <dd>
2042
2058
  <p>
2043
- When this spawn method is used, Phusion Passenger will attempt to cache any
2044
- framework code (e.g. Ruby on Rails itself) and application code for a limited
2045
- period of time. Please read <a href="#spawning_methods_explained">Spawning methods explained</a>
2046
- for a more detailed explanation of what smart spawning exactly does.
2047
- </p>
2048
- <div class="paragraph"><p><strong>Pros:</strong>
2049
- This can significantly decrease spawn time (by as much as 90%). And, when Ruby Enterprise
2050
- Edition is used, <a href="#reducing_memory_usage">memory usage can be reduced by 33% on average</a>.</p></div>
2051
- <div class="paragraph"><p><strong>Cons:</strong>
2052
- Some applications and libraries are not compatible with smart spawning.
2053
- If that’s the case for your application, then you should use <em>conservative</em> as
2054
- spawning method. Please read <a href="#spawning_methods_explained">Spawning methods explained</a>
2055
- for possible compatibility issues.</p></div>
2056
- </dd>
2057
- <dt class="hdlist1">
2058
- <em>smart-lv2</em>
2059
- </dt>
2060
- <dd>
2061
- <p>
2062
- This spawning method is similar to <em>smart</em> but it skips the framework spawner
2063
- and uses the application spawner directly. This means the framework code is not
2064
- cached between multiple applications, although it is still cached within
2059
+ This spawning method caches code using the app preloader. Framework code is not
2060
+ cached between multiple applications, although it is cached within
2065
2061
  instances of the same application. Please read
2066
2062
  <a href="#spawning_methods_explained">Spawning methods explained</a> for a more detailed
2067
- explanation of what smart-lv2 spawning exactly does.
2063
+ explanation of what smart spawning exactly does.
2068
2064
  </p>
2069
- <div class="paragraph"><p><strong>Pros:</strong> It is compatible with a larger number of applications when compared to
2070
- the <em>smart</em> method, and still performs some caching.</p></div>
2071
- <div class="paragraph"><p><strong>Cons:</strong> It is slower than smart spawning if you have many applications which
2072
- use the same framework version. It is therefore advised that shared hosts use the
2073
- <em>smart</em> method instead.</p></div>
2065
+ <div class="paragraph"><p><strong>Pros:</strong>
2066
+ Smart spawning caches code where possible to speed up the respawn process
2067
+ and is compatible with most applications</p></div>
2068
+ <div class="paragraph"><p><strong>Cons:</strong>
2069
+ It is possible that it may be incompatible with some applications</p></div>
2074
2070
  </dd>
2075
2071
  <dt class="hdlist1">
2076
- <em>conservative</em>
2072
+ <em>direct</em>
2077
2073
  </dt>
2078
2074
  <dd>
2079
2075
  <p>
2080
2076
  This spawning method is similar to the one used in Mongrel Cluster. It does not
2081
2077
  perform any code caching at all. Please read
2082
2078
  <a href="#spawning_methods_explained">Spawning methods explained</a> for a more detailed
2083
- explanation of what conservative spawning exactly does.
2079
+ explanation of what direct spawning exactly does.
2084
2080
  </p>
2085
2081
  <div class="paragraph"><p><strong>Pros:</strong>
2086
- Conservative spawning is guaranteed to be compatible with all applications
2082
+ Direct spawning is guaranteed to be compatible with all applications
2087
2083
  and libraries.</p></div>
2088
2084
  <div class="paragraph"><p><strong>Cons:</strong>
2089
2085
  Much slower than smart spawning. Every spawn action will be equally slow, though no slower than
2090
- the startup time of a single server in Mongrel Cluster. Conservative spawning will also
2086
+ the startup time of a single server in Mongrel Cluster. Direct spawning will also
2091
2087
  render <a href="#reducing_memory_usage">Ruby Enterprise Edition’s memory reduction technology</a> useless.</p></div>
2092
2088
  </dd>
2093
2089
  </dl></div>
2090
+ <div class="sidebarblock">
2091
+ <div class="content">
2092
+ <div class="paragraph"><p>As of Passenger 3.2, <em>conservative</em> spawning was renamed to <em>direct</em> and <em>smart-lv2</em> was renamed
2093
+ to <em>smart</em>. The old <em>smart</em> spawning has been removed in favor of the new version.</p></div>
2094
+ </div>
2095
+ </div>
2094
2096
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
2095
- <div class="ulist"><ul>
2097
+ <div class="ulist"><ul>
2096
2098
  <li>
2097
2099
  <p>
2098
2100
  In the <em>http</em> configuration block.
@@ -2114,10 +2116,10 @@ In an <em>if</em> configuration scope.
2114
2116
  </p>
2115
2117
  </li>
2116
2118
  </ul></div>
2117
- <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>smart-lv2</em>.</p></div>
2119
+ <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>smart</em>.</p></div>
2118
2120
  </div>
2119
2121
  <div class="sect2">
2120
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerRollingRestarts"></span><h3 data-comment-topic="passenger-rolling-restarts" data-anchor="PassengerRollingRestarts">5.4. passenger_rolling_restarts &lt;on|off&gt;</h3>
2122
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="PassengerRollingRestarts" data-comment-topic="passenger-rolling-restarts">6.4. passenger_rolling_restarts &lt;on|off&gt;</h3>
2121
2123
  <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>
2122
2124
  <div class="paragraph"><p>Enables or disables support for rolling restarts. Normally when you
2123
2125
  restart an application (by touching restart.txt), Phusion Passenger would
@@ -2126,7 +2128,7 @@ of a new application process could take a while, and any requests that
2126
2128
  come in during this time will be blocked until this first application
2127
2129
  process has spawned.</p></div>
2128
2130
  <div class="paragraph"><p>But when rolling restarts are enabled, Phusion Passenger Enterprise will:</p></div>
2129
- <div class="olist arabic"><ol class="arabic">
2131
+ <div class="olist arabic"><ol class="arabic">
2130
2132
  <li>
2131
2133
  <p>
2132
2134
  Spawn a new process in the background.
@@ -2145,7 +2147,7 @@ Step 1 and 2 are repeated until all processes have been replaced.
2145
2147
  </ol></div>
2146
2148
  <div class="paragraph"><p>This way, visitors will not experience any delays when you are restarting your application. This allows you to, for example, upgrade your application often without degrading user experience.</p></div>
2147
2149
  <div class="paragraph"><p>Rolling restarts have a few caveat however that you should be aware of:</p></div>
2148
- <div class="ulist"><ul>
2150
+ <div class="ulist"><ul>
2149
2151
  <li>
2150
2152
  <p>
2151
2153
  Upgrading an application sometimes involves upgrading the database schema.
@@ -2165,7 +2167,7 @@ Because there’s no telling which process will serve a request, users may
2165
2167
  </li>
2166
2168
  </ul></div>
2167
2169
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
2168
- <div class="ulist"><ul>
2170
+ <div class="ulist"><ul>
2169
2171
  <li>
2170
2172
  <p>
2171
2173
  In the <em>http</em> configuration block.
@@ -2190,12 +2192,12 @@ In an <em>if</em> configuration scope.
2190
2192
  <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>off</em>.</p></div>
2191
2193
  </div>
2192
2194
  <div class="sect2">
2193
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_resist_deployment_errors_lt_on_off_gt"></span><h3 data-comment-topic="passenger-resist-deployment-errors-on-off--k9yf1" data-anchor="_passenger_resist_deployment_errors_lt_on_off_gt">5.5. passenger_resist_deployment_errors &lt;on|off&gt;</h3>
2195
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_passenger_resist_deployment_errors_lt_on_off_gt" data-comment-topic="passenger-resist-deployment-errors-on-off--k9yf1">6.5. passenger_resist_deployment_errors &lt;on|off&gt;</h3>
2194
2196
  <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>
2195
2197
  <div class="paragraph"><p>Enables or disables resistance against deployment errors.</p></div>
2196
2198
  <div class="paragraph"><p>Suppose you’ve upgraded your application and you’ve issues a command to restart it (by touching restart.txt), but the application code contains an error that prevents Phusion Passenger from successfully spawning a process (e.g. a syntax error). Phusion Passenger would normally display an error message in response to this.</p></div>
2197
2199
  <div class="paragraph"><p>By enabling deployment error resistance, Phusion Passenger Enterprise would instead do this:</p></div>
2198
- <div class="ulist"><ul>
2200
+ <div class="ulist"><ul>
2199
2201
  <li>
2200
2202
  <p>
2201
2203
  It passes the request to one of the existing application processes (that belong to the previous version of the application). The visitor will not see a Phusion Passenger process spawning error message.
@@ -2215,7 +2217,7 @@ It sets an internal flag so that no processes for this application will be spawn
2215
2217
  <div class="paragraph"><p>This way, visitors will suffer minimally from deployment errors. Phusion Passenger will attempt to restart the application again next time restart.txt is touched.</p></div>
2216
2218
  <div class="paragraph"><p>Enabling deployment error resistance only works if <a href="#PassengerRollingRestarts">rolling restart</a> is also enabled.</p></div>
2217
2219
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
2218
- <div class="ulist"><ul>
2220
+ <div class="ulist"><ul>
2219
2221
  <li>
2220
2222
  <p>
2221
2223
  In the <em>http</em> configuration block.
@@ -2240,9 +2242,9 @@ In an <em>if</em> configuration scope.
2240
2242
  <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>off</em>.</p></div>
2241
2243
  </div>
2242
2244
  <div class="sect2">
2243
- <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">5.6. Important deployment options</h3>
2245
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_important_deployment_options" data-comment-topic="important-deployment-options-av567">6.6. Important deployment options</h3>
2244
2246
  <div class="sect3">
2245
- <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">5.6.1. passenger_enabled &lt;on|off&gt;</h4>
2247
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_passenger_enabled_lt_on_off_gt" data-comment-topic="passenger-enabled-on-off--1rpb2t7">6.6.1. passenger_enabled &lt;on|off&gt;</h4>
2246
2248
  <div class="paragraph"><p>This option may be specified in the <em>http</em> configuration block, a
2247
2249
  <em>server</em> configuration block, a <em>location</em> configuration block or
2248
2250
  an <em>if</em> configuration scope, to enable or disable Phusion Passenger
@@ -2254,7 +2256,7 @@ and <a href="#deploying_a_rack_app">Deploying a Rack-based Ruby application</a>
2254
2256
  for examples.</p></div>
2255
2257
  </div>
2256
2258
  <div class="sect3">
2257
- <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">5.6.2. passenger_base_uri &lt;uri&gt;</h4>
2259
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="PassengerBaseURI" data-comment-topic="passenger-base-uri-uri--1xtuo50">6.6.2. passenger_base_uri &lt;uri&gt;</h4>
2258
2260
  <div class="paragraph"><p>Used to specify that the given URI is an distinct application that should
2259
2261
  be served by Phusion Passenger. This option can be used for both Rails and
2260
2262
  Rack applications. See <a href="#deploying_rails_to_sub_uri">Deploying Rails to a sub URI</a>
@@ -2262,7 +2264,7 @@ for an example.</p></div>
2262
2264
  <div class="paragraph"><p>It is allowed to specify this option multiple times. Do this to deploy multiple
2263
2265
  applications in different sub-URIs under the same virtual host.</p></div>
2264
2266
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
2265
- <div class="ulist"><ul>
2267
+ <div class="ulist"><ul>
2266
2268
  <li>
2267
2269
  <p>
2268
2270
  In the <em>http</em> configuration block.
@@ -2287,116 +2289,9 @@ In an <em>if</em> configuration scope.
2287
2289
  </div>
2288
2290
  </div>
2289
2291
  <div class="sect2">
2290
- <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">5.7. Connection handling options</h3>
2292
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_connection_handling_options" data-comment-topic="connection-handling-options-8jgq90">6.7. Connection handling options</h3>
2291
2293
  <div class="sect3">
2292
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerUseGlobalQueue"></span><h4 data-comment-topic="passenger-use-global-queue-on-off--14h9n22" data-anchor="PassengerUseGlobalQueue">5.7.1. passenger_use_global_queue &lt;on|off&gt;</h4>
2293
- <div class="paragraph"><p>Turns the use of global queuing on or off.</p></div>
2294
- <div class="paragraph"><p>This option may occur in the following places:</p></div>
2295
- <div class="ulist"><ul>
2296
- <li>
2297
- <p>
2298
- In the <em>http</em> configuration block.
2299
- </p>
2300
- </li>
2301
- <li>
2302
- <p>
2303
- In a <em>server</em> configuration block.
2304
- </p>
2305
- </li>
2306
- <li>
2307
- <p>
2308
- In a <em>location</em> configuration block.
2309
- </p>
2310
- </li>
2311
- <li>
2312
- <p>
2313
- In an <em>if</em> configuration scope.
2314
- </p>
2315
- </li>
2316
- </ul></div>
2317
- <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>on</em>.</p></div>
2318
- <div class="paragraph"><p><em>This feature is sponsored by <a href="http://www.37signals.com/">37signals</a>.</em></p></div>
2319
- <div class="paragraph">
2320
- <div class="title">What does this option do?</div>
2321
- <p>Recall that Phusion Passenger spawns multiple backend processes (e.g. multiple
2322
- Ruby on Rails processes), each which processes HTTP requests serially. One of
2323
- Phusion Passenger’s jobs is to forward HTTP requests to a suitable backend
2324
- process. A backend process may take an arbitrary amount of time to process a
2325
- specific HTTP request. If the websites are (temporarily) under high load, and
2326
- the backend processes cannot process the requests fast enough, then some
2327
- requests may have to be queued.</p>
2328
- </div>
2329
- <div class="paragraph"><p>If global queuing is turned off, then Phusion Passenger will use <em>fair load
2330
- balancing</em>. This means that each backend process will have its own private
2331
- queue. Phusion Passenger will forward an HTTP request to the backend process
2332
- that has the least amount of requests in its queue.</p></div>
2333
- <div class="paragraph"><p>If global queuing is turned on, then Phusion Passenger will use a global queue
2334
- that’s shared between all backend processes. If an HTTP request comes in, and
2335
- all the backend processes are still busy, then Phusion Passenger will wait until
2336
- at least one backend process is done, and will then forward the request to that
2337
- process.</p></div>
2338
- <div class="paragraph">
2339
- <div class="title">When to turn on global queuing?</div>
2340
- <p>You should turn on global queuing if one of your web applications may have
2341
- long-running requests.</p>
2342
- </div>
2343
- <div class="paragraph"><p>For example suppose that:</p></div>
2344
- <div class="ulist"><ul>
2345
- <li>
2346
- <p>
2347
- global queuing is turned off.
2348
- </p>
2349
- </li>
2350
- <li>
2351
- <p>
2352
- we’re currently in a state where all backend processes have 3 requests in
2353
- their queue, except for a single backend process, which has 1 request in its
2354
- queue.
2355
- </p>
2356
- </li>
2357
- </ul></div>
2358
- <div class="paragraph"><p>The situation looks like this:</p></div>
2359
- <div class="listingblock">
2360
- <div class="content monospaced">
2361
- <pre>Backend process A: [* ] (1 request in queue)
2362
- Backend process B: [*** ] (3 requests in queue)
2363
- Backend process C: [*** ] (3 requests in queue)
2364
- Backend process D: [*** ] (3 requests in queue)</pre>
2365
- </div>
2366
- </div>
2367
- <div class="paragraph"><p>Each process is currently serving short-running requests.</p></div>
2368
- <div class="paragraph"><p>Phusion Passenger will forward the next request to backend process A. A will
2369
- now have 2 items in its queue. We’ll mark this new request with an X:</p></div>
2370
- <div class="listingblock">
2371
- <div class="content monospaced">
2372
- <pre>Backend process A: [*X ] (2 request in queue)
2373
- Backend process B: [*** ] (3 requests in queue)
2374
- Backend process C: [*** ] (3 requests in queue)
2375
- Backend process D: [*** ] (3 requests in queue)</pre>
2376
- </div>
2377
- </div>
2378
- <div class="paragraph"><p>Assuming that B, C and D still aren’t done with their current request, the next
2379
- HTTP request - let’s call this Y - will be forwarded to backend process A as
2380
- well, because it has the least number of items in its queue:</p></div>
2381
- <div class="listingblock">
2382
- <div class="content monospaced">
2383
- <pre>Backend process A: [*XY ] (3 requests in queue)
2384
- Backend process B: [*** ] (3 requests in queue)
2385
- Backend process C: [*** ] (3 requests in queue)
2386
- Backend process D: [*** ] (3 requests in queue)</pre>
2387
- </div>
2388
- </div>
2389
- <div class="paragraph"><p>But if request X happens to be a long-running request that needs 60 seconds to
2390
- complete, then we’ll have a problem. Y won’t be processed for at least 60
2391
- seconds. It would have been a better idea if Y was forward to processes B, C or
2392
- D instead, because they only have short-living requests in their queues.</p></div>
2393
- <div class="paragraph"><p>This problem will be avoided entirely if you turn global queuing on. With global
2394
- queuing, all backend processes will share the same queue. The first backend
2395
- process that becomes available will take from the queue, and so this
2396
- “queuing-behind-long-running-request” problem will never occur.</p></div>
2397
- </div>
2398
- <div class="sect3">
2399
- <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">5.7.2. passenger_ignore_client_abort &lt;on|off&gt;</h4>
2294
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_passenger_ignore_client_abort_lt_on_off_gt" data-comment-topic="passenger-ignore-client-abort">6.7.1. passenger_ignore_client_abort &lt;on|off&gt;</h4>
2400
2295
  <div class="paragraph"><p>Normally, when the HTTP client aborts the connection (e.g. when the user clicked on "Stop"
2401
2296
  in the browser), the connection with the application process will be closed too. If the
2402
2297
  application process continues to send its response, then that will result in EPIPE errors
@@ -2407,7 +2302,7 @@ read the application process’s response while discarding all the read data. Th
2407
2302
  EPIPE errors but it’ll also mean the backend process will be unavailable for new requests
2408
2303
  until it is done sending its response.</p></div>
2409
2304
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
2410
- <div class="ulist"><ul>
2305
+ <div class="ulist"><ul>
2411
2306
  <li>
2412
2307
  <p>
2413
2308
  In the <em>http</em> configuration block.
@@ -2432,7 +2327,7 @@ In an <em>if</em> configuration scope.
2432
2327
  <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>off</em>.</p></div>
2433
2328
  </div>
2434
2329
  <div class="sect3">
2435
- <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">5.7.3. passenger_set_cgi_param &lt;CGI environment name&gt; &lt;value&gt;</h4>
2330
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_passenger_set_cgi_param_lt_cgi_environment_name_gt_lt_value_gt" data-comment-topic="passenger-set-cgi-param-cgi-environment-name-value--rx9gc0">6.7.2. passenger_set_cgi_param &lt;CGI environment name&gt; &lt;value&gt;</h4>
2436
2331
  <div class="paragraph"><p>Allows one to define additional CGI environment variables to pass to the backend
2437
2332
  application. This is equivalent to ngx_http_fastcgi_module’s <em>fastcgi_param</em>
2438
2333
  directive, and is comparable to ngx_http_proxy_module’s <em>proxy_set_header</em> option.
@@ -2459,7 +2354,7 @@ passenger_set_cgi_param HTTP_X_FORWARDED_FOR 127.0.0.2;</pre>
2459
2354
  </div>
2460
2355
  </div>
2461
2356
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
2462
- <div class="ulist"><ul>
2357
+ <div class="ulist"><ul>
2463
2358
  <li>
2464
2359
  <p>
2465
2360
  In the <em>http</em> configuration block.
@@ -2483,7 +2378,7 @@ In an <em>if</em> configuration scope.
2483
2378
  </ul></div>
2484
2379
  </div>
2485
2380
  <div class="sect3">
2486
- <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">5.7.4. passenger_pass_header &lt;header name&gt;</h4>
2381
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_passenger_pass_header_lt_header_name_gt" data-comment-topic="passenger-pass-header-header-name--1cg31je">6.7.3. passenger_pass_header &lt;header name&gt;</h4>
2487
2382
  <div class="paragraph"><p>Some headers generated by backend applications are not forwarded to the HTTP client,
2488
2383
  e.g. <em>X-Accel-Redirect</em> which is directly processed by Nginx and then discarded from
2489
2384
  the final response. This directive allows one to force Nginx to pass those headers
@@ -2497,7 +2392,7 @@ anyway, similar to how <em>proxy_pass_header</em> works.</p></div>
2497
2392
  </div>
2498
2393
  </div>
2499
2394
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
2500
- <div class="ulist"><ul>
2395
+ <div class="ulist"><ul>
2501
2396
  <li>
2502
2397
  <p>
2503
2398
  In the <em>http</em> configuration block.
@@ -2521,7 +2416,7 @@ In an <em>if</em> configuration scope.
2521
2416
  </ul></div>
2522
2417
  </div>
2523
2418
  <div class="sect3">
2524
- <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">5.7.5. passenger_buffer_response &lt;on|off&gt;</h4>
2419
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_passenger_buffer_response_lt_on_off_gt" data-comment-topic="passenger-buffer-response">6.7.4. passenger_buffer_response &lt;on|off&gt;</h4>
2525
2420
  <div class="paragraph"><p>When turned on, application-generated responses are buffered in memory and also on
2526
2421
  disk if the response is larger than a certain threshold. By buffering responses,
2527
2422
  protection is provided against slow HTTP clients that can not read your response
@@ -2569,7 +2464,7 @@ after which it receives the entire response at once.
2569
2464
  When response buffering is turned off, it works as expected: the client
2570
2465
  receives an "entry X" message every second for 10 seconds.</p></div>
2571
2466
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
2572
- <div class="ulist"><ul>
2467
+ <div class="ulist"><ul>
2573
2468
  <li>
2574
2469
  <p>
2575
2470
  In the <em>http</em> configuration block.
@@ -2594,34 +2489,34 @@ In an <em>if</em> configuration scope.
2594
2489
  <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>on</em>.</p></div>
2595
2490
  </div>
2596
2491
  <div class="sect3">
2597
- <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">5.7.6. passenger_buffer_size</h4>
2492
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_passenger_buffer_size" data-comment-topic="passenger-buffer-size-1jfkq87">6.7.5. passenger_buffer_size</h4>
2598
2493
  </div>
2599
2494
  <div class="sect3">
2600
- <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">5.7.7. passenger_buffers</h4>
2495
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_passenger_buffers" data-comment-topic="passenger-busy-buffers">6.7.6. passenger_buffers</h4>
2601
2496
  </div>
2602
2497
  <div class="sect3">
2603
- <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">5.7.8. passenger_busy_buffer_size</h4>
2498
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_passenger_busy_buffer_size" data-comment-topic="passenger-busy-buffer-size-124sj61">6.7.7. passenger_busy_buffer_size</h4>
2604
2499
  <div class="paragraph"><p>These options have the same effect as proxy_module’s similarly named options.
2605
2500
  They can be used to modify the maximum allowed HTTP header size.</p></div>
2606
2501
  </div>
2607
2502
  </div>
2608
2503
  <div class="sect2">
2609
- <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">5.8. Security options</h3>
2504
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_security_options" data-comment-topic="security-options-1bv93g4">6.8. Security options</h3>
2610
2505
  <div class="sect3">
2611
- <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">5.8.1. passenger_user_switching &lt;on|off&gt;</h4>
2506
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="PassengerUserSwitching" data-comment-topic="passenger-user-switching-on-off--1p37u3l">6.8.1. passenger_user_switching &lt;on|off&gt;</h4>
2612
2507
  <div class="paragraph"><p>Whether to enable <a href="#user_switching">user switching support</a>.</p></div>
2613
2508
  <div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration block.
2614
2509
  The default value is <em>on</em>.</p></div>
2615
2510
  </div>
2616
2511
  <div class="sect3">
2617
- <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">5.8.2. passenger_user &lt;username&gt;</h4>
2512
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_passenger_user_lt_username_gt" data-comment-topic="passenger-user-username--b06ur7">6.8.2. passenger_user &lt;username&gt;</h4>
2618
2513
  <div class="paragraph"><p>If <a href="#user_switching">user switching support</a> is enabled, then Phusion Passenger will
2619
2514
  by default run the web application as the owner of the file <em>config/environment.rb</em>
2620
2515
  (for Rails apps) or <em>config.ru</em> (for Rack apps). This option allows you to override
2621
2516
  that behavior and explicitly set a user to run the web application as, regardless
2622
2517
  of the ownership of <em>environment.rb</em>/<em>config.ru</em>.</p></div>
2623
2518
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
2624
- <div class="ulist"><ul>
2519
+ <div class="ulist"><ul>
2625
2520
  <li>
2626
2521
  <p>
2627
2522
  In the <em>http</em> configuration block.
@@ -2646,7 +2541,7 @@ In an <em>if</em> configuration scope.
2646
2541
  <div class="paragraph"><p>In each place, it may be specified at most once.</p></div>
2647
2542
  </div>
2648
2543
  <div class="sect3">
2649
- <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">5.8.3. passenger_group &lt;group name&gt;</h4>
2544
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_passenger_group_lt_group_name_gt" data-comment-topic="passenger-user-group-name--1fco4j7">6.8.3. passenger_group &lt;group name&gt;</h4>
2650
2545
  <div class="paragraph"><p>If <a href="#user_switching">user switching support</a> is enabled, then Phusion Passenger will
2651
2546
  by default run the web application as the primary group of the owner of the file
2652
2547
  <em>config/environment.rb</em> (for Rails apps) or <em>config.ru</em> (for Rack apps). This option
@@ -2655,7 +2550,7 @@ as, regardless of the ownership of <em>environment.rb</em>/<em>config.ru</em>.</
2655
2550
  <div class="paragraph"><p><em>&lt;group name&gt;</em> may also be set to the special value <em>!STARTUP_FILE!</em>, in which case
2656
2551
  the web application’s group will be set to <em>environment.rb</em>/<em>config.ru</em>'s group.</p></div>
2657
2552
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
2658
- <div class="ulist"><ul>
2553
+ <div class="ulist"><ul>
2659
2554
  <li>
2660
2555
  <p>
2661
2556
  In the <em>http</em> configuration block.
@@ -2680,7 +2575,7 @@ In an <em>if</em> configuration scope.
2680
2575
  <div class="paragraph"><p>In each place, it may be specified at most once.</p></div>
2681
2576
  </div>
2682
2577
  <div class="sect3">
2683
- <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">5.8.4. passenger_default_user &lt;username&gt;</h4>
2578
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="PassengerDefaultUser" data-comment-topic="passenger-default-user-username--1h6cdmf">6.8.4. passenger_default_user &lt;username&gt;</h4>
2684
2579
  <div class="paragraph"><p>Phusion Passenger enables <a href="#user_switching">user switching support</a> by default.
2685
2580
  This configuration option allows one to specify the user that applications must
2686
2581
  run as, if user switching fails or is disabled.</p></div>
@@ -2688,7 +2583,7 @@ run as, if user switching fails or is disabled.</p></div>
2688
2583
  The default value is <em>nobody</em>.</p></div>
2689
2584
  </div>
2690
2585
  <div class="sect3">
2691
- <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">5.8.5. Passenger_default_group &lt;group name&gt;</h4>
2586
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="PassengerDefaultGroup" data-comment-topic="passenger-default-group-group-name--1qxn2qa">6.8.5. Passenger_default_group &lt;group name&gt;</h4>
2692
2587
  <div class="paragraph"><p>Phusion Passenger enables <a href="#user_switching">user switching support</a> by default.
2693
2588
  This configuration option allows one to specify the group that applications must
2694
2589
  run as, if user switching fails or is disabled.</p></div>
@@ -2697,7 +2592,7 @@ The default value is the primary group of the user specifified by
2697
2592
  <a href="#PassengerDefaultUser">passenger_default_user</a>.</p></div>
2698
2593
  </div>
2699
2594
  <div class="sect3">
2700
- <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">5.8.6. passenger_friendly_error_pages &lt;on|off&gt;</h4>
2595
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_passenger_friendly_error_pages_lt_on_off_gt" data-comment-topic="passenger-friendly-error-pages-on-off--1ti1a0e">6.8.6. passenger_friendly_error_pages &lt;on|off&gt;</h4>
2701
2596
  <div class="paragraph"><p>Phusion Passenger can display friendly error pages whenever an application fails
2702
2597
  to start. This friendly error page presents the startup error message, some
2703
2598
  suggestions for solving the problem, and a backtrace. This feature is very useful
@@ -2706,7 +2601,7 @@ but the page might reveal potentially sensitive information, depending on the
2706
2601
  application. Experienced system administrators who are using Phusion Passenger
2707
2602
  on serious production servers should consider turning this feature off.</p></div>
2708
2603
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
2709
- <div class="ulist"><ul>
2604
+ <div class="ulist"><ul>
2710
2605
  <li>
2711
2606
  <p>
2712
2607
  In the <em>http</em> configuration block.
@@ -2732,9 +2627,9 @@ In an <em>if</em> configuration scope.
2732
2627
  </div>
2733
2628
  </div>
2734
2629
  <div class="sect2">
2735
- <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">5.9. Resource control and optimization options</h3>
2630
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_resource_control_and_optimization_options" data-comment-topic="resource-control-and-optimization-options-xd7evs">6.9. Resource control and optimization options</h3>
2736
2631
  <div class="sect3">
2737
- <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">5.9.1. passenger_max_pool_size &lt;integer&gt;</h4>
2632
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="PassengerMaxPoolSize" data-comment-topic="passenger-max-pool-size-integer--3jzefs">6.9.1. passenger_max_pool_size &lt;integer&gt;</h4>
2738
2633
  <div class="paragraph"><p>The maximum number of <a href="#application_process">application processes</a> that may
2739
2634
  simultanously exist. A larger number results in higher memory usage,
2740
2635
  but improved ability to handle concurrent HTTP clients.</p></div>
@@ -2751,24 +2646,24 @@ hardware or getting more servers.)</p></div>
2751
2646
  <div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration bock.
2752
2647
  The default value is <em>6</em>.</p></div>
2753
2648
  <div class="admonitionblock">
2754
- <table><tr>
2649
+ <table><tr>
2755
2650
  <td class="icon">
2756
- <img src="./images/icons/tip.png" alt="Tip">
2651
+ <img src="./images/icons/tip.png" alt="Tip">
2757
2652
  </td>
2758
2653
  <td class="content">We strongly recommend you to <a href="#reducing_memory_usage">use Ruby Enterprise Edition</a>. This allows you to reduce the memory usage of your Ruby on Rails applications
2759
2654
  by about 33%, and it’s not hard to install.</td>
2760
- </tr></table>
2655
+ </tr></table>
2761
2656
  </div>
2762
2657
  </div>
2763
2658
  <div class="sect3">
2764
- <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">5.9.2. passenger_min_instances &lt;integer&gt;</h4>
2659
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="PassengerMinInstances" data-comment-topic="passenger-min-instances-integer--uclykt">6.9.2. passenger_min_instances &lt;integer&gt;</h4>
2765
2660
  <div class="paragraph"><p>This specifies the minimum number of application processes that should exist for a
2766
2661
  given application. You should set this option to a
2767
2662
  non-zero value if you want to avoid potentially long startup times after a website
2768
2663
  has been <a href="#idle_process">idle</a> for an extended period.</p></div>
2769
2664
  <div class="paragraph"><p>Please note that this option does <strong>not</strong> pre-start application processes during Nginx
2770
2665
  startup. It just makes sure that when the application is first accessed:</p></div>
2771
- <div class="olist arabic"><ol class="arabic">
2666
+ <div class="olist arabic"><ol class="arabic">
2772
2667
  <li>
2773
2668
  <p>
2774
2669
  at least the given number of processes will be spawned.
@@ -2811,7 +2706,7 @@ simultanously. Phusion Passenger will start 12 more application processes. After
2811
2706
  timeout of 10 seconds have passed, Phusion Passenger will clean up 12 application
2812
2707
  processes, keeping 3 processes around.</p></div>
2813
2708
  <div class="paragraph"><p>The passenger_min_instances option may occur in the following places:</p></div>
2814
- <div class="ulist"><ul>
2709
+ <div class="ulist"><ul>
2815
2710
  <li>
2816
2711
  <p>
2817
2712
  In the <em>http</em> configuration block.
@@ -2836,7 +2731,7 @@ In an <em>if</em> configuration scope.
2836
2731
  <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>1</em>.</p></div>
2837
2732
  </div>
2838
2733
  <div class="sect3">
2839
- <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">5.9.3. passenger_max_instances &lt;integer&gt;</h4>
2734
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_passenger_max_instances_lt_integer_gt" data-comment-topic="passenger-max-instances">6.9.3. passenger_max_instances &lt;integer&gt;</h4>
2840
2735
  <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>
2841
2736
  <div class="paragraph"><p>The maximum number of application processes that may simultaneously exist
2842
2737
  for an application. This helps to make sure that a single application
@@ -2846,7 +2741,7 @@ means that there is no limit placed on the number of processes a single applicat
2846
2741
  may spawn, i.e. only the global limit of <a href="#PassengerMaxPoolSize">passenger_max_pool_size</a>
2847
2742
  will be enforced.</p></div>
2848
2743
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
2849
- <div class="ulist"><ul>
2744
+ <div class="ulist"><ul>
2850
2745
  <li>
2851
2746
  <p>
2852
2747
  In the <em>http</em> configuration block.
@@ -2870,9 +2765,9 @@ In an <em>if</em> configuration scope.
2870
2765
  </ul></div>
2871
2766
  <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>0</em>.</p></div>
2872
2767
  <div class="admonitionblock">
2873
- <table><tr>
2768
+ <table><tr>
2874
2769
  <td class="icon">
2875
- <img src="./images/icons/tip.png" alt="Tip">
2770
+ <img src="./images/icons/tip.png" alt="Tip">
2876
2771
  </td>
2877
2772
  <td class="content">
2878
2773
  <div class="title">Practical usage example</div>
@@ -2883,11 +2778,11 @@ to 10. The e-commerce website is more important to you. You can then set
2883
2778
  than 3 processes, even if it suddenly gets a lot of traffic. Your e-commerce website
2884
2779
  on the other hand will be free to spawn up to 10 processes if it gets a lot of traffic.</p></div>
2885
2780
  </td>
2886
- </tr></table>
2781
+ </tr></table>
2887
2782
  </div>
2888
2783
  </div>
2889
2784
  <div class="sect3">
2890
- <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">5.9.4. passenger_max_instances_per_app &lt;integer&gt;</h4>
2785
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_passenger_max_instances_per_app_lt_integer_gt" data-comment-topic="passenger-max-instances-per-app-integer--1xhbbne">6.9.4. passenger_max_instances_per_app &lt;integer&gt;</h4>
2891
2786
  <div class="paragraph"><p>The maximum number of application processes that may simultaneously exist
2892
2787
  for a single application. This helps to make sure that a single application
2893
2788
  will not occupy all available slots in the application pool.</p></div>
@@ -2899,7 +2794,7 @@ will be enforced.</p></div>
2899
2794
  The default value is <em>0</em>.</p></div>
2900
2795
  </div>
2901
2796
  <div class="sect3">
2902
- <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">5.9.5. passenger_pool_idle_time &lt;integer&gt;</h4>
2797
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="PassengerPoolIdleTime" data-comment-topic="passenger-pool-idle-time-integer--xcw65o">6.9.5. passenger_pool_idle_time &lt;integer&gt;</h4>
2903
2798
  <div class="paragraph"><p>The maximum number of seconds that an application process may be idle. That is,
2904
2799
  if an application process hasn’t received any traffic after the given number of
2905
2800
  seconds, then it will be shutdown in order to conserve memory.</p></div>
@@ -2921,7 +2816,116 @@ applications, each which must be available at all times.</p></div>
2921
2816
  The default value is <em>300</em>.</p></div>
2922
2817
  </div>
2923
2818
  <div class="sect3">
2924
- <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" data-anchor="PassengerMaxRequests">5.9.6. passenger_max_requests &lt;integer&gt;</h4>
2819
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_passenger_max_preloader_idle_time_lt_integer_gt" data-comment-topic="rails-app-spawner-idle-time-integer--1xjqe4b">6.9.6. passenger_max_preloader_idle_time &lt;integer&gt;</h4>
2820
+ <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
2821
+ Phusion Passenger do. That is, it will automatically shutdown if it hasn’t done
2822
+ anything for a given period.</p></div>
2823
+ <div class="paragraph"><p>This option allows you to set the ApplicationSpawner server’s idle timeout, in
2824
+ seconds. A value of <em>0</em> means that it should never idle timeout.</p></div>
2825
+ <div class="paragraph"><p>Setting a higher value will mean that the ApplicationSpawner server is kept around
2826
+ longer, which may slightly increase memory usage. But as long as the
2827
+ ApplicationSpawner server is running, the time to spawn a Ruby on Rails backend
2828
+ process only takes about 10% of the time that is normally needed, assuming that
2829
+ you’re using the <em>smart</em> or <em>smart-lv2</em> <a href="#RailsSpawnMethod">spawning method</a>. So if your
2830
+ system has enough memory, is it recommended that you set this option to a high
2831
+ value or to <em>0</em>.</p></div>
2832
+ <div class="paragraph"><p>This option may occur in the following places:</p></div>
2833
+ <div class="ulist"><ul>
2834
+ <li>
2835
+ <p>
2836
+ In the <em>http</em> configuration block.
2837
+ </p>
2838
+ </li>
2839
+ <li>
2840
+ <p>
2841
+ In a <em>server</em> configuration block.
2842
+ </p>
2843
+ </li>
2844
+ <li>
2845
+ <p>
2846
+ In a <em>location</em> configuration block.
2847
+ </p>
2848
+ </li>
2849
+ <li>
2850
+ <p>
2851
+ In an <em>if</em> configuration scope.
2852
+ </p>
2853
+ </li>
2854
+ </ul></div>
2855
+ <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>
2856
+ </div>
2857
+ <div class="sect3">
2858
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="PassengerConcurrencyModel" data-comment-topic="passenger-max-requests">6.9.7. passenger_concurrency_model &lt;process|thread&gt;</h4>
2859
+ <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>
2860
+ <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>
2861
+ <div class="ulist"><ul>
2862
+ <li>
2863
+ <p>
2864
+ <em>process</em> - single-threaded, multi-processed I/O concurrency. Each application process only has a single thread and can only handle 1 request at a time. This is the concurrency model that Ruby applications traditionally used. It has excellent compatiblity (can work with applications that are not designed to be thread-safe) but is unsuitable workloads in which the application has to wait for a lot of external I/O (e.g. HTTP API calls), and uses more memory because each process has a large memory overhead.
2865
+ </p>
2866
+ </li>
2867
+ <li>
2868
+ <p>
2869
+ <em>thread</em> - multi-threaded, multi-processed I/O concurrency. Each application process has multiple threads (customizable via <a href="#PassengerThreadCount">passenger_thread_count</a>). This model provides much better I/O concurrency and uses less memory because threads share memory with each other within the same process. However, using this model may cause compatibility problems if the application is not designed to be thread-safe.
2870
+ </p>
2871
+ </li>
2872
+ </ul></div>
2873
+ <div class="paragraph"><p>This option may occur in the following places:</p></div>
2874
+ <div class="ulist"><ul>
2875
+ <li>
2876
+ <p>
2877
+ In the <em>http</em> configuration block.
2878
+ </p>
2879
+ </li>
2880
+ <li>
2881
+ <p>
2882
+ In a <em>server</em> configuration block.
2883
+ </p>
2884
+ </li>
2885
+ <li>
2886
+ <p>
2887
+ In a <em>location</em> configuration block.
2888
+ </p>
2889
+ </li>
2890
+ <li>
2891
+ <p>
2892
+ In an <em>if</em> configuration scope.
2893
+ </p>
2894
+ </li>
2895
+ </ul></div>
2896
+ <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>process</em>.</p></div>
2897
+ </div>
2898
+ <div class="sect3">
2899
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="PassengerThreadCount" data-comment-topic="passenger-max-request-time-seconds--1qod9kg">6.9.8. passenger_thread_count &lt;number&gt;</h4>
2900
+ <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>
2901
+ <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>
2902
+ <div class="paragraph"><p>This option may occur in the following places:</p></div>
2903
+ <div class="ulist"><ul>
2904
+ <li>
2905
+ <p>
2906
+ In the <em>http</em> configuration block.
2907
+ </p>
2908
+ </li>
2909
+ <li>
2910
+ <p>
2911
+ In a <em>server</em> configuration block.
2912
+ </p>
2913
+ </li>
2914
+ <li>
2915
+ <p>
2916
+ In a <em>location</em> configuration block.
2917
+ </p>
2918
+ </li>
2919
+ <li>
2920
+ <p>
2921
+ In an <em>if</em> configuration scope.
2922
+ </p>
2923
+ </li>
2924
+ </ul></div>
2925
+ <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>1</em>.</p></div>
2926
+ </div>
2927
+ <div class="sect3">
2928
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="PassengerMaxRequests" data-comment-topic="passenger-max-requests-integer--sgzint">6.9.9. passenger_max_requests &lt;integer&gt;</h4>
2925
2929
  <div class="paragraph"><p>The maximum number of requests an application process will process. After
2926
2930
  serving that many requests, the application process will be shut down and
2927
2931
  Phusion Passenger will restart it. A value of 0 means that there is no maximum:
@@ -2931,7 +2935,7 @@ reached.</p></div>
2931
2935
  it down after a certain number of requests, all of its memory is guaranteed
2932
2936
  to be freed by the operating system.</p></div>
2933
2937
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
2934
- <div class="ulist"><ul>
2938
+ <div class="ulist"><ul>
2935
2939
  <li>
2936
2940
  <p>
2937
2941
  In the <em>http</em> configuration block.
@@ -2955,9 +2959,9 @@ In an <em>if</em> configuration scope.
2955
2959
  </ul></div>
2956
2960
  <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>0</em>.</p></div>
2957
2961
  <div class="admonitionblock">
2958
- <table><tr>
2962
+ <table><tr>
2959
2963
  <td class="icon">
2960
- <img src="./images/icons/caution.png" alt="Caution">
2964
+ <img src="./images/icons/caution.png" alt="Caution">
2961
2965
  </td>
2962
2966
  <td class="content">
2963
2967
  <div class="paragraph"><p>The <a href="#PassengerMaxRequests">passenger_max_requests</a> directive should be considered
@@ -2965,11 +2969,11 @@ as a workaround for misbehaving applications. It is advised that you fix the
2965
2969
  problem in your application rather than relying on these directives as a
2966
2970
  measure to avoid memory leaks.</p></div>
2967
2971
  </td>
2968
- </tr></table>
2972
+ </tr></table>
2969
2973
  </div>
2970
2974
  </div>
2971
2975
  <div class="sect3">
2972
- <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--1qod9kg" data-anchor="PassengerMaxRequestTime">5.9.7. passenger_max_request_time &lt;seconds&gt;</h4>
2976
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="PassengerMaxRequestTime" data-comment-topic="passenger-pre-start-url--1f2phk7">6.9.10. passenger_max_request_time &lt;seconds&gt;</h4>
2973
2977
  <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>
2974
2978
  <div class="paragraph"><p>The maximum amount of time, in seconds, that an application process may take
2975
2979
  to process a request. If the request takes longer than this amount of time,
@@ -2978,7 +2982,7 @@ restarted upon the next request. A value of 0 means that there is no time limit.
2978
2982
  <div class="paragraph"><p>This option is useful for preventing your application from freezing for an
2979
2983
  indefinite period of time.</p></div>
2980
2984
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
2981
- <div class="ulist"><ul>
2985
+ <div class="ulist"><ul>
2982
2986
  <li>
2983
2987
  <p>
2984
2988
  In the <em>http</em> configuration block.
@@ -3026,9 +3030,9 @@ to 10 seconds. You can then configure Phusion Passenger as follows:</p>
3026
3030
  or if a request to any other URI takes more than 2 seconds,
3027
3031
  then the corresponding application process will be forced to shutdown.</p></div>
3028
3032
  <div class="admonitionblock">
3029
- <table><tr>
3033
+ <table><tr>
3030
3034
  <td class="icon">
3031
- <img src="./images/icons/caution.png" alt="Caution">
3035
+ <img src="./images/icons/caution.png" alt="Caution">
3032
3036
  </td>
3033
3037
  <td class="content">
3034
3038
  <div class="paragraph"><p>The <a href="#PassengerMaxRequestTime">passenger_max_request_time</a> directive should be
@@ -3036,11 +3040,11 @@ considered as a workaround for misbehaving applications. It is advised that you
3036
3040
  fix the problem in your application rather than relying on these directives as a
3037
3041
  measure to avoid freezing applications.</p></div>
3038
3042
  </td>
3039
- </tr></table>
3043
+ </tr></table>
3040
3044
  </div>
3041
3045
  </div>
3042
3046
  <div class="sect3">
3043
- <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">5.9.8. passenger_memory_limit &lt;integer&gt;</h4>
3047
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="PassengerMemoryLimit" data-comment-topic="passenger-memory-limit-integer--1ry7dwx">6.9.11. passenger_memory_limit &lt;integer&gt;</h4>
3044
3048
  <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>
3045
3049
  <div class="paragraph"><p>The maximum amount of memory that an application process may use, in megabytes.
3046
3050
  Once an application process has surpassed its memory limit, it will process
@@ -3050,7 +3054,7 @@ will not be checked.</p></div>
3050
3054
  <div class="paragraph"><p>This option is useful if your application is leaking memory. By shutting
3051
3055
  it down, all of its memory is guaranteed to be freed by the operating system.</p></div>
3052
3056
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
3053
- <div class="ulist"><ul>
3057
+ <div class="ulist"><ul>
3054
3058
  <li>
3055
3059
  <p>
3056
3060
  In the <em>http</em> configuration block.
@@ -3074,9 +3078,9 @@ In an <em>if</em> configuration scope.
3074
3078
  </ul></div>
3075
3079
  <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>200</em>.</p></div>
3076
3080
  <div class="admonitionblock">
3077
- <table><tr>
3081
+ <table><tr>
3078
3082
  <td class="icon">
3079
- <img src="./images/icons/note.png" alt="Note">
3083
+ <img src="./images/icons/note.png" alt="Note">
3080
3084
  </td>
3081
3085
  <td class="content">
3082
3086
  <div class="title">A word about permissions</div>
@@ -3089,12 +3093,12 @@ tight permissions on <span class="monospaced">/proc</span>, this directive may n
3089
3093
  this directive and your <span class="monospaced">/proc</span> permissions are too tight, then please consider
3090
3094
  untightening the permissions.</p></div>
3091
3095
  </td>
3092
- </tr></table>
3096
+ </tr></table>
3093
3097
  </div>
3094
3098
  <div class="admonitionblock">
3095
- <table><tr>
3099
+ <table><tr>
3096
3100
  <td class="icon">
3097
- <img src="./images/icons/tip.png" alt="Tip">
3101
+ <img src="./images/icons/tip.png" alt="Tip">
3098
3102
  </td>
3099
3103
  <td class="content">
3100
3104
  <div class="title">FreeBSD and <span class="monospaced">/proc</span>
@@ -3108,12 +3112,12 @@ which is very fast. If you mount <span class="monospaced">/proc</span> with a di
3108
3112
  Phusion Passenger must resort to querying memory information from the <span class="monospaced">ps</span> command,
3109
3113
  which is a lot slower.</p></div>
3110
3114
  </td>
3111
- </tr></table>
3115
+ </tr></table>
3112
3116
  </div>
3113
3117
  <div class="admonitionblock">
3114
- <table><tr>
3118
+ <table><tr>
3115
3119
  <td class="icon">
3116
- <img src="./images/icons/caution.png" alt="Caution">
3120
+ <img src="./images/icons/caution.png" alt="Caution">
3117
3121
  </td>
3118
3122
  <td class="content">
3119
3123
  <div class="paragraph"><p>The <a href="#PassengerMaxRequests">passenger_max_requests</a> and
@@ -3122,25 +3126,25 @@ as workarounds for misbehaving applications. It is advised that you fix the
3122
3126
  problem in your application rather than relying on these directives as a
3123
3127
  measure to avoid memory leaks.</p></div>
3124
3128
  </td>
3125
- </tr></table>
3129
+ </tr></table>
3126
3130
  </div>
3127
3131
  </div>
3128
3132
  <div class="sect3">
3129
- <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--1f2phk7" data-anchor="PassengerPreStart">5.9.9. passenger_pre_start &lt;url&gt;</h4>
3133
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="PassengerPreStart" data-comment-topic="passenger-pre-start-url--npldeb">6.9.12. passenger_pre_start &lt;url&gt;</h4>
3130
3134
  <div class="paragraph"><p>By default, Phusion Passenger does not start any application processes until said
3131
3135
  web application is first accessed. The result is that the first visitor of said
3132
3136
  web application might experience a small delay as Phusion Passenger is starting
3133
3137
  the web application on demand. If that is undesirable, then this directive can be
3134
3138
  used to pre-started application processes during Nginx startup.</p></div>
3135
3139
  <div class="paragraph"><p>A few things to be careful of:</p></div>
3136
- <div class="ulist"><ul>
3140
+ <div class="ulist"><ul>
3137
3141
  <li>
3138
3142
  <p>
3139
3143
  This directive accepts the <strong>URL</strong> of the web application you want to pre-start,
3140
3144
  not a on/off value! This might seem a bit weird, but read on for rationale. As
3141
3145
  for the specifics of the URL:
3142
3146
  </p>
3143
- <div class="ulist"><ul>
3147
+ <div class="ulist"><ul>
3144
3148
  <li>
3145
3149
  <p>
3146
3150
  The domain part of the URL must be equal to the value of the <em>server_name</em>
@@ -3341,14 +3345,14 @@ the request ending up at a different web server in the cluster.</p></div>
3341
3345
  </div>
3342
3346
  </div>
3343
3347
  <div class="sect2">
3344
- <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">5.10. Logging and debugging options</h3>
3348
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_logging_and_debugging_options" data-comment-topic="logging-and-debugging-options-14e91ni">6.10. Logging and debugging options</h3>
3345
3349
  <div class="sect3">
3346
- <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">5.10.1. passenger_log_level &lt;integer&gt;</h4>
3350
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_passenger_log_level_lt_integer_gt" data-comment-topic="passenger-log-level-integer--17snhon">6.10.1. passenger_log_level &lt;integer&gt;</h4>
3347
3351
  <div class="paragraph"><p>This option allows one to specify how much information Phusion Passenger should
3348
3352
  write to the Nginx error log file. A higher log level value means that more
3349
3353
  information will be logged.</p></div>
3350
3354
  <div class="paragraph"><p>Possible values are:</p></div>
3351
- <div class="ulist"><ul>
3355
+ <div class="ulist"><ul>
3352
3356
  <li>
3353
3357
  <p>
3354
3358
  <em>0</em>: Show only errors and warnings.
@@ -3376,14 +3380,14 @@ information will be logged.</p></div>
3376
3380
  The default is <em>0</em>.</p></div>
3377
3381
  </div>
3378
3382
  <div class="sect3">
3379
- <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">5.10.2. passenger_debug_log_file &lt;filename&gt;</h4>
3383
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_passenger_debug_log_file_lt_filename_gt" data-comment-topic="passenger-debug-log-file-filename--21ubaj">6.10.2. passenger_debug_log_file &lt;filename&gt;</h4>
3380
3384
  <div class="paragraph"><p>By default Phusion Passenger debugging and error messages are written to the global
3381
3385
  web server error log. This option allows one to specify the file that debugging and
3382
3386
  error messages should be written to instead.</p></div>
3383
3387
  <div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration block.</p></div>
3384
3388
  </div>
3385
3389
  <div class="sect3">
3386
- <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">5.10.3. passenger_debugger &lt;on|off&gt;</h4>
3390
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_passenger_debugger_lt_on_off_gt" data-comment-topic="passenger-debugger-on-off--1wkuq85">6.10.3. passenger_debugger &lt;on|off&gt;</h4>
3387
3391
  <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>
3388
3392
  <div class="paragraph"><p>Turns support for application debugging on or off. In case of Ruby applications,
3389
3393
  turning this option on will cause them to load the <span class="monospaced">ruby-debug</span> gem (when on Ruby 1.8)
@@ -3397,7 +3401,7 @@ gem 'debugger', :platforms =&gt; :ruby_19</pre>
3397
3401
  </div>
3398
3402
  <div class="paragraph"><p>Once debugging is turned on, you can use the command <span class="monospaced">passenger-irb --debug &lt;PID&gt;</span> to attach an rdebug console to the application process with the given PID. Attaching will succeed once the application process executes a <span class="monospaced">debugger</span> command.</p></div>
3399
3403
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
3400
- <div class="ulist"><ul>
3404
+ <div class="ulist"><ul>
3401
3405
  <li>
3402
3406
  <p>
3403
3407
  In the <em>http</em> configuration block.
@@ -3423,12 +3427,12 @@ In an <em>if</em> configuration scope.
3423
3427
  </div>
3424
3428
  </div>
3425
3429
  <div class="sect2">
3426
- <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">5.11. Ruby on Rails-specific options</h3>
3430
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_ruby_on_rails_specific_options" data-comment-topic="ruby-on-rails-specific-options-12vfokt">6.11. Ruby on Rails-specific options</h3>
3427
3431
  <div class="sect3">
3428
- <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">5.11.1. rails_env &lt;string&gt;</h4>
3432
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="RailsEnv" data-comment-topic="rails-env-string--jlh7v9">6.11.1. rails_env &lt;string&gt;</h4>
3429
3433
  <div class="paragraph"><p>This option allows one to specify the default <span class="monospaced">RAILS_ENV</span> value.</p></div>
3430
3434
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
3431
- <div class="ulist"><ul>
3435
+ <div class="ulist"><ul>
3432
3436
  <li>
3433
3437
  <p>
3434
3438
  In the <em>http</em> configuration block.
@@ -3452,92 +3456,14 @@ In an <em>if</em> configuration scope.
3452
3456
  </ul></div>
3453
3457
  <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>production</em>.</p></div>
3454
3458
  </div>
3455
- <div class="sect3">
3456
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_rails_framework_spawner_idle_time_lt_integer_gt"></span><h4 data-comment-topic="rails-framework-spawner-idle-time-integer--q5ljd5" data-anchor="_rails_framework_spawner_idle_time_lt_integer_gt">5.11.2. rails_framework_spawner_idle_time &lt;integer&gt;</h4>
3457
- <div class="paragraph"><p>The FrameworkSpawner server (explained in <a href="#spawning_methods_explained">Spawning methods explained</a>) has an idle timeout, just like the backend processes spawned by
3458
- Phusion Passenger do. That is, it will automatically shutdown if it hasn’t done
3459
- anything for a given period.</p></div>
3460
- <div class="paragraph"><p>This option allows you to set the FrameworkSpawner server’s idle timeout, in
3461
- seconds. A value of <em>0</em> means that it should never idle timeout.</p></div>
3462
- <div class="paragraph"><p>Setting a higher value will mean that the FrameworkSpawner server is kept around
3463
- longer, which may slightly increase memory usage. But as long as the
3464
- FrameworkSpawner server is running, the time to spawn a Ruby on Rails backend
3465
- process only takes about 40% of the time that is normally needed, assuming that
3466
- you’re using the <em>smart</em> <a href="#RailsSpawnMethod">spawning method</a>. So if your
3467
- system has enough memory, is it recommended that you set this option to a high
3468
- value or to <em>0</em>.</p></div>
3469
- <div class="paragraph"><p>This option may occur in the following places:</p></div>
3470
- <div class="ulist"><ul>
3471
- <li>
3472
- <p>
3473
- In the <em>http</em> configuration block.
3474
- </p>
3475
- </li>
3476
- <li>
3477
- <p>
3478
- In a <em>server</em> configuration block.
3479
- </p>
3480
- </li>
3481
- <li>
3482
- <p>
3483
- In a <em>location</em> configuration block.
3484
- </p>
3485
- </li>
3486
- <li>
3487
- <p>
3488
- In an <em>if</em> configuration scope.
3489
- </p>
3490
- </li>
3491
- </ul></div>
3492
- <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>1800</em> (30 minutes).</p></div>
3493
- </div>
3494
- <div class="sect3">
3495
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_rails_app_spawner_idle_time_lt_integer_gt"></span><h4 data-comment-topic="rails-app-spawner-idle-time-integer--1xjqe4b" data-anchor="_rails_app_spawner_idle_time_lt_integer_gt">5.11.3. rails_app_spawner_idle_time &lt;integer&gt;</h4>
3496
- <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
3497
- Phusion Passenger do. That is, it will automatically shutdown if it hasn’t done
3498
- anything for a given period.</p></div>
3499
- <div class="paragraph"><p>This option allows you to set the ApplicationSpawner server’s idle timeout, in
3500
- seconds. A value of <em>0</em> means that it should never idle timeout.</p></div>
3501
- <div class="paragraph"><p>Setting a higher value will mean that the ApplicationSpawner server is kept around
3502
- longer, which may slightly increase memory usage. But as long as the
3503
- ApplicationSpawner server is running, the time to spawn a Ruby on Rails backend
3504
- process only takes about 10% of the time that is normally needed, assuming that
3505
- you’re using the <em>smart</em> or <em>smart-lv2</em> <a href="#RailsSpawnMethod">spawning method</a>. So if your
3506
- system has enough memory, is it recommended that you set this option to a high
3507
- value or to <em>0</em>.</p></div>
3508
- <div class="paragraph"><p>This option may occur in the following places:</p></div>
3509
- <div class="ulist"><ul>
3510
- <li>
3511
- <p>
3512
- In the <em>http</em> configuration block.
3513
- </p>
3514
- </li>
3515
- <li>
3516
- <p>
3517
- In a <em>server</em> configuration block.
3518
- </p>
3519
- </li>
3520
- <li>
3521
- <p>
3522
- In a <em>location</em> configuration block.
3523
- </p>
3524
- </li>
3525
- <li>
3526
- <p>
3527
- In an <em>if</em> configuration scope.
3528
- </p>
3529
- </li>
3530
- </ul></div>
3531
- <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>600</em> (10 minutes).</p></div>
3532
- </div>
3533
3459
  </div>
3534
3460
  <div class="sect2">
3535
- <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">5.12. Rack and Rails &gt;= 3 specific options</h3>
3461
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_rack_and_rails_gt_3_specific_options" data-comment-topic="rack-specific-options-13yvdxs">6.12. Rack and Rails &gt;= 3 specific options</h3>
3536
3462
  <div class="sect3">
3537
- <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">5.12.1. rack_env &lt;string&gt;</h4>
3463
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="RackEnv" data-comment-topic="rack-env-string--tqmrt0">6.12.1. rack_env &lt;string&gt;</h4>
3538
3464
  <div class="paragraph"><p>This option allows one to specify the default <span class="monospaced">RACK_ENV</span> value.</p></div>
3539
3465
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
3540
- <div class="ulist"><ul>
3466
+ <div class="ulist"><ul>
3541
3467
  <li>
3542
3468
  <p>
3543
3469
  In the <em>http</em> configuration block.
@@ -3563,23 +3489,23 @@ In an <em>if</em> configuration scope.
3563
3489
  </div>
3564
3490
  </div>
3565
3491
  <div class="sect2">
3566
- <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">5.13. Deprecated options</h3>
3492
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_deprecated_options" data-comment-topic="deprecated-options-1dtzo0g">6.13. Deprecated options</h3>
3567
3493
  <div class="paragraph"><p>The following options have been deprecated, but are still supported for backwards
3568
3494
  compatibility reasons.</p></div>
3569
3495
  <div class="sect3">
3570
- <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">5.13.1. rails_spawn_method</h4>
3496
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_rails_spawn_method" data-comment-topic="rails-spawn-method-17vdnpt">6.13.1. rails_spawn_method</h4>
3571
3497
  <div class="paragraph"><p>Deprecated in favor of <a href="#PassengerSpawnMethod">passenger_spawn_method</a>.</p></div>
3572
3498
  </div>
3573
3499
  </div>
3574
3500
  </div>
3575
3501
  </div>
3576
3502
  <div class="sect1">
3577
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_analysis_and_system_maintenance"></span><h2 data-comment-topic="analysis-and-system-maintenance-1nnlnj8" data-anchor="_analysis_and_system_maintenance">6. Analysis and system maintenance</h2>
3503
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h2 id="_analysis_and_system_maintenance" data-comment-topic="analysis-and-system-maintenance-1nnlnj8">7. Analysis and system maintenance</h2>
3578
3504
  <div class="sectionbody">
3579
3505
  <div class="paragraph"><p>Phusion Passenger provides a set of tools, which are useful for system analysis,
3580
3506
  maintenance and troubleshooting.</p></div>
3581
3507
  <div class="sect2">
3582
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_inspecting_memory_usage"></span><h3 data-comment-topic="inspecting-memory-usage-1k6y8v0" data-anchor="_inspecting_memory_usage">6.1. Inspecting memory usage</h3>
3508
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_inspecting_memory_usage" data-comment-topic="inspecting-memory-usage-1k6y8v0">7.1. Inspecting memory usage</h3>
3583
3509
  <div class="paragraph"><p>Process inspection tools such as <span class="monospaced">ps</span> and <span class="monospaced">top</span> are useful, but they
3584
3510
  <a href="http://groups.google.com/group/phusion-passenger/msg/1fd1c233456d3180">rarely show the correct memory usage</a>.
3585
3511
  The real memory usage is usually lower than what <span class="monospaced">ps</span> and <span class="monospaced">top</span> report.</p></div>
@@ -3621,18 +3547,18 @@ we see that all the Apache worker processes only take less than 1 MB memory each
3621
3547
  This is a lot less than the 50 MB-ish memory usage as shown in the <em>VMSize</em> column
3622
3548
  (which is what a lot of people think is the real memory usage, but is actually not).</p></div>
3623
3549
  <div class="admonitionblock">
3624
- <table><tr>
3550
+ <table><tr>
3625
3551
  <td class="icon">
3626
- <img src="./images/icons/note.png" alt="Note">
3552
+ <img src="./images/icons/note.png" alt="Note">
3627
3553
  </td>
3628
3554
  <td class="content">Private dirty RSS reporting only works on Linux. Unfortunately other operating systems
3629
3555
  don’t provide facilities for determining processes' private dirty RSS. On non-Linux systems,
3630
3556
  the Resident Set Size is reported instead.</td>
3631
- </tr></table>
3557
+ </tr></table>
3632
3558
  </div>
3633
3559
  </div>
3634
3560
  <div class="sect2">
3635
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_inspecting_phusion_passenger_8217_s_internal_status"></span><h3 data-comment-topic="inspecting-phusion-passenger-s-internal-status-v36wbc" data-anchor="_inspecting_phusion_passenger_8217_s_internal_status">6.2. Inspecting Phusion Passenger’s internal status</h3>
3561
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_inspecting_phusion_passenger_8217_s_internal_status" data-comment-topic="inspecting-phusion-passenger-s-internal-status-v36wbc">7.2. Inspecting Phusion Passenger’s internal status</h3>
3636
3562
  <div class="paragraph"><p>One can inspect Phusion Passenger’s internal status with the tool <span class="monospaced">passenger-status</span>.
3637
3563
  This tool must typically be run as root. For example:</p></div>
3638
3564
  <div class="listingblock">
@@ -3650,7 +3576,7 @@ inactive = 1
3650
3576
  </div>
3651
3577
  </div>
3652
3578
  <div class="paragraph"><p>The <em>general information</em> section shows the following information:</p></div>
3653
- <div class="dlist"><dl>
3579
+ <div class="dlist"><dl>
3654
3580
  <dt class="hdlist1">
3655
3581
  max
3656
3582
  </dt>
@@ -3694,7 +3620,7 @@ time). The value of <em>inactive</em> equals <span class="monospaced">count - ac
3694
3620
  </dl></div>
3695
3621
  <div class="paragraph"><p>The <em>domains</em> section shows, for each application directory, information about running
3696
3622
  application instances:</p></div>
3697
- <div class="dlist"><dl>
3623
+ <div class="dlist"><dl>
3698
3624
  <dt class="hdlist1">
3699
3625
  Sessions
3700
3626
  </dt>
@@ -3747,7 +3673,7 @@ sessions compared to the others, then there might be a problem:</p></div>
3747
3673
  </div>
3748
3674
  </div>
3749
3675
  <div class="paragraph"><p>Possible reasons why spikes can occur:</p></div>
3750
- <div class="olist arabic"><ol class="arabic">
3676
+ <div class="olist arabic"><ol class="arabic">
3751
3677
  <li>
3752
3678
  <p>
3753
3679
  Your application is busy processing a request that takes a very long time.
@@ -3764,7 +3690,7 @@ Your application is frozen, i.e. has stopped responding. See
3764
3690
  </ol></div>
3765
3691
  </div>
3766
3692
  <div class="sect2">
3767
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="debugging_frozen"></span><h3 data-comment-topic="debugging-frozen-applications-qoctl8" data-anchor="debugging_frozen">6.3. Debugging frozen applications</h3>
3693
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="debugging_frozen" data-comment-topic="debugging-frozen-applications-qoctl8">7.3. Debugging frozen applications</h3>
3768
3694
  <div class="paragraph"><p>If one of your application instances is frozen (stopped responding), then you
3769
3695
  can figure out where it is frozen by killing it with <em>SIGABRT</em>. This will cause the
3770
3696
  application to raise an exception, with a backtrace.</p></div>
@@ -3776,22 +3702,22 @@ This is the case with Ruby on Rails. So if you kill a Ruby on Rails application
3776
3702
  running it in a <em>production</em> environment). If you don’t see a backtrace there, check
3777
3703
  the Apache error log.</p></div>
3778
3704
  <div class="admonitionblock">
3779
- <table><tr>
3705
+ <table><tr>
3780
3706
  <td class="icon">
3781
- <img src="./images/icons/note.png" alt="Note">
3707
+ <img src="./images/icons/note.png" alt="Note">
3782
3708
  </td>
3783
3709
  <td class="content">It is safe to kill application instances, even in live environments. Phusion Passenger
3784
3710
  will restart killed application instances, as if nothing bad happened.</td>
3785
- </tr></table>
3711
+ </tr></table>
3786
3712
  </div>
3787
3713
  </div>
3788
3714
  <div class="sect2">
3789
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_accessing_individual_application_processes"></span><h3 data-comment-topic="accessing-individual-application-processes-1qe4fqk" data-anchor="_accessing_individual_application_processes">6.4. Accessing individual application processes</h3>
3715
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_accessing_individual_application_processes" data-comment-topic="accessing-individual-application-processes-1qe4fqk">7.4. Accessing individual application processes</h3>
3790
3716
  <div class="paragraph"><p>When a request is sent to the web server, Phusion Passenger will automatically forward
3791
3717
  the request to the most suitable application process, but sometimes it is desirable to
3792
3718
  be able to directly access the individual application processes. Use cases include, but
3793
3719
  are not limited to:</p></div>
3794
- <div class="ulist"><ul>
3720
+ <div class="ulist"><ul>
3795
3721
  <li>
3796
3722
  <p>
3797
3723
  One wants to debug a memory leak or memory bloat problem that only seems to appear on
@@ -3852,17 +3778,16 @@ through the <em>X-Passenger-Connect-Password</em> HTTP header, like this:</p></d
3852
3778
  </div>
3853
3779
  </div>
3854
3780
  <div class="sect2">
3855
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_attaching_an_irb_console_to_an_application_process"></span><h3 data-comment-topic="attaching-an-irb-console-to-an-application-process-d36enw" data-anchor="_attaching_an_irb_console_to_an_application_process">6.5. Attaching an IRB console to an application process</h3>
3856
- <div class="paragraph"><p><strong>Available in Phusion Passenger Enterprise since version 3.0.0.</strong></p></div>
3781
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_attaching_an_irb_console_to_an_application_process" data-comment-topic="attaching-an-irb-console-to-an-application-process-d36enw">7.5. Attaching an IRB console to an application process</h3>
3857
3782
  <div class="paragraph"><p>You can attach an IRB console to any application process and inspect its state by executing arbitrary Ruby code. Do this by invoking <span class="monospaced">passenger-irb &lt;PID&gt;</span> where <em>&lt;PID&gt;</em> is the PID of the application process you wish to inspect. Note that the IRB console is currently only available for Ruby apps, not for apps in any other languages.</p></div>
3858
3783
  </div>
3859
3784
  </div>
3860
3785
  </div>
3861
3786
  <div class="sect1">
3862
- <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">7. Tips</h2>
3787
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h2 id="_tips" data-comment-topic="tips-n4c22d">8. Tips</h2>
3863
3788
  <div class="sectionbody">
3864
3789
  <div class="sect2">
3865
- <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">7.1. User switching (security)</h3>
3790
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="user_switching" data-comment-topic="user-switching-security--zmsy9o">8.1. User switching (security)</h3>
3866
3791
  <div class="paragraph"><p>There is a problem that plagues most PHP web hosts, namely the fact that all PHP
3867
3792
  applications are run in the same user context as the web server. So for
3868
3793
  example, Joe’s PHP application will be able to read Jane’s PHP application’s
@@ -3874,7 +3799,7 @@ So if <em>/home/webapps/foo/config/environment.rb</em> is owned by <em>joe</em>,
3874
3799
  Passenger will launch the corresponding Rails application as <em>joe</em> as well.</p></div>
3875
3800
  <div class="paragraph"><p>This behavior is the default, and you don’t need to configure anything. But
3876
3801
  there are things that you should keep in mind:</p></div>
3877
- <div class="ulist"><ul>
3802
+ <div class="ulist"><ul>
3878
3803
  <li>
3879
3804
  <p>
3880
3805
  The owner of <em>environment.rb</em>/<em>config.ru</em> must have read access to the application’s
@@ -3902,14 +3827,14 @@ Under no circumstances will applications be run as <em>root</em>. If
3902
3827
  option.</p></div>
3903
3828
  </div>
3904
3829
  <div class="sect2">
3905
- <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">7.2. Reducing memory consumption of Ruby on Rails applications by 33%</h3>
3830
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="reducing_memory_usage" data-comment-topic="reducing-memory-consumption-of-ruby-on-rails-applications-by-33--1o3z66q">8.2. Reducing memory consumption of Ruby on Rails applications by 33%</h3>
3906
3831
  <div class="paragraph"><p>Is it possible to reduce memory consumption of your Rails applications by 33% on average,
3907
3832
  by using <a href="http://www.rubyenterpriseedition.com/">Ruby Enterprise Edition</a>.
3908
3833
  Please visit the website for details.</p></div>
3909
3834
  <div class="paragraph"><p>Note that this feature does not apply to Rack applications.</p></div>
3910
3835
  </div>
3911
3836
  <div class="sect2">
3912
- <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">7.3. Capistrano recipe</h3>
3837
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="capistrano" data-comment-topic="capistrano-recipe-pfn4qu">8.3. Capistrano recipe</h3>
3913
3838
  <div class="paragraph"><p>Phusion Passenger can be combined with <a href="http://capify.org/">Capistrano</a>.
3914
3839
  The following Capistrano recipe demonstrates Phusion Passenger support.
3915
3840
  It assumes that you’re using Git as version control system.</p></div>
@@ -3944,10 +3869,10 @@ end</pre>
3944
3869
  </div>
3945
3870
  </div>
3946
3871
  <div class="sect2">
3947
- <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">7.4. Bundler support</h3>
3872
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="bundler_support" data-comment-topic="bundler-support-19v1h43">8.4. Bundler support</h3>
3948
3873
  <div class="paragraph"><p>Phusion Passenger has automatic support for <a href="http://gembundler.com/git.html">Bundler</a>.
3949
3874
  It works as follows:</p></div>
3950
- <div class="ulist"><ul>
3875
+ <div class="ulist"><ul>
3951
3876
  <li>
3952
3877
  <p>
3953
3878
  If you have a <em>.bundle/environment.rb</em> in your application root, then Phusion
@@ -3977,10 +3902,10 @@ the application startup file. In this file you can do whatever you need to setup
3977
3902
  or a similar system.</p></div>
3978
3903
  </div>
3979
3904
  <div class="sect2">
3980
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="moving_phusion_passenger"></span><h3 data-comment-topic="moving-phusion-passenger-to-a-different-directory-1hel5cp" data-anchor="moving_phusion_passenger">7.5. Moving Phusion Passenger to a different directory</h3>
3905
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="moving_phusion_passenger" data-comment-topic="moving-phusion-passenger-to-a-different-directory-1hel5cp">8.5. Moving Phusion Passenger to a different directory</h3>
3981
3906
  <div class="paragraph"><p>It is possible to relocate the Phusion Passenger files to a different directory. It
3982
3907
  involves two steps:</p></div>
3983
- <div class="olist arabic"><ol class="arabic">
3908
+ <div class="olist arabic"><ol class="arabic">
3984
3909
  <li>
3985
3910
  <p>
3986
3911
  Moving the directory.
@@ -3994,7 +3919,7 @@ Updating the “PassengerRoot” configuration option in Apache.
3994
3919
  </ol></div>
3995
3920
  <div class="paragraph"><p>For example, if Phusion Passenger is located in <em>/opt/passenger/</em>, and you’d like to
3996
3921
  move it to <em>/usr/local/passenger/</em>, then do this:</p></div>
3997
- <div class="olist arabic"><ol class="arabic">
3922
+ <div class="olist arabic"><ol class="arabic">
3998
3923
  <li>
3999
3924
  <p>
4000
3925
  Run the following command:
@@ -4018,7 +3943,7 @@ Edit your Apache configuration file, and set:
4018
3943
  </ol></div>
4019
3944
  </div>
4020
3945
  <div class="sect2">
4021
- <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">7.6. Installing multiple Ruby on Rails versions</h3>
3946
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_installing_multiple_ruby_on_rails_versions" data-comment-topic="installing-multiple-ruby-on-rails-versions-1bp1fff">8.6. Installing multiple Ruby on Rails versions</h3>
4022
3947
  <div class="paragraph"><p>Each Ruby on Rails applications that are going to be deployed may require a
4023
3948
  specific Ruby on Rails version. You can install a specific version with
4024
3949
  this command:</p></div>
@@ -4032,7 +3957,7 @@ this command:</p></div>
4032
3957
  other. Phusion Passenger will automatically make use of the correct version.</p></div>
4033
3958
  </div>
4034
3959
  <div class="sect2">
4035
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_making_the_application_restart_after_each_request"></span><h3 data-comment-topic="making-the-application-restart-after-each-request-vimy48" data-anchor="_making_the_application_restart_after_each_request">7.7. Making the application restart after each request</h3>
3960
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_making_the_application_restart_after_each_request" data-comment-topic="making-the-application-restart-after-each-request-vimy48">8.7. Making the application restart after each request</h3>
4036
3961
  <div class="paragraph"><p>In some situations it might be desirable to restart the web application after
4037
3962
  each request, for example when developing a non-Rails application that doesn’t
4038
3963
  support code reloading, or when developing a web framework.</p></div>
@@ -4041,9 +3966,9 @@ application’s root folder. Unlike <em>restart.txt</em>, Phusion Passenger does
4041
3966
  check for this file’s timestamp: Phusion Passenger will always restart the
4042
3967
  application, as long as <em>always_restart.txt</em> exists.</p></div>
4043
3968
  <div class="admonitionblock">
4044
- <table><tr>
3969
+ <table><tr>
4045
3970
  <td class="icon">
4046
- <img src="./images/icons/note.png" alt="Note">
3971
+ <img src="./images/icons/note.png" alt="Note">
4047
3972
  </td>
4048
3973
  <td class="content">If you’re just developing a Rails application then you probably don’t need
4049
3974
  this feature. If you set <em>RailsEnv development</em> in your Apache configuration,
@@ -4051,11 +3976,11 @@ then Rails will automatically reload your application code after each request.
4051
3976
  <em>always_restart.txt</em> is only useful if you’re working on Ruby on Rails itself,
4052
3977
  or when you’re not developing a Rails application and your web framework
4053
3978
  does not support code reloading.</td>
4054
- </tr></table>
3979
+ </tr></table>
4055
3980
  </div>
4056
3981
  </div>
4057
3982
  <div class="sect2">
4058
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="sub_uri_deployment_uri_fix"></span><h3 data-comment-topic="how-to-fix-broken-images-css-javascript-uris-in-sub-uri-deployments-11mzwt6" data-anchor="sub_uri_deployment_uri_fix">7.8. How to fix broken images/CSS/JavaScript URIs in sub-URI deployments</h3>
3983
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="sub_uri_deployment_uri_fix" data-comment-topic="how-to-fix-broken-images-css-javascript-uris-in-sub-uri-deployments-11mzwt6">8.8. How to fix broken images/CSS/JavaScript URIs in sub-URI deployments</h3>
4059
3984
  <div class="paragraph"><p>Some people experience broken images and other broken static assets when they
4060
3985
  deploy their application to a sub-URI (i.e. <em>http://mysite.com/railsapp/</em>).
4061
3986
  The reason for this usually is that you used a
@@ -4095,13 +4020,13 @@ please refer to
4095
4020
  </div>
4096
4021
  </div>
4097
4022
  <div class="sect1">
4098
- <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">8. Under the hood</h2>
4023
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h2 id="_under_the_hood" data-comment-topic="under-the-hood-8uney">9. Under the hood</h2>
4099
4024
  <div class="sectionbody">
4100
4025
  <div class="paragraph"><p>Phusion Passenger hides a lot of complexity for the end user (i.e. the web server
4101
4026
  system administrator), but sometimes it is desirable to know what is going on.
4102
4027
  This section describes a few things that Phusion Passenger does under the hood.</p></div>
4103
4028
  <div class="sect2">
4104
- <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">8.1. Page caching support</h3>
4029
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_page_caching_support" data-comment-topic="page-caching-support-nafhf6">9.1. Page caching support</h3>
4105
4030
  <div class="paragraph"><p>For each HTTP request, Phusion Passenger will automatically look for a corresponding
4106
4031
  page cache file, and serve that if it exists. It does this by appending ".html" to
4107
4032
  the filename that the URI normally maps to, and checking whether that file exists.
@@ -4109,7 +4034,7 @@ This check occurs after checking whether the original mapped filename exists (as
4109
4034
  of static asset serving). All this is done without the need for special mod_rewrite
4110
4035
  rules.</p></div>
4111
4036
  <div class="paragraph"><p>For example, suppose that the browser requests <em>/foo/bar</em>.</p></div>
4112
- <div class="olist arabic"><ol class="arabic">
4037
+ <div class="olist arabic"><ol class="arabic">
4113
4038
  <li>
4114
4039
  <p>
4115
4040
  Phusion Passenger will first check whether this URI maps to a static file, i.e.
@@ -4137,7 +4062,7 @@ the <em>public</em> directory. In that case you’ll need to use mod_rewrite to
4137
4062
  page cache files.</p></div>
4138
4063
  </div>
4139
4064
  <div class="sect2">
4140
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="application_detection"></span><h3 data-comment-topic="how-phusion-passenger-detects-whether-a-virtual-host-is-a-web-application-13qbmhn" data-anchor="application_detection">8.2. How Phusion Passenger detects whether a virtual host is a web application</h3>
4065
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="application_detection" data-comment-topic="how-phusion-passenger-detects-whether-a-virtual-host-is-a-web-application-13qbmhn">9.2. How Phusion Passenger detects whether a virtual host is a web application</h3>
4141
4066
  <div class="paragraph"><p>After you’ve read the deployment instructions you might wonder how Phusion Passenger
4142
4067
  knows that the server root points to a web application that Phusion Passenger is
4143
4068
  able to serve, and how it knows what kind of web application it is (e.g. Rails or Rack).</p></div>
@@ -4150,7 +4075,7 @@ whether the following file exists:</p></div>
4150
4075
  </div>
4151
4076
  <div class="paragraph"><p>If you’re not a programmer and don’t understand the above pseudo-code snippet, it means
4152
4077
  that Phusion Passenger will:</p></div>
4153
- <div class="olist arabic"><ol class="arabic">
4078
+ <div class="olist arabic"><ol class="arabic">
4154
4079
  <li>
4155
4080
  <p>
4156
4081
  Extract the parent directory filename from the value of the “root” directive.
@@ -4178,30 +4103,28 @@ Phusion Passenger will look for <em>config.ru</em> instead of <em>config/environ
4178
4103
  </div>
4179
4104
  </div>
4180
4105
  <div class="sect1">
4181
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_appendix_a_about_this_document"></span><h2 data-comment-topic="appendix-a-about-this-document-zfvixm" data-anchor="_appendix_a_about_this_document">9. Appendix A: About this document</h2>
4106
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h2 id="_appendix_a_about_this_document" data-comment-topic="appendix-a-about-this-document-zfvixm">10. Appendix A: About this document</h2>
4182
4107
  <div class="sectionbody">
4183
4108
  <div class="paragraph"><p>The text of this document is licensed under the
4184
4109
  <a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons
4185
4110
  Attribution-Share Alike 3.0 Unported License</a>.</p></div>
4186
4111
  <div class="paragraph"><p><span class="image">
4187
4112
  <a class="image" href="http://creativecommons.org/licenses/by-sa/3.0/">
4188
- <img src="images/by_sa.png" alt="images/by_sa.png">
4189
- </a>
4113
+ <img src="images/by_sa.png" alt="images/by_sa.png"></a>
4190
4114
  </span></p></div>
4191
4115
  <div class="paragraph"><p>Phusion Passenger is brought to you by <a href="http://www.phusion.nl/">Phusion</a>.</p></div>
4192
4116
  <div class="paragraph"><p><span class="image">
4193
4117
  <a class="image" href="http://www.phusion.nl/">
4194
- <img src="images/phusion_banner.png" alt="images/phusion_banner.png">
4195
- </a>
4118
+ <img src="images/phusion_banner.png" alt="images/phusion_banner.png"></a>
4196
4119
  </span></p></div>
4197
4120
  <div class="paragraph"><p>Phusion Passenger is a trademark of Hongli Lai &amp; Ninh Bui.</p></div>
4198
4121
  </div>
4199
4122
  </div>
4200
4123
  <div class="sect1">
4201
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_appendix_b_terminology"></span><h2 data-comment-topic="appendix-b-terminology-wzv5ro" data-anchor="_appendix_b_terminology">10. Appendix B: Terminology</h2>
4124
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h2 id="_appendix_b_terminology" data-comment-topic="appendix-b-terminology-wzv5ro">11. Appendix B: Terminology</h2>
4202
4125
  <div class="sectionbody">
4203
4126
  <div class="sect2">
4204
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="application_root"></span><h3 data-comment-topic="application-root-1fd6bqv" data-anchor="application_root">10.1. Application root</h3>
4127
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="application_root" data-comment-topic="application-root-1fd6bqv">11.1. Application root</h3>
4205
4128
  <div class="paragraph"><p>The root directory of an application that’s served by Phusion Passenger.</p></div>
4206
4129
  <div class="paragraph"><p>In case of Ruby on Rails applications, this is the directory that contains
4207
4130
  <em>Rakefile</em>, <em>app/</em>, <em>config/</em>, <em>public/</em>, etc. In other words, the directory
@@ -4263,17 +4186,17 @@ For example, take the following directory structure:</p></div>
4263
4186
  </div>
4264
4187
  </div>
4265
4188
  <div class="sect2">
4266
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="idle_process"></span><h3 data-comment-topic="idle-process-13byfw9" data-anchor="idle_process">10.2. Idle process</h3>
4189
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="idle_process" data-comment-topic="idle-process-13byfw9">11.2. Idle process</h3>
4267
4190
  <div class="paragraph"><p>An "idle process" refers to a process that hasn’t processed any requests for a while.</p></div>
4268
4191
  </div>
4269
4192
  <div class="sect2">
4270
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="inactive_process"></span><h3 data-comment-topic="inactive-process-1d2h0po" data-anchor="inactive_process">10.3. Inactive process</h3>
4193
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="inactive_process" data-comment-topic="inactive-process-1d2h0po">11.3. Inactive process</h3>
4271
4194
  <div class="paragraph"><p>An "inactive process" refers to a process that’s current not processing any requests. An idle process is always inactive, but an inactive process is not always considered idle.</p></div>
4272
4195
  </div>
4273
4196
  </div>
4274
4197
  </div>
4275
4198
  <div class="sect1">
4276
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="spawning_methods_explained"></span><h2 data-comment-topic="appendix-c-spawning-methods-explained-tcp8e6" data-anchor="spawning_methods_explained">11. Appendix C: Spawning methods explained</h2>
4199
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h2 id="spawning_methods_explained" data-comment-topic="appendix-c-spawning-methods-explained-tcp8e6">12. Appendix C: Spawning methods explained</h2>
4277
4200
  <div class="sectionbody">
4278
4201
  <div class="paragraph"><p>At its core, Phusion Passenger is an HTTP proxy and process manager. It spawns
4279
4202
  Ruby on Rails/Rack/WSGI worker processes (which may also be referred to as
@@ -4283,7 +4206,7 @@ processes.</p></div>
4283
4206
  Let’s go over the different spawning methods. For simplicity’s sake, let’s
4284
4207
  assume that we’re only talking about Ruby on Rails applications.</p></div>
4285
4208
  <div class="sect2">
4286
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_the_most_straightforward_and_traditional_way_conservative_spawning"></span><h3 data-comment-topic="the-most-straightforward-and-traditional-way-conservative-spawning-civ29z" data-anchor="_the_most_straightforward_and_traditional_way_conservative_spawning">11.1. The most straightforward and traditional way: conservative spawning</h3>
4209
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_the_most_straightforward_and_traditional_way_direct_spawning" data-comment-topic="the-most-straightforward-and-traditional-way-conservative-spawning-civ29z">12.1. The most straightforward and traditional way: direct spawning</h3>
4287
4210
  <div class="paragraph"><p>Phusion Passenger could create a new Ruby process, which will then load the
4288
4211
  Rails application along with the entire Rails framework. This process will then
4289
4212
  enter an request handling main loop.</p></div>
@@ -4292,7 +4215,7 @@ familiar with the Mongrel application server, then this approach is exactly
4292
4215
  what mongrel_cluster performs: it creates N worker processes, each which loads
4293
4216
  a full copy of the Rails application and the Rails framework in memory. The Thin
4294
4217
  application server employs pretty much the same approach.</p></div>
4295
- <div class="paragraph"><p>Note that Phusion Passenger’s version of conservative spawning differs slightly
4218
+ <div class="paragraph"><p>Note that Phusion Passenger’s version of direct spawning differs slightly
4296
4219
  from mongrel_cluster. Mongrel_cluster creates entirely new Ruby processes. In
4297
4220
  programmers jargon, mongrel_cluster creates new Ruby processes by forking the
4298
4221
  current process and exec()-ing a new Ruby interpreter. Phusion Passenger on the
@@ -4300,31 +4223,29 @@ other hand creates processes that reuse the already loaded Ruby interpreter. In
4300
4223
  programmers jargon, Phusion Passenger calls fork(), but not exec().</p></div>
4301
4224
  </div>
4302
4225
  <div class="sect2">
4303
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_the_smart_spawning_method"></span><h3 data-comment-topic="the-smart-spawning-method-7nhgtj" data-anchor="_the_smart_spawning_method">11.2. The smart spawning method</h3>
4226
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_the_smart_spawning_method" data-comment-topic="the-smart-spawning-method-7nhgtj">12.2. The smart spawning method</h3>
4304
4227
  <div class="admonitionblock">
4305
- <table><tr>
4228
+ <table><tr>
4306
4229
  <td class="icon">
4307
- <img src="./images/icons/note.png" alt="Note">
4230
+ <img src="./images/icons/note.png" alt="Note">
4308
4231
  </td>
4309
4232
  <td class="content">Smart spawning is supported for all Ruby applications but not for WSGI applications.</td>
4310
- </tr></table>
4233
+ </tr></table>
4311
4234
  </div>
4312
- <div class="paragraph"><p>While conservative spawning works well, it’s not as efficient as it could be
4235
+ <div class="paragraph"><p>While direct spawning works well, it’s not as efficient as it could be
4313
4236
  because each worker process has its own private copy of the Rails application
4314
4237
  as well as the Rails framework. This wastes memory as well as startup time.</p></div>
4315
4238
  <div class="paragraph"><p><span class="image">
4316
- <img src="images/conservative_spawning.png" alt="Worker processes and conservative spawning">
4317
- </span><br>
4318
- <em>Figure: Worker processes and conservative spawning. Each worker process has its
4239
+ <img src="images/direct_spawning.png" alt="Worker processes and direct spawning"></span><br><em>Figure: Worker processes and direct spawning. Each worker process has its
4319
4240
  own private copy of the application code and Rails framework code.</em></p></div>
4320
4241
  <div class="paragraph"><p>It is possible to make the different worker processes share the memory occupied
4321
4242
  by application and Rails framework code, by utilizing so-called
4322
4243
  copy-on-write semantics of the virtual memory system on modern operating
4323
4244
  systems. As a side effect, the startup time is also reduced. This is technique
4324
- is exploited by Phusion Passenger’s <em>smart</em> and <em>smart-lv2</em> spawn methods.</p></div>
4245
+ is exploited by Phusion Passenger’s <em>smart</em> spawn method.</p></div>
4325
4246
  <div class="sect3">
4326
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_how_it_works"></span><h4 data-comment-topic="how-it-works-f9umga" data-anchor="_how_it_works">11.2.1. How it works</h4>
4327
- <div class="paragraph"><p>When the <em>smart-lv2</em> spawn method is being used, Phusion Passenger will first
4247
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_how_it_works" data-comment-topic="how-it-works-f9umga">12.2.1. How it works</h4>
4248
+ <div class="paragraph"><p>When the <em>smart</em> spawn method is being used, Phusion Passenger will first
4328
4249
  create a so-called <em>ApplicationSpawner server</em> process. This process loads the
4329
4250
  entire Rails application along with the Rails framework, by loading
4330
4251
  <em>environment.rb</em>. Then, whenever Phusion Passenger needs a new worker process,
@@ -4339,24 +4260,13 @@ processes will share as much common
4339
4260
  memory as possible. That is, they will all share the same application and Rails
4340
4261
  framework code.</p></div>
4341
4262
  <div class="paragraph"><p><span class="image">
4342
- <img src="images/smart-lv2.png" alt="images/smart-lv2.png">
4343
- </span><br>
4344
- <em>Figure: Worker processes and the smart-lv2 spawn method. All worker processes,
4263
+ <img src="images/smart.png" alt="images/smart.png"></span><br><em>Figure: Worker processes and the smart spawn method. All worker processes,
4345
4264
  as well as the ApplicationSpawner, share the same application code and Rails
4346
4265
  framework code.</em></p></div>
4347
- <div class="paragraph"><p>The <em>smart</em> spawn method goes even further, by caching the Rails framework in
4348
- another process called the <em>FrameworkSpawner server</em>. This process only loads
4349
- the Rails framework, not the application. When a FrameworkSpawner server is
4350
- instructed to create a new worker process, it will create a new
4351
- ApplicationSpawner to which the instruction will be delegated. All those
4352
- ApplicationSpawner servers, as well as all worker processes created by those
4353
- ApplicationSpawner servers, will share the same Rails framework code.</p></div>
4354
- <div class="paragraph"><p>The <em>smart-lv2</em> method allows different worker processes that belong to the same
4355
- application to share memory. The <em>smart</em> method allows different worker
4356
- processes - that happen to use the same Rails version - to share memory, even if
4357
- they don’t belong to the same application.</p></div>
4266
+ <div class="paragraph"><p>The <em>smart</em> method allows different worker processes that belong to the same
4267
+ application to share memory.</p></div>
4358
4268
  <div class="paragraph"><p>Notes:</p></div>
4359
- <div class="ulist"><ul>
4269
+ <div class="ulist"><ul>
4360
4270
  <li>
4361
4271
  <p>
4362
4272
  Vendored Rails frameworks cannot be shared by different applications, even if
@@ -4366,53 +4276,32 @@ Vendored Rails frameworks cannot be shared by different applications, even if
4366
4276
  </li>
4367
4277
  <li>
4368
4278
  <p>
4369
- ApplicationSpawner and FrameworkSpawner servers have an idle timeout just
4370
- like worker processes. If an ApplicationSpawner/FrameworkSpawner server hasn’t
4371
- been instructed to do anything for a while, it will be shutdown in order to
4372
- conserve memory. This idle timeout is configurable.
4279
+ ApplicationSpawner servers have an idle timeout just like worker processes.
4280
+ If an ApplicationSpawner/FrameworkSpawner server hasn’t been instructed to do
4281
+ anything for a while, it will be shutdown in order to conserve memory. This
4282
+ idle timeout is configurable.
4373
4283
  </p>
4374
4284
  </li>
4375
4285
  </ul></div>
4376
4286
  </div>
4377
4287
  <div class="sect3">
4378
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_summary_of_benefits"></span><h4 data-comment-topic="summary-of-benefits-qovyvk" data-anchor="_summary_of_benefits">11.2.2. Summary of benefits</h4>
4288
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_summary_of_benefits" data-comment-topic="summary-of-benefits-qovyvk">12.2.2. Summary of benefits</h4>
4379
4289
  <div class="paragraph"><p>Suppose that Phusion Passenger needs a new worker process for an application
4380
4290
  that uses Rails 2.2.1.</p></div>
4381
- <div class="ulist"><ul>
4382
- <li>
4383
- <p>
4384
- If the <em>smart-lv2</em> spawning method is used, and an ApplicationSpawner server
4385
- for this application is already running, then worker process creation time is
4386
- about 10 times faster than conservative spawning. This worker process will also
4387
- share application and Rails framework code memory with the ApplicationSpawner
4388
- server and the worker processes that had been spawned by this ApplicationSpawner
4389
- server.
4390
- </p>
4391
- </li>
4392
- <li>
4393
- <p>
4394
- If the <em>smart</em> spawning method is used, and a FrameworkSpawner server for
4395
- Rails 2.2.1 is already running, but no ApplicationSpawner server for this
4396
- application is running, then worker process creation time is about 2 times
4397
- faster than conservative spawning. If there is an ApplicationSpawner server
4398
- for this application running, then worker process creation time is about 10
4399
- times faster. This worker process will also share application and Rails
4400
- framework code memory with the ApplicationSpawner and FrameworkSpawner
4401
- servers.
4402
- </p>
4403
- </li>
4404
- </ul></div>
4405
- <div class="paragraph"><p>You could compare ApplicationSpawner and FrameworkSpawner servers with stem
4406
- cells, that have the ability to quickly change into more specific cells (worker
4407
- process).</p></div>
4408
- <div class="paragraph"><p>In practice, the smart spawning methods could mean a memory saving of about 33%,
4291
+ <div class="paragraph"><p>If the <em>smart</em> spawning method is used, and an ApplicationSpawner server
4292
+ for this application is already running, then worker process creation time is
4293
+ about 10 times faster than direct spawning. This worker process will also
4294
+ share application and Rails framework code memory with the ApplicationSpawner
4295
+ server and the worker processes that had been spawned by this ApplicationSpawner
4296
+ server.</p></div>
4297
+ <div class="paragraph"><p>In practice, the smart spawning method could mean a memory saving of about 33%,
4409
4298
  assuming that your Ruby interpreter is <a href="#reducing_memory_usage">copy-on-write friendly</a>.</p></div>
4410
4299
  <div class="paragraph"><p>Of course, smart spawning is not without gotchas. But if you understand the
4411
4300
  gotchas you can easily reap the benefits of smart spawning.</p></div>
4412
4301
  </div>
4413
4302
  </div>
4414
4303
  <div class="sect2">
4415
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_smart_spawning_gotcha_1_unintentional_file_descriptor_sharing"></span><h3 data-comment-topic="smart-spawning-gotcha-1-unintentional-file-descriptor-sharing-cebw6q" data-anchor="_smart_spawning_gotcha_1_unintentional_file_descriptor_sharing">11.3. Smart spawning gotcha #1: unintentional file descriptor sharing</h3>
4304
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_smart_spawning_gotcha_1_unintentional_file_descriptor_sharing" data-comment-topic="smart-spawning-gotcha-1-unintentional-file-descriptor-sharing-cebw6q">12.3. Smart spawning gotcha #1: unintentional file descriptor sharing</h3>
4416
4305
  <div class="paragraph"><p>Because worker processes are created by forking from an ApplicationSpawner
4417
4306
  server, it will share all file descriptors that are opened by the
4418
4307
  ApplicationSpawner server. (This is part of the semantics of the Unix
@@ -4438,7 +4327,7 @@ http://www.gnu.org/software/src-highlite -->
4438
4327
  <span style="font-style: italic"><span style="color: #9A1900"># We're in smart spawning mode.</span></span>
4439
4328
  <span style="color: #990000">...</span> code to reestablish socket connections here <span style="color: #990000">...</span>
4440
4329
  <span style="font-weight: bold"><span style="color: #0000FF">else</span></span>
4441
- <span style="font-style: italic"><span style="color: #9A1900"># We're in conservative spawning mode. We don't need to do anything.</span></span>
4330
+ <span style="font-style: italic"><span style="color: #9A1900"># We're in direct spawning mode. We don't need to do anything.</span></span>
4442
4331
  <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
4443
4332
  <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
4444
4333
  <span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre>
@@ -4448,7 +4337,7 @@ http://www.gnu.org/software/src-highlite -->
4448
4337
  database upon creating a new worker process, which is why you normally do not
4449
4338
  encounter any database issues when using smart spawning mode.</p></div>
4450
4339
  <div class="sect3">
4451
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_example_1_memcached_connection_sharing_harmful"></span><h4 data-comment-topic="example-1-memcached-connection-sharing-harmful--1wfs3ad" data-anchor="_example_1_memcached_connection_sharing_harmful">11.3.1. Example 1: Memcached connection sharing (harmful)</h4>
4340
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_example_1_memcached_connection_sharing_harmful" data-comment-topic="example-1-memcached-connection-sharing-harmful--1wfs3ad">12.3.1. Example 1: Memcached connection sharing (harmful)</h4>
4452
4341
  <div class="paragraph"><p>Suppose we have a Rails application that connects to a Memcached server in
4453
4342
  <em>environment.rb</em>. This causes the ApplicationSpawner to have a socket connection
4454
4343
  (file descriptor) to the Memcached server, as shown in the following figure:</p></div>
@@ -4539,7 +4428,7 @@ http://www.gnu.org/software/src-highlite -->
4539
4428
  <span style="font-style: italic"><span style="color: #9A1900"># We're in smart spawning mode.</span></span>
4540
4429
  reestablish_connection_to_memcached
4541
4430
  <span style="font-weight: bold"><span style="color: #0000FF">else</span></span>
4542
- <span style="font-style: italic"><span style="color: #9A1900"># We're in conservative spawning mode. We don't need to do anything.</span></span>
4431
+ <span style="font-style: italic"><span style="color: #9A1900"># We're in direct spawning mode. We don't need to do anything.</span></span>
4543
4432
  <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
4544
4433
  <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
4545
4434
  <span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre>
@@ -4547,7 +4436,7 @@ http://www.gnu.org/software/src-highlite -->
4547
4436
  </div>
4548
4437
  </div>
4549
4438
  <div class="sect3">
4550
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_example_2_log_file_sharing_not_harmful"></span><h4 data-comment-topic="example-2-log-file-sharing-not-harmful--ox4yfy" data-anchor="_example_2_log_file_sharing_not_harmful">11.3.2. Example 2: Log file sharing (not harmful)</h4>
4439
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h4 id="_example_2_log_file_sharing_not_harmful" data-comment-topic="example-2-log-file-sharing-not-harmful--ox4yfy">12.3.2. Example 2: Log file sharing (not harmful)</h4>
4551
4440
  <div class="paragraph"><p>There are also cases in which unintentional file descriptor sharing is not harmful.
4552
4441
  One such case is log file file descriptor sharing. Even if two processes write
4553
4442
  to the log file at the same time, the worst thing that can happen is that the
@@ -4559,7 +4448,7 @@ Memcached example, doesn’t help.</p></div>
4559
4448
  </div>
4560
4449
  </div>
4561
4450
  <div class="sect2">
4562
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_smart_spawning_gotcha_2_the_need_to_revive_threads"></span><h3 data-comment-topic="smart-spawning-gotcha-2-the-need-to-revive-threads-1ey176o" data-anchor="_smart_spawning_gotcha_2_the_need_to_revive_threads">11.4. Smart spawning gotcha #2: the need to revive threads</h3>
4451
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_smart_spawning_gotcha_2_the_need_to_revive_threads" data-comment-topic="smart-spawning-gotcha-2-the-need-to-revive-threads-1ey176o">12.4. Smart spawning gotcha #2: the need to revive threads</h3>
4563
4452
  <div class="paragraph"><p>Another part of the <em>fork()</em> system call’s semantics is the fact that threads
4564
4453
  disappear after a fork call. So if you’ve created any threads in environment.rb,
4565
4454
  then those threads will no longer be running in newly created worker process.
@@ -4577,7 +4466,7 @@ http://www.gnu.org/software/src-highlite -->
4577
4466
  <span style="font-style: italic"><span style="color: #9A1900"># We're in smart spawning mode.</span></span>
4578
4467
  <span style="color: #990000">...</span> code to revive threads here <span style="color: #990000">...</span>
4579
4468
  <span style="font-weight: bold"><span style="color: #0000FF">else</span></span>
4580
- <span style="font-style: italic"><span style="color: #9A1900"># We're in conservative spawning mode. We don't need to do anything.</span></span>
4469
+ <span style="font-style: italic"><span style="color: #9A1900"># We're in direct spawning mode. We don't need to do anything.</span></span>
4581
4470
  <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
4582
4471
  <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
4583
4472
  <span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre>
@@ -4585,7 +4474,7 @@ http://www.gnu.org/software/src-highlite -->
4585
4474
  </div>
4586
4475
  </div>
4587
4476
  <div class="sect2">
4588
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_smart_spawning_gotcha_3_code_load_order"></span><h3 data-comment-topic="smart-spawning-gotcha-3-code-load-order-12ydsn8" data-anchor="_smart_spawning_gotcha_3_code_load_order">11.5. Smart spawning gotcha #3: code load order</h3>
4477
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><h3 id="_smart_spawning_gotcha_3_code_load_order" data-comment-topic="smart-spawning-gotcha-3-code-load-order-12ydsn8">12.5. Smart spawning gotcha #3: code load order</h3>
4589
4478
  <div class="paragraph"><p>This gotcha is only applicable to the <em>smart</em> spawn method, not the <em>smart-lv2</em>
4590
4479
  spawn method.</p></div>
4591
4480
  <div class="paragraph"><p>If your application expects the Rails framework to be not loaded during the
@@ -4607,7 +4496,9 @@ has no effect.</p></div>
4607
4496
  </div>
4608
4497
  <div id="footnotes"><hr></div>
4609
4498
  <div id="footer">
4610
-
4499
+ <div id="footer-text">
4500
+ Last updated 2012-10-24 16:27:54 CEST
4501
+ </div>
4611
4502
  </div>
4612
4503
  <script>/*! jQuery v1.7.1 jquery.com | jquery.org/license */
4613
4504
  (function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function cb(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function ca(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bE.test(a)?d(a,e):ca(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)ca(a+"["+e+"]",b[e],c,d);else d(a,b)}function b_(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function b$(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bT,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=b$(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=b$(a,c,d,e,"*",g));return l}function bZ(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bP),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bC(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bx:by,g=0,h=e.length;if(d>0){if(c!=="border")for(;g<h;g++)c||(d-=parseFloat(f.css(a,"padding"+e[g]))||0),c==="margin"?d+=parseFloat(f.css(a,c+e[g]))||0:d-=parseFloat(f.css(a,"border"+e[g]+"Width"))||0;return d+"px"}d=bz(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0;if(c)for(;g<h;g++)d+=parseFloat(f.css(a,"padding"+e[g]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+e[g]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+e[g]))||0);return d+"px"}function bp(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c+(i[c][d].namespace?".":"")+i[c][d].namespace,i[c][d],i[c][d].data)}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?m(g):h==="function"&&(!a.unique||!o.has(g))&&c.push(g)},n=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,l=j||0,j=0,k=c.length;for(;c&&l<k;l++)if(c[l].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}i=!1,c&&(a.once?e===!0?o.disable():c=[]:d&&d.length&&(e=d.shift(),o.fireWith(e[0],e[1])))},o={add:function(){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){i&&f<=k&&(k--,f<=l&&l--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&o.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(i?a.once||d.push([b,c]):(!a.once||!e)&&n(b,c));return this},fire:function(){o.fireWith(this,arguments);return this},fired:function(){return!!e}};return o};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p,q=c.createElement("div"),r=c.documentElement;q.setAttribute("className","t"),q.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="<div "+n+"><div></div></div>"+"<table "+n+" cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="<div style='width:4px;'></div>",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h=null;if(typeof a=="undefined"){if(this.length){h=f.data(this[0]);if(this[0].nodeType===1&&!f._data(this[0],"parsedAttrs")){e=this[0].attributes;for(var i=0,j=e.length;i<j;i++)g=e[i].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),l(this[0],g,h[g]));f._data(this[0],"parsedAttrs",!0)}}return h}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split("."),d[1]=d[1]?"."+d[1]:"";if(c===b){h=this.triggerHandler("getData"+d[1]+"!",[d[0]]),h===b&&this.length&&(h=f.data(this[0],a),h=l(this[0],a,h));return h===b&&d[1]?this.data(d[0]):h}return this.each(function(){var b=f(this),e=[d[0],c];b.triggerHandler("setData"+d[1]+"!",e),f.data(this,a,c),b.triggerHandler("changeData"+d[1]+"!",e)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise()}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h<g;h++)e=d[h],e&&(c=f.propFix[e]||e,f.attr(a,e,""),a.removeAttribute(v?e:c),u.test(e)&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};
@@ -4944,7 +4835,6 @@ Mizuho.initializeTopBar = $.proxy(function() {
4944
4835
  var isMobileDevice = this.isMobileDevice();
4945
4836
  var timerId;
4946
4837
 
4947
- // Create the floating table of contents used in the top bar.
4948
4838
  var $floattoc = $('<div id="floattoc"></div>').html($('#toc').html());
4949
4839
  $floattoc.find('#toctitle').remove();
4950
4840
  $floattoc.find('.comments').remove();
@@ -4963,8 +4853,6 @@ Mizuho.initializeTopBar = $.proxy(function() {
4963
4853
  self.internalLinkClicked(this, event);
4964
4854
  });
4965
4855
 
4966
- // Callback for when the user clicks on the Table of Contents
4967
- // button on the top bar.
4968
4856
  function showFloatingToc() {
4969
4857
  var scrollUpdateTimerId;
4970
4858
 
@@ -5057,9 +4945,6 @@ Mizuho.initializeTopBar = $.proxy(function() {
5057
4945
  $window.bind('scroll', onScroll);
5058
4946
  }
5059
4947
 
5060
- // Called whenever the user scrolls. Updates the title of the
5061
- // Table of Contents button in the top bar to the section that
5062
- // the user is currently reading.
5063
4948
  function update() {
5064
4949
  if ($title.offset().top + $title.height() < $document.scrollTop()) {
5065
4950
  if (!$topbar.is(':visible')) {
@@ -5103,7 +4988,6 @@ Mizuho.initializeTopBar = $.proxy(function() {
5103
4988
  }, 100);
5104
4989
  }
5105
4990
 
5106
-
5107
4991
  if (isMobileDevice) {
5108
4992
  // Mobile devices don't support position fixed.
5109
4993
  $topbar.css('position', 'absolute');
@@ -5287,5 +5171,5 @@ Mizuho.topicListReceived = $.proxy(function(result) {
5287
5171
  $(document).ready(Mizuho.initializeCommenting);
5288
5172
 
5289
5173
  </script>
5290
- </body>
5174
+ </body>
5291
5175
  </html>