passenger 2.2.15 → 3.0.0.pre1

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 (1338) hide show
  1. data/DEVELOPERS.TXT +21 -12
  2. data/LICENSE +1 -1
  3. data/NEWS +8 -1
  4. data/PACKAGING.TXT +25 -0
  5. data/Rakefile +28 -891
  6. data/bin/passenger +32 -0
  7. data/bin/passenger-config +5 -5
  8. data/bin/passenger-install-apache2-module +37 -24
  9. data/bin/passenger-install-nginx-module +48 -46
  10. data/bin/passenger-make-enterprisey +8 -9
  11. data/bin/passenger-memory-stats +20 -150
  12. data/bin/passenger-status +130 -44
  13. data/bin/passenger-stress-test +5 -4
  14. data/build/agents.rb +73 -0
  15. data/build/apache2.rb +165 -0
  16. data/build/basics.rb +81 -0
  17. data/build/common_library.rb +198 -0
  18. data/build/config.rb +35 -0
  19. data/{misc/rake/cplusplus.rb → build/cplusplus_support.rb} +1 -1
  20. data/build/cxx_tests.rb +205 -0
  21. data/build/documentation.rb +77 -0
  22. data/{misc/rake → build}/gempackagetask.rb +1 -1
  23. data/build/integration_tests.rb +57 -0
  24. data/build/misc.rb +146 -0
  25. data/build/nginx.rb +64 -0
  26. data/build/oxt_tests.rb +52 -0
  27. data/{misc/rake → build}/packagetask.rb +0 -0
  28. data/build/packaging.rb +189 -0
  29. data/{misc/rake/extensions.rb → build/rake_extensions.rb} +1 -1
  30. data/{misc/rake → build}/rdoctask.rb +0 -0
  31. data/build/ruby_extension.rb +46 -0
  32. data/build/ruby_tests.rb +42 -0
  33. data/build/test_basics.rb +31 -0
  34. data/doc/ApplicationPool algorithm.txt +447 -234
  35. data/doc/Architectural overview.html +47 -56
  36. data/doc/Doxyfile +1 -1
  37. data/doc/Security of user switching support.html +46 -57
  38. data/doc/Users guide Apache.html +1033 -306
  39. data/doc/Users guide Apache.txt +419 -99
  40. data/doc/Users guide Nginx.html +1252 -253
  41. data/doc/Users guide Nginx.txt +711 -87
  42. data/doc/Users guide Standalone.html +603 -0
  43. data/doc/Users guide Standalone.txt +40 -0
  44. data/doc/cxxapi/AbstractSpawnManager_8h_source.html +141 -0
  45. data/doc/cxxapi/Account_8h_source.html +206 -0
  46. data/doc/cxxapi/AccountsDatabase_8h_source.html +161 -0
  47. data/doc/cxxapi/AgentBase_8h_source.html +70 -0
  48. data/doc/cxxapi/AgentsStarter_8h_source.html +112 -0
  49. data/doc/cxxapi/BCrypt_8h_source.html +104 -0
  50. data/doc/cxxapi/Blowfish_8h_source.html +134 -0
  51. data/doc/cxxapi/Bucket_8h_source.html +4 -3
  52. data/doc/cxxapi/Constants_8h_source.html +79 -0
  53. data/doc/cxxapi/ContentHandler_8h_source.html +95 -0
  54. data/doc/cxxapi/DirectoryMapper_8h_source.html +9 -8
  55. data/doc/cxxapi/EventedClient_8h_source.html +629 -0
  56. data/doc/cxxapi/EventedMessageServer_8h_source.html +358 -0
  57. data/doc/cxxapi/EventedServer_8h_source.html +326 -0
  58. data/doc/cxxapi/Exceptions_8h_source.html +366 -0
  59. data/doc/cxxapi/FileDescriptor_8h_source.html +260 -0
  60. data/doc/cxxapi/Hooks_8h_source.html +2 -1
  61. data/doc/cxxapi/HttpStatusExtractor_8h_source.html +382 -0
  62. data/doc/cxxapi/Logging_8h_source.html +726 -0
  63. data/doc/cxxapi/MessageChannel_8h_source.html +852 -0
  64. data/doc/cxxapi/MessageClient_8h_source.html +328 -0
  65. data/doc/cxxapi/MessageReadersWriters_8h_source.html +539 -0
  66. data/doc/cxxapi/MessageServer_8h_source.html +606 -0
  67. data/doc/cxxapi/PoolOptions_8h_source.html +548 -0
  68. data/doc/cxxapi/Process_8h_source.html +286 -0
  69. data/doc/cxxapi/RandomGenerator_8h_source.html +191 -0
  70. data/doc/cxxapi/ResourceLocator_8h_source.html +115 -0
  71. data/doc/cxxapi/ScgiRequestParser_8h_source.html +406 -0
  72. data/doc/cxxapi/ServerInstanceDir_8h_source.html +374 -0
  73. data/doc/cxxapi/Session_8h_source.html +501 -0
  74. data/doc/cxxapi/SpawnManager_8h_source.html +647 -0
  75. data/doc/cxxapi/StaticContentHandler_8h_source.html +68 -0
  76. data/doc/cxxapi/StaticString_8h_source.html +254 -0
  77. data/doc/cxxapi/StringListCreator_8h_source.html +114 -0
  78. data/doc/cxxapi/Utils_8h_source.html +442 -0
  79. data/doc/cxxapi/annotated.html +46 -0
  80. data/doc/cxxapi/apache2_2Configuration_8h_source.html +82 -0
  81. data/doc/cxxapi/classAgentWatcher-members.html +30 -26
  82. data/doc/cxxapi/classAgentWatcher.html +168 -194
  83. data/doc/cxxapi/classClient-members.html +14 -11
  84. data/doc/cxxapi/classClient.html +35 -35
  85. data/doc/cxxapi/classHooks-members.html +2 -0
  86. data/doc/cxxapi/classHooks.html +2 -0
  87. data/doc/cxxapi/classPassenger_1_1AbstractSpawnManager-members.html +16 -13
  88. data/doc/cxxapi/classPassenger_1_1AbstractSpawnManager.html +78 -82
  89. data/doc/cxxapi/classPassenger_1_1ArgumentException-members.html +12 -9
  90. data/doc/cxxapi/classPassenger_1_1ArgumentException.html +26 -22
  91. data/doc/cxxapi/classPassenger_1_1ArrayMessage-members.html +37 -0
  92. data/doc/cxxapi/classPassenger_1_1ArrayMessage.html +113 -0
  93. data/doc/cxxapi/classPassenger_1_1BufferedUpload-members.html +14 -11
  94. data/doc/cxxapi/classPassenger_1_1BufferedUpload.html +41 -42
  95. data/doc/cxxapi/classPassenger_1_1BusyException-members.html +12 -9
  96. data/doc/cxxapi/classPassenger_1_1BusyException.html +24 -20
  97. data/doc/cxxapi/classPassenger_1_1ConfigurationException-members.html +12 -9
  98. data/doc/cxxapi/classPassenger_1_1ConfigurationException.html +23 -19
  99. data/doc/cxxapi/classPassenger_1_1DirectoryMapper-members.html +2 -0
  100. data/doc/cxxapi/classPassenger_1_1DirectoryMapper.html +8 -6
  101. data/doc/cxxapi/classPassenger_1_1EOFException-members.html +12 -9
  102. data/doc/cxxapi/classPassenger_1_1EOFException.html +27 -23
  103. data/doc/cxxapi/classPassenger_1_1EventFd-members.html +12 -9
  104. data/doc/cxxapi/classPassenger_1_1EventFd.html +24 -21
  105. data/doc/cxxapi/classPassenger_1_1EventedClient-members.html +54 -0
  106. data/doc/cxxapi/classPassenger_1_1EventedClient.html +436 -0
  107. data/doc/cxxapi/classPassenger_1_1EventedMessageServer-members.html +37 -0
  108. data/doc/cxxapi/classPassenger_1_1EventedMessageServer.html +59 -0
  109. data/doc/cxxapi/classPassenger_1_1EventedMessageServer__inherit__graph.map +3 -0
  110. data/doc/cxxapi/classPassenger_1_1EventedMessageServer__inherit__graph.md5 +1 -0
  111. data/doc/cxxapi/classPassenger_1_1EventedMessageServer__inherit__graph.png +0 -0
  112. data/doc/cxxapi/classPassenger_1_1EventedServer-members.html +37 -0
  113. data/doc/cxxapi/classPassenger_1_1EventedServer.html +93 -0
  114. data/doc/cxxapi/classPassenger_1_1EventedServer__inherit__graph.map +3 -0
  115. data/doc/cxxapi/classPassenger_1_1EventedServer__inherit__graph.md5 +1 -0
  116. data/doc/cxxapi/classPassenger_1_1EventedServer__inherit__graph.png +0 -0
  117. data/doc/cxxapi/classPassenger_1_1FileDescriptor-members.html +16 -13
  118. data/doc/cxxapi/classPassenger_1_1FileDescriptor.html +63 -70
  119. data/doc/cxxapi/classPassenger_1_1FileNotFoundException-members.html +12 -9
  120. data/doc/cxxapi/classPassenger_1_1FileNotFoundException.html +26 -22
  121. data/doc/cxxapi/classPassenger_1_1FileSystemException-members.html +17 -14
  122. data/doc/cxxapi/classPassenger_1_1FileSystemException.html +32 -30
  123. data/doc/cxxapi/classPassenger_1_1HttpStatusExtractor-members.html +15 -12
  124. data/doc/cxxapi/classPassenger_1_1HttpStatusExtractor.html +59 -59
  125. data/doc/cxxapi/classPassenger_1_1IOException-members.html +12 -9
  126. data/doc/cxxapi/classPassenger_1_1IOException.html +27 -23
  127. data/doc/cxxapi/classPassenger_1_1MessageChannel-members.html +36 -33
  128. data/doc/cxxapi/classPassenger_1_1MessageChannel.html +326 -344
  129. data/doc/cxxapi/classPassenger_1_1MessageServer-members.html +25 -22
  130. data/doc/cxxapi/classPassenger_1_1MessageServer.html +160 -191
  131. data/doc/cxxapi/classPassenger_1_1MessageServer_1_1ClientContext-members.html +12 -9
  132. data/doc/cxxapi/classPassenger_1_1MessageServer_1_1ClientContext.html +29 -27
  133. data/doc/cxxapi/classPassenger_1_1MessageServer_1_1ClientContext__inherit__graph.map +3 -1
  134. data/doc/cxxapi/classPassenger_1_1MessageServer_1_1ClientContext__inherit__graph.md5 +1 -1
  135. data/doc/cxxapi/classPassenger_1_1MessageServer_1_1ClientContext__inherit__graph.png +0 -0
  136. data/doc/cxxapi/classPassenger_1_1MessageServer_1_1CommonClientContext-members.html +17 -14
  137. data/doc/cxxapi/classPassenger_1_1MessageServer_1_1CommonClientContext.html +69 -79
  138. data/doc/cxxapi/classPassenger_1_1MessageServer_1_1CommonClientContext__inherit__graph.map +3 -1
  139. data/doc/cxxapi/classPassenger_1_1MessageServer_1_1CommonClientContext__inherit__graph.md5 +1 -1
  140. data/doc/cxxapi/classPassenger_1_1MessageServer_1_1CommonClientContext__inherit__graph.png +0 -0
  141. data/doc/cxxapi/classPassenger_1_1MessageServer_1_1Handler-members.html +15 -12
  142. data/doc/cxxapi/classPassenger_1_1MessageServer_1_1Handler.html +60 -63
  143. data/doc/cxxapi/classPassenger_1_1Process-members.html +20 -17
  144. data/doc/cxxapi/classPassenger_1_1Process.html +88 -95
  145. data/doc/cxxapi/classPassenger_1_1RandomGenerator-members.html +13 -10
  146. data/doc/cxxapi/classPassenger_1_1RandomGenerator.html +36 -35
  147. data/doc/cxxapi/classPassenger_1_1RuntimeException-members.html +12 -9
  148. data/doc/cxxapi/classPassenger_1_1RuntimeException.html +24 -20
  149. data/doc/cxxapi/classPassenger_1_1ScalarMessage-members.html +37 -0
  150. data/doc/cxxapi/classPassenger_1_1ScalarMessage.html +76 -0
  151. data/doc/cxxapi/classPassenger_1_1ScgiRequestParser-members.html +26 -23
  152. data/doc/cxxapi/classPassenger_1_1ScgiRequestParser.html +121 -138
  153. data/doc/cxxapi/classPassenger_1_1SecurityException-members.html +12 -9
  154. data/doc/cxxapi/classPassenger_1_1SecurityException.html +26 -22
  155. data/doc/cxxapi/classPassenger_1_1Session-members.html +29 -26
  156. data/doc/cxxapi/classPassenger_1_1Session.html +219 -240
  157. data/doc/cxxapi/classPassenger_1_1SpawnException-members.html +14 -11
  158. data/doc/cxxapi/classPassenger_1_1SpawnException.html +36 -37
  159. data/doc/cxxapi/classPassenger_1_1SpawnManager-members.html +18 -15
  160. data/doc/cxxapi/classPassenger_1_1SpawnManager.html +115 -110
  161. data/doc/cxxapi/classPassenger_1_1StandardSession-members.html +30 -27
  162. data/doc/cxxapi/classPassenger_1_1StandardSession.html +163 -184
  163. data/doc/cxxapi/classPassenger_1_1StaticString-members.html +12 -9
  164. data/doc/cxxapi/classPassenger_1_1StaticString.html +27 -25
  165. data/doc/cxxapi/classPassenger_1_1SystemException-members.html +16 -13
  166. data/doc/cxxapi/classPassenger_1_1SystemException.html +65 -67
  167. data/doc/cxxapi/classPassenger_1_1TimeRetrievalException-members.html +16 -13
  168. data/doc/cxxapi/classPassenger_1_1TimeRetrievalException.html +27 -23
  169. data/doc/cxxapi/classPassenger_1_1TimeoutException-members.html +12 -9
  170. data/doc/cxxapi/classPassenger_1_1TimeoutException.html +24 -20
  171. data/doc/cxxapi/classPassenger_1_1Uint16Message-members.html +36 -0
  172. data/doc/cxxapi/classPassenger_1_1Uint16Message.html +51 -0
  173. data/doc/cxxapi/classPassenger_1_1Uint32Message-members.html +36 -0
  174. data/doc/cxxapi/classPassenger_1_1Uint32Message.html +51 -0
  175. data/doc/cxxapi/classServer-members.html +12 -9
  176. data/doc/cxxapi/classServer.html +23 -20
  177. data/doc/cxxapi/classServerInstanceDirToucher-members.html +12 -9
  178. data/doc/cxxapi/classServerInstanceDirToucher.html +21 -17
  179. data/doc/cxxapi/classes.html +18 -4
  180. data/doc/cxxapi/definitions_8h_source.html +1 -0
  181. data/doc/cxxapi/files.html +36 -1
  182. data/doc/cxxapi/functions.html +53 -21
  183. data/doc/cxxapi/functions_0x62.html +82 -0
  184. data/doc/cxxapi/functions_0x63.html +99 -0
  185. data/doc/cxxapi/functions_0x64.html +95 -0
  186. data/doc/cxxapi/functions_0x65.html +88 -0
  187. data/doc/cxxapi/functions_0x66.html +100 -0
  188. data/doc/cxxapi/functions_0x67.html +170 -0
  189. data/doc/cxxapi/functions_0x68.html +88 -0
  190. data/doc/cxxapi/functions_0x69.html +93 -0
  191. data/doc/cxxapi/functions_0x6b.html +80 -0
  192. data/doc/cxxapi/functions_0x6c.html +88 -0
  193. data/doc/cxxapi/functions_0x6d.html +88 -0
  194. data/doc/cxxapi/functions_0x6e.html +86 -0
  195. data/doc/cxxapi/functions_0x6f.html +94 -0
  196. data/doc/cxxapi/functions_0x70.html +94 -0
  197. data/doc/cxxapi/functions_0x72.html +110 -0
  198. data/doc/cxxapi/functions_0x73.html +171 -0
  199. data/doc/cxxapi/functions_0x74.html +85 -0
  200. data/doc/cxxapi/functions_0x75.html +85 -0
  201. data/doc/cxxapi/functions_0x77.html +92 -0
  202. data/doc/cxxapi/functions_0x7e.html +79 -0
  203. data/doc/cxxapi/functions_enum.html +14 -12
  204. data/doc/cxxapi/functions_eval.html +22 -16
  205. data/doc/cxxapi/functions_func.html +460 -1
  206. data/doc/cxxapi/functions_vars.html +163 -63
  207. data/doc/cxxapi/graph_legend.html +1 -0
  208. data/doc/cxxapi/graph_legend.png +0 -0
  209. data/doc/cxxapi/group__Core.html +2 -2
  210. data/doc/cxxapi/group__Core.map +1 -2
  211. data/doc/cxxapi/group__Core.png +0 -0
  212. data/doc/cxxapi/group__Exceptions.html +32 -40
  213. data/doc/cxxapi/group__Hooks.html +2 -1
  214. data/doc/cxxapi/group__Hooks.map +1 -1
  215. data/doc/cxxapi/group__Hooks.png +0 -0
  216. data/doc/cxxapi/group__Support.html +509 -0
  217. data/doc/cxxapi/hierarchy.html +66 -62
  218. data/doc/cxxapi/inherit__graph__10.map +3 -1
  219. data/doc/cxxapi/inherit__graph__10.md5 +1 -1
  220. data/doc/cxxapi/inherit__graph__10.png +0 -0
  221. data/doc/cxxapi/inherit__graph__11.map +4 -1
  222. data/doc/cxxapi/inherit__graph__11.md5 +1 -1
  223. data/doc/cxxapi/inherit__graph__11.png +0 -0
  224. data/doc/cxxapi/inherit__graph__12.map +3 -1
  225. data/doc/cxxapi/inherit__graph__12.md5 +1 -1
  226. data/doc/cxxapi/inherit__graph__12.png +0 -0
  227. data/doc/cxxapi/inherit__graph__13.map +3 -1
  228. data/doc/cxxapi/inherit__graph__13.md5 +1 -1
  229. data/doc/cxxapi/inherit__graph__13.png +0 -0
  230. data/doc/cxxapi/inherit__graph__14.map +3 -1
  231. data/doc/cxxapi/inherit__graph__14.md5 +1 -1
  232. data/doc/cxxapi/inherit__graph__14.png +0 -0
  233. data/doc/cxxapi/inherit__graph__15.map +5 -1
  234. data/doc/cxxapi/inherit__graph__15.md5 +1 -1
  235. data/doc/cxxapi/inherit__graph__15.png +0 -0
  236. data/doc/cxxapi/inherit__graph__16.map +3 -3
  237. data/doc/cxxapi/inherit__graph__16.md5 +1 -1
  238. data/doc/cxxapi/inherit__graph__16.png +0 -0
  239. data/doc/cxxapi/inherit__graph__17.map +3 -1
  240. data/doc/cxxapi/inherit__graph__17.md5 +1 -1
  241. data/doc/cxxapi/inherit__graph__17.png +0 -0
  242. data/doc/cxxapi/inherit__graph__18.map +4 -1
  243. data/doc/cxxapi/inherit__graph__18.md5 +1 -1
  244. data/doc/cxxapi/inherit__graph__18.png +0 -0
  245. data/doc/cxxapi/inherit__graph__19.map +3 -1
  246. data/doc/cxxapi/inherit__graph__19.md5 +1 -1
  247. data/doc/cxxapi/inherit__graph__19.png +0 -0
  248. data/doc/cxxapi/inherit__graph__20.map +3 -2
  249. data/doc/cxxapi/inherit__graph__20.md5 +1 -1
  250. data/doc/cxxapi/inherit__graph__20.png +0 -0
  251. data/doc/cxxapi/inherit__graph__21.map +3 -1
  252. data/doc/cxxapi/inherit__graph__21.md5 +1 -1
  253. data/doc/cxxapi/inherit__graph__21.png +0 -0
  254. data/doc/cxxapi/inherit__graph__22.map +3 -1
  255. data/doc/cxxapi/inherit__graph__22.md5 +1 -1
  256. data/doc/cxxapi/inherit__graph__22.png +0 -0
  257. data/doc/cxxapi/inherit__graph__23.map +3 -1
  258. data/doc/cxxapi/inherit__graph__23.md5 +1 -1
  259. data/doc/cxxapi/inherit__graph__23.png +0 -0
  260. data/doc/cxxapi/inherit__graph__24.map +3 -1
  261. data/doc/cxxapi/inherit__graph__24.md5 +1 -1
  262. data/doc/cxxapi/inherit__graph__24.png +0 -0
  263. data/doc/cxxapi/inherit__graph__25.map +3 -1
  264. data/doc/cxxapi/inherit__graph__25.md5 +1 -1
  265. data/doc/cxxapi/inherit__graph__25.png +0 -0
  266. data/doc/cxxapi/inherit__graph__26.map +3 -1
  267. data/doc/cxxapi/inherit__graph__26.md5 +1 -1
  268. data/doc/cxxapi/inherit__graph__26.png +0 -0
  269. data/doc/cxxapi/inherit__graph__27.map +3 -1
  270. data/doc/cxxapi/inherit__graph__27.md5 +1 -1
  271. data/doc/cxxapi/inherit__graph__27.png +0 -0
  272. data/doc/cxxapi/inherit__graph__28.map +4 -1
  273. data/doc/cxxapi/inherit__graph__28.md5 +1 -1
  274. data/doc/cxxapi/inherit__graph__28.png +0 -0
  275. data/doc/cxxapi/inherit__graph__29.map +3 -1
  276. data/doc/cxxapi/inherit__graph__29.md5 +1 -1
  277. data/doc/cxxapi/inherit__graph__29.png +0 -0
  278. data/doc/cxxapi/inherit__graph__30.map +3 -2
  279. data/doc/cxxapi/inherit__graph__30.md5 +1 -1
  280. data/doc/cxxapi/inherit__graph__30.png +0 -0
  281. data/doc/cxxapi/inherit__graph__31.map +3 -1
  282. data/doc/cxxapi/inherit__graph__31.md5 +1 -1
  283. data/doc/cxxapi/inherit__graph__31.png +0 -0
  284. data/doc/cxxapi/inherit__graph__32.map +5 -1
  285. data/doc/cxxapi/inherit__graph__32.md5 +1 -1
  286. data/doc/cxxapi/inherit__graph__32.png +0 -0
  287. data/doc/cxxapi/inherit__graph__33.map +3 -1
  288. data/doc/cxxapi/inherit__graph__33.md5 +1 -1
  289. data/doc/cxxapi/inherit__graph__33.png +0 -0
  290. data/doc/cxxapi/inherit__graph__34.map +3 -3
  291. data/doc/cxxapi/inherit__graph__34.md5 +1 -1
  292. data/doc/cxxapi/inherit__graph__34.png +0 -0
  293. data/doc/cxxapi/inherit__graph__35.map +3 -1
  294. data/doc/cxxapi/inherit__graph__35.md5 +1 -1
  295. data/doc/cxxapi/inherit__graph__35.png +0 -0
  296. data/doc/cxxapi/inherit__graph__36.map +3 -1
  297. data/doc/cxxapi/inherit__graph__36.md5 +1 -1
  298. data/doc/cxxapi/inherit__graph__36.png +0 -0
  299. data/doc/cxxapi/inherit__graph__37.map +3 -1
  300. data/doc/cxxapi/inherit__graph__37.md5 +1 -1
  301. data/doc/cxxapi/inherit__graph__37.png +0 -0
  302. data/doc/cxxapi/inherit__graph__4.map +3 -1
  303. data/doc/cxxapi/inherit__graph__4.md5 +1 -1
  304. data/doc/cxxapi/inherit__graph__4.png +0 -0
  305. data/doc/cxxapi/inherit__graph__5.map +3 -1
  306. data/doc/cxxapi/inherit__graph__5.md5 +1 -1
  307. data/doc/cxxapi/inherit__graph__5.png +0 -0
  308. data/doc/cxxapi/inherit__graph__6.map +3 -1
  309. data/doc/cxxapi/inherit__graph__6.md5 +1 -1
  310. data/doc/cxxapi/inherit__graph__6.png +0 -0
  311. data/doc/cxxapi/inherit__graph__7.map +3 -1
  312. data/doc/cxxapi/inherit__graph__7.md5 +1 -1
  313. data/doc/cxxapi/inherit__graph__7.png +0 -0
  314. data/doc/cxxapi/inherit__graph__8.map +3 -1
  315. data/doc/cxxapi/inherit__graph__8.md5 +1 -1
  316. data/doc/cxxapi/inherit__graph__8.png +0 -0
  317. data/doc/cxxapi/inherit__graph__9.map +3 -1
  318. data/doc/cxxapi/inherit__graph__9.md5 +1 -1
  319. data/doc/cxxapi/inherit__graph__9.png +0 -0
  320. data/doc/cxxapi/inherits.html +123 -126
  321. data/doc/cxxapi/main.html +1 -0
  322. data/doc/cxxapi/modules.html +2 -1
  323. data/doc/cxxapi/namespacePassenger.html +263 -492
  324. data/doc/cxxapi/namespacemembers.html +68 -96
  325. data/doc/cxxapi/namespacemembers_enum.html +14 -12
  326. data/doc/cxxapi/namespacemembers_eval.html +20 -15
  327. data/doc/cxxapi/namespacemembers_func.html +52 -88
  328. data/doc/cxxapi/namespacemembers_type.html +18 -14
  329. data/doc/cxxapi/namespaces.html +12 -9
  330. data/doc/cxxapi/nginx_2Configuration_8h_source.html +125 -0
  331. data/doc/cxxapi/ngx__http__passenger__module_8h_source.html +94 -0
  332. data/doc/cxxapi/structPassenger_1_1MessageServer_1_1DisconnectEventBroadcastGuard-members.html +12 -9
  333. data/doc/cxxapi/structPassenger_1_1MessageServer_1_1DisconnectEventBroadcastGuard.html +24 -22
  334. data/doc/cxxapi/structPassenger_1_1PoolOptions-members.html +43 -38
  335. data/doc/cxxapi/structPassenger_1_1PoolOptions.html +275 -325
  336. data/doc/cxxapi/structPassenger_1_1StaticString_1_1Hash-members.html +12 -9
  337. data/doc/cxxapi/structPassenger_1_1StaticString_1_1Hash.html +24 -22
  338. data/doc/cxxapi/tree.html +152 -7
  339. data/doc/users_guide_snippets/{analysis_and_system_maintenance_tools.txt → analysis_and_system_maintenance.txt} +58 -1
  340. data/doc/users_guide_snippets/appendix_c_spawning_methods.txt +1 -2
  341. data/doc/users_guide_snippets/global_queueing_explained.txt +1 -5
  342. data/doc/users_guide_snippets/{rails_spawn_method.txt → passenger_spawn_method.txt} +9 -8
  343. data/doc/users_guide_snippets/tips.txt +12 -6
  344. data/doc/users_guide_snippets/under_the_hood/page_caching_support.txt +22 -0
  345. data/ext/apache2/Bucket.cpp +4 -4
  346. data/ext/apache2/Bucket.h +3 -3
  347. data/ext/apache2/Configuration.cpp +278 -381
  348. data/ext/apache2/Configuration.h +3 -357
  349. data/ext/apache2/Configuration.hpp +461 -0
  350. data/ext/apache2/DirectoryMapper.h +3 -3
  351. data/ext/apache2/HelperAgent.cpp +359 -0
  352. data/ext/apache2/Hooks.cpp +339 -226
  353. data/ext/apache2/Hooks.h +1 -1
  354. data/ext/apache2/mod_passenger.c +10 -4
  355. data/ext/boost/algorithm/string/case_conv.hpp +4 -4
  356. data/ext/boost/algorithm/string/concept.hpp +2 -2
  357. data/ext/boost/algorithm/string/detail/case_conv.hpp +18 -9
  358. data/ext/boost/algorithm/string/detail/find_format.hpp +44 -43
  359. data/ext/boost/algorithm/string/detail/find_format_all.hpp +56 -56
  360. data/ext/boost/algorithm/string/detail/find_format_store.hpp +7 -0
  361. data/ext/boost/algorithm/string/detail/finder.hpp +14 -14
  362. data/ext/boost/algorithm/string/detail/formatter.hpp +2 -2
  363. data/ext/boost/algorithm/string/detail/replace_storage.hpp +3 -3
  364. data/ext/boost/algorithm/string/detail/sequence.hpp +3 -3
  365. data/ext/boost/algorithm/string/erase.hpp +98 -98
  366. data/ext/boost/algorithm/string/find_format.hpp +56 -38
  367. data/ext/boost/algorithm/string/finder.hpp +6 -6
  368. data/ext/boost/algorithm/string/formatter.hpp +1 -1
  369. data/ext/boost/algorithm/string/replace.hpp +99 -99
  370. data/ext/boost/bind.hpp +5 -1670
  371. data/ext/boost/bind/bind.hpp +1751 -0
  372. data/ext/boost/bind/bind_mf2_cc.hpp +228 -0
  373. data/ext/boost/bind/mem_fn.hpp +389 -0
  374. data/ext/boost/bind/mem_fn_template.hpp +54 -27
  375. data/ext/boost/bind/placeholders.hpp +3 -2
  376. data/ext/boost/concept_check.hpp +10 -0
  377. data/ext/boost/config/abi/msvc_prefix.hpp +15 -1
  378. data/ext/boost/config/abi_prefix.hpp +1 -1
  379. data/ext/boost/config/abi_suffix.hpp +3 -2
  380. data/ext/boost/config/auto_link.hpp +6 -1
  381. data/ext/boost/config/compiler/borland.hpp +75 -17
  382. data/ext/boost/config/compiler/codegear.hpp +163 -0
  383. data/ext/boost/config/compiler/common_edg.hpp +35 -0
  384. data/ext/boost/config/compiler/digitalmars.hpp +26 -0
  385. data/ext/boost/config/compiler/gcc.hpp +69 -14
  386. data/ext/boost/config/compiler/hp_acc.hpp +32 -0
  387. data/ext/boost/config/compiler/intel.hpp +13 -2
  388. data/ext/boost/config/compiler/kai.hpp +0 -2
  389. data/ext/boost/config/compiler/metrowerks.hpp +29 -1
  390. data/ext/boost/config/compiler/mpw.hpp +30 -0
  391. data/ext/boost/config/compiler/pgi.hpp +37 -0
  392. data/ext/boost/config/compiler/sgi_mipspro.hpp +1 -0
  393. data/ext/boost/config/compiler/sunpro_cc.hpp +39 -7
  394. data/ext/boost/config/compiler/vacpp.hpp +31 -3
  395. data/ext/boost/config/compiler/visualc.hpp +72 -5
  396. data/ext/boost/config/no_tr1/cmath.hpp +28 -0
  397. data/ext/boost/config/platform/bsd.hpp +16 -3
  398. data/ext/boost/config/platform/hpux.hpp +3 -0
  399. data/ext/boost/config/platform/macos.hpp +8 -0
  400. data/ext/boost/config/platform/solaris.hpp +7 -0
  401. data/ext/boost/config/platform/vxworks.hpp +31 -0
  402. data/ext/boost/config/select_compiler_config.hpp +4 -0
  403. data/ext/boost/config/select_platform_config.hpp +6 -2
  404. data/ext/boost/config/select_stdlib_config.hpp +17 -8
  405. data/ext/boost/config/stdlib/dinkumware.hpp +34 -2
  406. data/ext/boost/config/stdlib/libcomo.hpp +25 -0
  407. data/ext/boost/config/stdlib/libstdcpp3.hpp +56 -2
  408. data/ext/boost/config/stdlib/modena.hpp +25 -0
  409. data/ext/boost/config/stdlib/msl.hpp +24 -0
  410. data/ext/boost/config/stdlib/roguewave.hpp +26 -0
  411. data/ext/boost/config/stdlib/sgi.hpp +25 -0
  412. data/ext/boost/config/stdlib/stlport.hpp +36 -1
  413. data/ext/boost/config/stdlib/vacpp.hpp +25 -0
  414. data/ext/boost/config/suffix.hpp +67 -32
  415. data/ext/boost/config/warning_disable.hpp +47 -0
  416. data/ext/boost/cstdint.hpp +62 -36
  417. data/ext/boost/date_time/c_time.hpp +28 -12
  418. data/ext/boost/date_time/compiler_config.hpp +27 -5
  419. data/ext/boost/date_time/constrained_value.hpp +36 -13
  420. data/ext/boost/date_time/date.hpp +44 -33
  421. data/ext/boost/date_time/date_duration.hpp +13 -14
  422. data/ext/boost/date_time/date_facet.hpp +215 -226
  423. data/ext/boost/date_time/date_generator_formatter.hpp +22 -20
  424. data/ext/boost/date_time/date_generator_parser.hpp +52 -51
  425. data/ext/boost/date_time/date_generators.hpp +16 -16
  426. data/ext/boost/date_time/date_parsing.hpp +115 -98
  427. data/ext/boost/date_time/filetime_functions.hpp +133 -41
  428. data/ext/boost/date_time/format_date_parser.hpp +22 -10
  429. data/ext/boost/date_time/gregorian/conversion.hpp +32 -39
  430. data/ext/boost/date_time/gregorian/greg_calendar.hpp +15 -14
  431. data/ext/boost/date_time/gregorian/greg_date.hpp +19 -18
  432. data/ext/boost/date_time/gregorian/greg_duration.hpp +106 -10
  433. data/ext/boost/date_time/gregorian/greg_duration_types.hpp +16 -7
  434. data/ext/boost/date_time/gregorian/greg_weekday.hpp +2 -2
  435. data/ext/boost/date_time/gregorian/gregorian_io.hpp +11 -4
  436. data/ext/boost/date_time/gregorian_calendar.hpp +8 -8
  437. data/ext/boost/date_time/gregorian_calendar.ipp +30 -30
  438. data/ext/boost/date_time/int_adapter.hpp +4 -2
  439. data/ext/boost/date_time/microsec_time_clock.hpp +39 -117
  440. data/ext/boost/date_time/period_parser.hpp +17 -15
  441. data/ext/boost/date_time/posix_time/conversion.hpp +28 -29
  442. data/ext/boost/date_time/posix_time/posix_time_config.hpp +19 -19
  443. data/ext/boost/date_time/posix_time/posix_time_io.hpp +31 -38
  444. data/ext/boost/date_time/posix_time/time_formatters.hpp +32 -32
  445. data/ext/boost/date_time/string_parse_tree.hpp +46 -46
  446. data/ext/boost/date_time/strings_from_facet.hpp +7 -5
  447. data/ext/boost/date_time/time.hpp +7 -6
  448. data/ext/boost/date_time/time_defs.hpp +12 -2
  449. data/ext/boost/date_time/time_duration.hpp +27 -26
  450. data/ext/boost/date_time/time_facet.hpp +386 -321
  451. data/ext/boost/date_time/time_formatting_streams.hpp +8 -5
  452. data/ext/boost/date_time/time_resolution_traits.hpp +29 -25
  453. data/ext/boost/date_time/time_system_split.hpp +7 -13
  454. data/ext/boost/date_time/wrapping_int.hpp +21 -15
  455. data/ext/boost/detail/call_traits.hpp +1 -1
  456. data/ext/boost/detail/endian.hpp +4 -4
  457. data/ext/boost/detail/no_exceptions_support.hpp +87 -0
  458. data/ext/boost/detail/sp_typeinfo.hpp +50 -4
  459. data/ext/boost/detail/workaround.hpp +63 -3
  460. data/ext/boost/enable_shared_from_this.hpp +4 -59
  461. data/ext/boost/exception/current_exception_cast.hpp +43 -0
  462. data/ext/boost/exception/detail/attribute_noreturn.hpp +17 -0
  463. data/ext/boost/exception/detail/error_info_impl.hpp +75 -0
  464. data/ext/boost/exception/detail/exception_ptr.hpp +490 -0
  465. data/ext/boost/exception/detail/is_output_streamable.hpp +47 -0
  466. data/ext/boost/exception/detail/object_hex_dump.hpp +50 -0
  467. data/ext/boost/exception/detail/type_info.hpp +79 -0
  468. data/ext/boost/exception/diagnostic_information.hpp +182 -0
  469. data/ext/boost/exception/exception.hpp +422 -0
  470. data/ext/boost/exception/get_error_info.hpp +130 -0
  471. data/ext/boost/exception/info.hpp +167 -0
  472. data/ext/boost/exception/to_string.hpp +83 -0
  473. data/ext/boost/exception/to_string_stub.hpp +109 -0
  474. data/ext/boost/exception_ptr.hpp +11 -0
  475. data/ext/boost/function/detail/prologue.hpp +2 -1
  476. data/ext/boost/function/function_base.hpp +270 -128
  477. data/ext/boost/function/function_fwd.hpp +70 -0
  478. data/ext/boost/function/function_template.hpp +319 -130
  479. data/ext/boost/get_pointer.hpp +5 -1
  480. data/ext/boost/integer.hpp +253 -0
  481. data/ext/boost/integer_fwd.hpp +174 -0
  482. data/ext/boost/integer_traits.hpp +26 -1
  483. data/ext/boost/io/ios_state.hpp +8 -0
  484. data/ext/boost/iterator/detail/config_def.hpp +4 -2
  485. data/ext/boost/iterator/iterator_adaptor.hpp +7 -2
  486. data/ext/boost/iterator/iterator_facade.hpp +1 -2
  487. data/ext/boost/lexical_cast.hpp +113 -105
  488. data/ext/boost/limits.hpp +1 -1
  489. data/ext/boost/mem_fn.hpp +5 -370
  490. data/ext/boost/memory_order.hpp +53 -0
  491. data/ext/boost/mpl/always.hpp +3 -3
  492. data/ext/boost/mpl/and.hpp +3 -3
  493. data/ext/boost/mpl/apply.hpp +3 -3
  494. data/ext/boost/mpl/apply_fwd.hpp +3 -3
  495. data/ext/boost/mpl/apply_wrap.hpp +37 -6
  496. data/ext/boost/mpl/arg.hpp +3 -3
  497. data/ext/boost/mpl/arg_fwd.hpp +3 -3
  498. data/ext/boost/mpl/assert.hpp +6 -6
  499. data/ext/boost/mpl/aux_/adl_barrier.hpp +3 -3
  500. data/ext/boost/mpl/aux_/arg_typedef.hpp +3 -3
  501. data/ext/boost/mpl/aux_/arity.hpp +3 -3
  502. data/ext/boost/mpl/aux_/arity_spec.hpp +3 -3
  503. data/ext/boost/mpl/aux_/common_name_wknd.hpp +3 -3
  504. data/ext/boost/mpl/aux_/config/adl.hpp +4 -4
  505. data/ext/boost/mpl/aux_/config/arrays.hpp +4 -4
  506. data/ext/boost/mpl/aux_/config/bcc.hpp +28 -0
  507. data/ext/boost/mpl/aux_/config/bind.hpp +4 -4
  508. data/ext/boost/mpl/aux_/config/compiler.hpp +8 -6
  509. data/ext/boost/mpl/aux_/config/ctps.hpp +3 -3
  510. data/ext/boost/mpl/aux_/config/dtp.hpp +5 -5
  511. data/ext/boost/mpl/aux_/config/eti.hpp +3 -3
  512. data/ext/boost/mpl/aux_/config/gcc.hpp +3 -3
  513. data/ext/boost/mpl/aux_/config/has_apply.hpp +3 -3
  514. data/ext/boost/mpl/aux_/config/has_xxx.hpp +3 -3
  515. data/ext/boost/mpl/aux_/config/integral.hpp +4 -4
  516. data/ext/boost/mpl/aux_/config/intel.hpp +3 -3
  517. data/ext/boost/mpl/aux_/config/lambda.hpp +3 -3
  518. data/ext/boost/mpl/aux_/config/msvc.hpp +3 -3
  519. data/ext/boost/mpl/aux_/config/msvc_typename.hpp +3 -3
  520. data/ext/boost/mpl/aux_/config/nttp.hpp +3 -3
  521. data/ext/boost/mpl/aux_/config/overload_resolution.hpp +3 -3
  522. data/ext/boost/mpl/aux_/config/pp_counter.hpp +3 -3
  523. data/ext/boost/mpl/aux_/config/preprocessor.hpp +4 -4
  524. data/ext/boost/mpl/aux_/config/static_constant.hpp +3 -3
  525. data/ext/boost/mpl/aux_/config/ttp.hpp +4 -4
  526. data/ext/boost/mpl/aux_/config/use_preprocessed.hpp +3 -3
  527. data/ext/boost/mpl/aux_/config/workaround.hpp +3 -3
  528. data/ext/boost/mpl/aux_/full_lambda.hpp +3 -3
  529. data/ext/boost/mpl/aux_/has_apply.hpp +3 -3
  530. data/ext/boost/mpl/aux_/has_type.hpp +3 -3
  531. data/ext/boost/mpl/aux_/include_preprocessed.hpp +3 -3
  532. data/ext/boost/mpl/aux_/integral_wrapper.hpp +3 -3
  533. data/ext/boost/mpl/aux_/lambda_arity_param.hpp +3 -3
  534. data/ext/boost/mpl/aux_/lambda_support.hpp +4 -4
  535. data/ext/boost/mpl/aux_/msvc_never_true.hpp +3 -3
  536. data/ext/boost/mpl/aux_/na.hpp +3 -3
  537. data/ext/boost/mpl/aux_/na_assert.hpp +3 -3
  538. data/ext/boost/mpl/aux_/na_fwd.hpp +3 -3
  539. data/ext/boost/mpl/aux_/na_spec.hpp +3 -3
  540. data/ext/boost/mpl/aux_/nested_type_wknd.hpp +3 -3
  541. data/ext/boost/mpl/aux_/nttp_decl.hpp +3 -3
  542. data/ext/boost/mpl/aux_/preprocessor/def_params_tail.hpp +3 -3
  543. data/ext/boost/mpl/aux_/preprocessor/enum.hpp +3 -3
  544. data/ext/boost/mpl/aux_/preprocessor/filter_params.hpp +3 -3
  545. data/ext/boost/mpl/aux_/preprocessor/params.hpp +3 -3
  546. data/ext/boost/mpl/aux_/preprocessor/sub.hpp +3 -3
  547. data/ext/boost/mpl/aux_/static_cast.hpp +3 -3
  548. data/ext/boost/mpl/aux_/template_arity.hpp +3 -3
  549. data/ext/boost/mpl/aux_/template_arity_fwd.hpp +3 -3
  550. data/ext/boost/mpl/aux_/type_wrapper.hpp +3 -3
  551. data/ext/boost/mpl/aux_/value_wknd.hpp +3 -3
  552. data/ext/boost/mpl/aux_/yes_no.hpp +3 -3
  553. data/ext/boost/mpl/bind.hpp +3 -3
  554. data/ext/boost/mpl/bind_fwd.hpp +3 -3
  555. data/ext/boost/mpl/bool.hpp +3 -3
  556. data/ext/boost/mpl/bool_fwd.hpp +3 -3
  557. data/ext/boost/mpl/eval_if.hpp +3 -3
  558. data/ext/boost/mpl/has_xxx.hpp +10 -8
  559. data/ext/boost/mpl/identity.hpp +3 -3
  560. data/ext/boost/mpl/if.hpp +3 -3
  561. data/ext/boost/mpl/int.hpp +3 -3
  562. data/ext/boost/mpl/int_fwd.hpp +3 -3
  563. data/ext/boost/mpl/integral_c.hpp +3 -3
  564. data/ext/boost/mpl/integral_c_fwd.hpp +3 -3
  565. data/ext/boost/mpl/integral_c_tag.hpp +3 -3
  566. data/ext/boost/mpl/lambda.hpp +3 -3
  567. data/ext/boost/mpl/lambda_fwd.hpp +3 -3
  568. data/ext/boost/mpl/limits/arity.hpp +3 -3
  569. data/ext/boost/mpl/logical.hpp +3 -3
  570. data/ext/boost/mpl/next.hpp +3 -3
  571. data/ext/boost/mpl/next_prior.hpp +3 -3
  572. data/ext/boost/mpl/not.hpp +3 -3
  573. data/ext/boost/mpl/or.hpp +3 -3
  574. data/ext/boost/mpl/placeholders.hpp +3 -3
  575. data/ext/boost/mpl/protect.hpp +3 -3
  576. data/ext/boost/mpl/quote.hpp +18 -7
  577. data/ext/boost/mpl/size_t.hpp +3 -3
  578. data/ext/boost/mpl/size_t_fwd.hpp +3 -3
  579. data/ext/boost/mpl/void.hpp +3 -3
  580. data/ext/boost/mpl/void_fwd.hpp +3 -3
  581. data/ext/boost/non_type.hpp +27 -27
  582. data/ext/boost/operators.hpp +51 -18
  583. data/ext/boost/preprocessor/arithmetic/detail/div_base.hpp +61 -0
  584. data/ext/boost/preprocessor/arithmetic/mod.hpp +39 -0
  585. data/ext/boost/preprocessor/comparison/less_equal.hpp +39 -0
  586. data/ext/boost/preprocessor/control/deduce_d.hpp +22 -0
  587. data/ext/boost/preprocessor/logical/not.hpp +30 -0
  588. data/ext/boost/preprocessor/seq/cat.hpp +48 -0
  589. data/ext/boost/preprocessor/seq/fold_left.hpp +1070 -0
  590. data/ext/boost/preprocessor/seq/transform.hpp +48 -0
  591. data/ext/boost/range/as_literal.hpp +10 -14
  592. data/ext/boost/range/begin.hpp +4 -4
  593. data/ext/boost/range/detail/implementation_help.hpp +4 -0
  594. data/ext/boost/range/end.hpp +4 -4
  595. data/ext/boost/range/iterator_range.hpp +31 -15
  596. data/ext/boost/ref.hpp +12 -1
  597. data/ext/boost/scoped_array.hpp +16 -0
  598. data/ext/boost/scoped_ptr.hpp +16 -0
  599. data/ext/boost/shared_ptr.hpp +2 -602
  600. data/ext/boost/{detail → smart_ptr}/bad_weak_ptr.hpp +4 -4
  601. data/ext/boost/{detail → smart_ptr/detail}/atomic_count.hpp +14 -19
  602. data/ext/boost/{detail → smart_ptr/detail}/atomic_count_gcc.hpp +13 -9
  603. data/ext/boost/{detail → smart_ptr/detail}/atomic_count_gcc_x86.hpp +5 -12
  604. data/ext/boost/{detail → smart_ptr/detail}/atomic_count_pthreads.hpp +5 -5
  605. data/ext/boost/{detail → smart_ptr/detail}/atomic_count_solaris.hpp +3 -3
  606. data/ext/boost/{detail → smart_ptr/detail}/atomic_count_sync.hpp +9 -5
  607. data/ext/boost/{detail → smart_ptr/detail}/atomic_count_win32.hpp +3 -3
  608. data/ext/boost/smart_ptr/detail/operator_bool.hpp +56 -0
  609. data/ext/boost/{detail → smart_ptr/detail}/shared_count.hpp +86 -17
  610. data/ext/boost/smart_ptr/detail/sp_convertible.hpp +76 -0
  611. data/ext/boost/smart_ptr/detail/sp_counted_base.hpp +70 -0
  612. data/ext/boost/{detail → smart_ptr/detail}/sp_counted_base_acc_ia64.hpp +4 -4
  613. data/ext/boost/{detail → smart_ptr/detail}/sp_counted_base_cw_ppc.hpp +4 -4
  614. data/ext/boost/{detail → smart_ptr/detail}/sp_counted_base_cw_x86.hpp +4 -4
  615. data/ext/boost/{detail → smart_ptr/detail}/sp_counted_base_gcc_ia64.hpp +4 -4
  616. data/ext/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp +172 -0
  617. data/ext/boost/{detail → smart_ptr/detail}/sp_counted_base_gcc_ppc.hpp +4 -4
  618. data/ext/boost/{detail → smart_ptr/detail}/sp_counted_base_gcc_sparc.hpp +7 -7
  619. data/ext/boost/{detail → smart_ptr/detail}/sp_counted_base_gcc_x86.hpp +4 -4
  620. data/ext/boost/{detail → smart_ptr/detail}/sp_counted_base_nt.hpp +4 -4
  621. data/ext/boost/{detail → smart_ptr/detail}/sp_counted_base_pt.hpp +4 -4
  622. data/ext/boost/{detail → smart_ptr/detail}/sp_counted_base_solaris.hpp +4 -4
  623. data/ext/boost/smart_ptr/detail/sp_counted_base_spin.hpp +131 -0
  624. data/ext/boost/{detail → smart_ptr/detail}/sp_counted_base_sync.hpp +8 -4
  625. data/ext/boost/{detail → smart_ptr/detail}/sp_counted_base_w32.hpp +4 -4
  626. data/ext/boost/{detail → smart_ptr/detail}/sp_counted_impl.hpp +5 -5
  627. data/ext/boost/smart_ptr/detail/sp_has_sync.hpp +49 -0
  628. data/ext/boost/smart_ptr/detail/spinlock.hpp +53 -0
  629. data/ext/boost/smart_ptr/detail/spinlock_gcc_arm.hpp +85 -0
  630. data/ext/boost/smart_ptr/detail/spinlock_nt.hpp +89 -0
  631. data/ext/boost/smart_ptr/detail/spinlock_pool.hpp +87 -0
  632. data/ext/boost/smart_ptr/detail/spinlock_pt.hpp +79 -0
  633. data/ext/boost/smart_ptr/detail/spinlock_sync.hpp +87 -0
  634. data/ext/boost/smart_ptr/detail/yield_k.hpp +149 -0
  635. data/ext/boost/smart_ptr/enable_shared_from_this.hpp +79 -0
  636. data/ext/boost/smart_ptr/scoped_array.hpp +107 -0
  637. data/ext/boost/smart_ptr/scoped_ptr.hpp +131 -0
  638. data/ext/boost/smart_ptr/shared_ptr.hpp +701 -0
  639. data/ext/boost/smart_ptr/weak_ptr.hpp +230 -0
  640. data/ext/boost/src/pthread/thread.cpp +115 -203
  641. data/ext/boost/src/tss_null.cpp +1 -1
  642. data/ext/boost/static_assert.hpp +14 -4
  643. data/ext/boost/thread.hpp +7 -2
  644. data/ext/boost/thread/barrier.hpp +63 -0
  645. data/ext/boost/thread/detail/force_cast.hpp +39 -0
  646. data/ext/boost/thread/detail/move.hpp +29 -2
  647. data/ext/boost/thread/detail/platform.hpp +3 -3
  648. data/ext/boost/thread/detail/singleton.hpp +59 -0
  649. data/ext/boost/thread/detail/thread.hpp +496 -0
  650. data/ext/boost/thread/detail/thread_group.hpp +105 -0
  651. data/ext/boost/thread/detail/thread_heap_alloc.hpp +23 -0
  652. data/ext/boost/thread/detail/thread_interruption.hpp +35 -0
  653. data/ext/boost/thread/detail/tss_hooks.hpp +82 -0
  654. data/ext/boost/thread/exceptions.hpp +174 -60
  655. data/ext/boost/thread/future.hpp +1364 -0
  656. data/ext/boost/thread/locks.hpp +899 -32
  657. data/ext/boost/thread/once.hpp +4 -0
  658. data/ext/boost/thread/pthread/condition_variable.hpp +16 -21
  659. data/ext/boost/thread/pthread/condition_variable_fwd.hpp +37 -3
  660. data/ext/boost/thread/pthread/mutex.hpp +20 -7
  661. data/ext/boost/thread/pthread/once.hpp +7 -2
  662. data/ext/boost/thread/pthread/pthread_mutex_scoped_lock.hpp +5 -1
  663. data/ext/boost/thread/pthread/recursive_mutex.hpp +22 -5
  664. data/ext/boost/thread/pthread/shared_mutex.hpp +303 -0
  665. data/ext/boost/thread/pthread/thread_data.hpp +37 -10
  666. data/ext/boost/thread/pthread/thread_heap_alloc.hpp +242 -0
  667. data/ext/boost/thread/pthread/timespec.hpp +11 -3
  668. data/ext/boost/thread/shared_mutex.hpp +21 -0
  669. data/ext/boost/thread/thread.hpp +8 -3
  670. data/ext/boost/thread/thread_time.hpp +4 -0
  671. data/ext/boost/thread/tss.hpp +106 -13
  672. data/ext/boost/thread/xtime.hpp +6 -2
  673. data/ext/boost/throw_exception.hpp +36 -7
  674. data/ext/boost/token_functions.hpp +1 -1
  675. data/ext/boost/tokenizer.hpp +1 -1
  676. data/ext/boost/type_traits/add_pointer.hpp +1 -1
  677. data/ext/boost/type_traits/add_volatile.hpp +47 -0
  678. data/ext/boost/type_traits/alignment_of.hpp +29 -1
  679. data/ext/boost/type_traits/config.hpp +1 -1
  680. data/ext/boost/type_traits/conversion_traits.hpp +1 -1
  681. data/ext/boost/type_traits/has_trivial_destructor.hpp +42 -0
  682. data/ext/boost/type_traits/intrinsics.hpp +88 -1
  683. data/ext/boost/type_traits/is_abstract.hpp +14 -5
  684. data/ext/boost/type_traits/is_arithmetic.hpp +8 -0
  685. data/ext/boost/type_traits/is_array.hpp +3 -2
  686. data/ext/boost/type_traits/is_base_and_derived.hpp +254 -0
  687. data/ext/boost/type_traits/is_base_of.hpp +51 -0
  688. data/ext/boost/type_traits/is_class.hpp +12 -0
  689. data/ext/boost/type_traits/is_const.hpp +6 -2
  690. data/ext/boost/type_traits/is_convertible.hpp +14 -2
  691. data/ext/boost/type_traits/is_enum.hpp +10 -1
  692. data/ext/boost/type_traits/is_function.hpp +11 -3
  693. data/ext/boost/type_traits/is_fundamental.hpp +45 -0
  694. data/ext/boost/type_traits/is_integral.hpp +5 -0
  695. data/ext/boost/type_traits/is_member_function_pointer.hpp +5 -3
  696. data/ext/boost/type_traits/is_member_pointer.hpp +4 -2
  697. data/ext/boost/type_traits/is_pointer.hpp +3 -1
  698. data/ext/boost/type_traits/is_reference.hpp +4 -2
  699. data/ext/boost/type_traits/is_signed.hpp +135 -0
  700. data/ext/boost/type_traits/is_unsigned.hpp +130 -0
  701. data/ext/boost/type_traits/is_void.hpp +5 -0
  702. data/ext/boost/type_traits/is_volatile.hpp +4 -2
  703. data/ext/boost/type_traits/make_unsigned.hpp +137 -0
  704. data/ext/boost/type_traits/remove_reference.hpp +1 -1
  705. data/ext/boost/type_traits/type_with_alignment.hpp +106 -1
  706. data/ext/boost/utility.hpp +2 -1
  707. data/ext/boost/utility/addressof.hpp +61 -17
  708. data/ext/boost/utility/binary.hpp +708 -0
  709. data/ext/boost/utility/enable_if.hpp +2 -2
  710. data/ext/boost/weak_ptr.hpp +4 -174
  711. data/ext/common/AbstractSpawnManager.h +110 -0
  712. data/ext/common/Account.h +175 -0
  713. data/ext/common/AccountsDatabase.cpp +81 -0
  714. data/ext/common/AccountsDatabase.h +130 -0
  715. data/ext/common/AgentBase.cpp +323 -0
  716. data/ext/common/{Version.h → AgentBase.h} +14 -6
  717. data/ext/common/AgentsStarter.cpp +154 -0
  718. data/ext/common/AgentsStarter.h +81 -0
  719. data/ext/common/AgentsStarter.hpp +619 -0
  720. data/ext/common/ApplicationPool/Client.h +796 -0
  721. data/ext/common/{ApplicationPool.h → ApplicationPool/Interface.h} +108 -18
  722. data/ext/common/ApplicationPool/Pool.h +1315 -0
  723. data/ext/common/ApplicationPool/Server.h +475 -0
  724. data/ext/common/BCrypt.cpp +343 -0
  725. data/ext/common/BCrypt.h +73 -0
  726. data/ext/common/Blowfish.c +685 -0
  727. data/ext/common/Blowfish.h +103 -0
  728. data/ext/common/Constants.h +48 -0
  729. data/ext/common/EventedClient.h +598 -0
  730. data/ext/common/EventedMessageServer.h +327 -0
  731. data/ext/common/EventedServer.h +295 -0
  732. data/ext/common/Exceptions.h +78 -1
  733. data/ext/common/FileDescriptor.h +229 -0
  734. data/ext/common/HelperAgent/BacktracesServer.h +59 -0
  735. data/ext/common/Logging.cpp +8 -9
  736. data/ext/common/Logging.h +593 -21
  737. data/ext/common/LoggingAgent/ChangeNotifier.h +63 -0
  738. data/ext/common/LoggingAgent/DataStoreId.h +177 -0
  739. data/ext/common/LoggingAgent/LoggingServer.h +1343 -0
  740. data/ext/common/LoggingAgent/Main.cpp +278 -0
  741. data/ext/common/LoggingAgent/RemoteSender.h +457 -0
  742. data/ext/common/MessageChannel.h +196 -34
  743. data/ext/common/MessageClient.h +297 -0
  744. data/ext/common/MessageReadersWriters.h +508 -0
  745. data/ext/common/MessageServer.h +575 -0
  746. data/ext/common/PoolOptions.h +279 -117
  747. data/ext/common/Process.h +255 -0
  748. data/ext/common/RandomGenerator.h +160 -0
  749. data/ext/common/ResourceLocator.h +84 -0
  750. data/ext/common/ServerInstanceDir.h +343 -0
  751. data/ext/common/Session.h +470 -0
  752. data/ext/common/SpawnManager.h +256 -201
  753. data/ext/common/StaticString.h +79 -4
  754. data/ext/common/StringListCreator.h +2 -2
  755. data/ext/common/Utils.cpp +385 -397
  756. data/ext/common/Utils.h +79 -165
  757. data/ext/common/{Base64.cpp → Utils/Base64.cpp} +0 -0
  758. data/ext/common/{Base64.h → Utils/Base64.h} +27 -1
  759. data/ext/common/Utils/BlockingQueue.h +136 -0
  760. data/ext/common/Utils/BlockingScalar.h +50 -0
  761. data/ext/common/{CachedFileStat.cpp → Utils/CachedFileStat.cpp} +1 -1
  762. data/ext/common/{CachedFileStat.h → Utils/CachedFileStat.h} +1 -1
  763. data/ext/common/{CachedFileStat.hpp → Utils/CachedFileStat.hpp} +1 -1
  764. data/ext/common/{FileChangeChecker.h → Utils/FileChangeChecker.h} +1 -1
  765. data/ext/common/Utils/FileHandleGuard.h +81 -0
  766. data/ext/common/Utils/IOUtils.cpp +754 -0
  767. data/ext/common/Utils/IOUtils.h +253 -0
  768. data/ext/common/Utils/MD5.cpp +406 -0
  769. data/ext/common/Utils/MD5.h +98 -0
  770. data/ext/common/Utils/MemZeroGuard.h +103 -0
  771. data/ext/common/Utils/ProcessMetricsCollector.h +462 -0
  772. data/ext/common/Utils/ScopeGuard.h +72 -0
  773. data/ext/common/Utils/StrIntUtils.cpp +329 -0
  774. data/ext/common/Utils/StrIntUtils.h +228 -0
  775. data/ext/common/{SystemTime.cpp → Utils/SystemTime.cpp} +5 -1
  776. data/ext/common/Utils/SystemTime.h +201 -0
  777. data/ext/common/{Timer.h → Utils/Timer.h} +58 -18
  778. data/ext/common/Utils/VariantMap.h +363 -0
  779. data/ext/common/Utils/foo.cpp +10 -0
  780. data/ext/common/Watchdog.cpp +1034 -0
  781. data/ext/google/COPYING +28 -0
  782. data/ext/google/ChangeLog +167 -0
  783. data/ext/google/dense_hash_map +310 -0
  784. data/ext/google/dense_hash_set +287 -0
  785. data/ext/google/sparse_hash_map +294 -0
  786. data/ext/google/sparse_hash_set +275 -0
  787. data/ext/google/sparsehash/densehashtable.h +1062 -0
  788. data/ext/google/sparsehash/sparseconfig.h +55 -0
  789. data/ext/google/sparsehash/sparsehashtable.h +1015 -0
  790. data/ext/google/sparsetable +1468 -0
  791. data/ext/google/type_traits.h +250 -0
  792. data/ext/libev/Changes +302 -0
  793. data/ext/libev/LICENSE +36 -0
  794. data/ext/libev/Makefile.am +18 -0
  795. data/ext/libev/Makefile.in +685 -0
  796. data/ext/libev/README +58 -0
  797. data/ext/libev/aclocal.m4 +7549 -0
  798. data/ext/libev/autogen.sh +6 -0
  799. data/ext/libev/config.guess +1526 -0
  800. data/ext/libev/config.h +122 -0
  801. data/ext/libev/config.h.in +121 -0
  802. data/ext/libev/config.sub +1658 -0
  803. data/ext/libev/configure +22156 -0
  804. data/ext/libev/configure.ac +18 -0
  805. data/ext/libev/ev++.h +800 -0
  806. data/ext/libev/ev.c +3694 -0
  807. data/ext/libev/ev.h +705 -0
  808. data/ext/libev/ev_epoll.c +228 -0
  809. data/ext/libev/ev_kqueue.c +196 -0
  810. data/ext/libev/ev_poll.c +144 -0
  811. data/ext/libev/ev_port.c +165 -0
  812. data/ext/libev/ev_select.c +308 -0
  813. data/ext/libev/ev_vars.h +187 -0
  814. data/ext/libev/ev_win32.c +153 -0
  815. data/ext/libev/ev_wrap.h +178 -0
  816. data/ext/libev/event.c +401 -0
  817. data/ext/libev/event.h +158 -0
  818. data/ext/libev/install-sh +294 -0
  819. data/ext/libev/libev.m4 +38 -0
  820. data/ext/libev/ltmain.sh +6871 -0
  821. data/ext/libev/missing +336 -0
  822. data/ext/libev/mkinstalldirs +111 -0
  823. data/ext/nginx/Configuration.c +532 -182
  824. data/ext/nginx/Configuration.h +33 -10
  825. data/ext/nginx/ContentHandler.c +188 -53
  826. data/ext/nginx/ContentHandler.h +1 -1
  827. data/ext/nginx/{HelperServer.cpp → HelperAgent.cpp} +433 -299
  828. data/ext/nginx/HttpStatusExtractor.h +1 -1
  829. data/ext/nginx/ScgiRequestParser.h +68 -11
  830. data/ext/nginx/StaticContentHandler.c +4 -1
  831. data/ext/nginx/StaticContentHandler.h +1 -1
  832. data/ext/nginx/config +5 -5
  833. data/ext/nginx/ngx_http_passenger_module.c +315 -469
  834. data/ext/nginx/ngx_http_passenger_module.h +8 -17
  835. data/ext/oxt/backtrace.cpp +49 -41
  836. data/ext/oxt/backtrace.hpp +1 -1
  837. data/ext/oxt/detail/backtrace_disabled.hpp +1 -1
  838. data/ext/oxt/detail/backtrace_enabled.hpp +16 -15
  839. data/ext/oxt/detail/spin_lock_darwin.hpp +69 -0
  840. data/ext/oxt/detail/spin_lock_gcc_x86.hpp +3 -4
  841. data/ext/oxt/detail/spin_lock_portable.hpp +1 -1
  842. data/ext/oxt/detail/spin_lock_pthreads.hpp +1 -1
  843. data/ext/oxt/detail/tracable_exception_disabled.hpp +1 -1
  844. data/ext/oxt/detail/tracable_exception_enabled.hpp +1 -1
  845. data/ext/oxt/dynamic_thread_group.hpp +195 -0
  846. data/ext/oxt/macros.hpp +1 -1
  847. data/ext/oxt/spin_lock.hpp +4 -2
  848. data/ext/oxt/system_calls.cpp +129 -13
  849. data/ext/oxt/system_calls.hpp +16 -2
  850. data/ext/oxt/thread.cpp +1 -1
  851. data/ext/oxt/thread.hpp +49 -14
  852. data/ext/oxt/tracable_exception.cpp +5 -5
  853. data/ext/oxt/tracable_exception.hpp +1 -1
  854. data/ext/phusion_passenger/extconf.rb +7 -2
  855. data/ext/phusion_passenger/native_support.c +733 -33
  856. data/{bin → helper-scripts}/passenger-spawn-server +50 -12
  857. data/helper-scripts/prespawn +63 -0
  858. data/lib/phusion_passenger.rb +113 -0
  859. data/lib/phusion_passenger/abstract_installer.rb +50 -12
  860. data/lib/phusion_passenger/abstract_request_handler.rb +432 -171
  861. data/lib/phusion_passenger/abstract_server.rb +125 -122
  862. data/lib/phusion_passenger/abstract_server_collection.rb +51 -22
  863. data/lib/phusion_passenger/admin_tools.rb +1 -1
  864. data/lib/phusion_passenger/admin_tools/memory_stats.rb +299 -0
  865. data/lib/phusion_passenger/admin_tools/server_instance.rb +334 -0
  866. data/lib/phusion_passenger/analytics_logger.rb +342 -0
  867. data/lib/phusion_passenger/{application.rb → app_process.rb} +73 -24
  868. data/lib/phusion_passenger/classic_rails/application_spawner.rb +344 -0
  869. data/lib/phusion_passenger/{railz → classic_rails}/cgi_fixed.rb +2 -2
  870. data/lib/phusion_passenger/{railz → classic_rails}/framework_spawner.rb +75 -98
  871. data/lib/phusion_passenger/{railz → classic_rails}/request_handler.rb +8 -6
  872. data/lib/phusion_passenger/classic_rails_extensions/analytics_logging/ac_base_extension.rb +65 -0
  873. data/lib/phusion_passenger/classic_rails_extensions/analytics_logging/ac_benchmarking_extension.rb +48 -0
  874. data/lib/phusion_passenger/classic_rails_extensions/analytics_logging/ac_rescue_extension.rb +59 -0
  875. data/lib/phusion_passenger/classic_rails_extensions/analytics_logging/ar_abstract_adapter_extension.rb +54 -0
  876. data/lib/phusion_passenger/classic_rails_extensions/analytics_logging/as_cache_extension.rb +130 -0
  877. data/lib/phusion_passenger/classic_rails_extensions/analytics_logging/av_benchmark_helper_extension.rb +47 -0
  878. data/lib/phusion_passenger/classic_rails_extensions/init.rb +123 -0
  879. data/lib/phusion_passenger/console_text_template.rb +1 -1
  880. data/lib/phusion_passenger/constants.rb +9 -5
  881. data/lib/phusion_passenger/debug_logging.rb +104 -0
  882. data/lib/phusion_passenger/dependencies.rb +187 -4
  883. data/lib/phusion_passenger/exceptions.rb +4 -4
  884. data/lib/phusion_passenger/html_template.rb +6 -8
  885. data/lib/phusion_passenger/message_channel.rb +137 -21
  886. data/lib/phusion_passenger/message_client.rb +173 -0
  887. data/lib/phusion_passenger/native_support.rb +108 -0
  888. data/lib/phusion_passenger/packaging.rb +82 -13
  889. data/lib/phusion_passenger/platform_info.rb +84 -475
  890. data/lib/phusion_passenger/platform_info/apache.rb +329 -0
  891. data/lib/phusion_passenger/platform_info/binary_compatibility.rb +187 -0
  892. data/lib/phusion_passenger/platform_info/compiler.rb +154 -0
  893. data/lib/phusion_passenger/{events.rb → platform_info/curl.rb} +26 -23
  894. data/lib/phusion_passenger/platform_info/documentation_tools.rb +35 -0
  895. data/lib/phusion_passenger/platform_info/linux.rb +77 -0
  896. data/lib/phusion_passenger/platform_info/operating_system.rb +51 -0
  897. data/lib/phusion_passenger/platform_info/ruby.rb +198 -0
  898. data/lib/phusion_passenger/platform_info/zlib.rb +38 -0
  899. data/lib/phusion_passenger/plugin.rb +96 -0
  900. data/lib/phusion_passenger/public_api.rb +112 -0
  901. data/lib/phusion_passenger/rack/application_spawner.rb +146 -71
  902. data/lib/phusion_passenger/rack/request_handler.rb +36 -13
  903. data/lib/phusion_passenger/rails3_extensions/init.rb +204 -0
  904. data/lib/phusion_passenger/simple_benchmarking.rb +1 -1
  905. data/lib/phusion_passenger/spawn_manager.rb +137 -141
  906. data/lib/phusion_passenger/standalone/app_finder.rb +153 -0
  907. data/lib/phusion_passenger/standalone/command.rb +237 -0
  908. data/lib/phusion_passenger/standalone/config_file.rb +119 -0
  909. data/lib/phusion_passenger/standalone/help_command.rb +57 -0
  910. data/lib/phusion_passenger/standalone/main.rb +101 -0
  911. data/lib/phusion_passenger/standalone/package_runtime_command.rb +92 -0
  912. data/lib/phusion_passenger/standalone/runtime_installer.rb +466 -0
  913. data/lib/phusion_passenger/standalone/start_command.rb +510 -0
  914. data/lib/phusion_passenger/standalone/status_command.rb +62 -0
  915. data/lib/phusion_passenger/standalone/stop_command.rb +74 -0
  916. data/lib/phusion_passenger/standalone/utils.rb +42 -0
  917. data/lib/phusion_passenger/standalone/version_command.rb +42 -0
  918. data/lib/phusion_passenger/templates/framework_init_error.html.erb +1 -1
  919. data/lib/phusion_passenger/templates/standalone/cannot_write_to_dir.txt.erb +11 -0
  920. data/lib/phusion_passenger/templates/standalone/config.erb +69 -0
  921. data/lib/phusion_passenger/templates/standalone/possible_solutions_for_download_and_extraction_problems.txt.erb +17 -0
  922. data/lib/phusion_passenger/templates/standalone/run_installer_as_root.txt.erb +8 -0
  923. data/lib/phusion_passenger/templates/standalone/welcome.txt.erb +8 -0
  924. data/lib/phusion_passenger/templates/standalone_default_root/index.html +1 -0
  925. data/lib/phusion_passenger/templates/version_not_found.html.erb +2 -2
  926. data/lib/phusion_passenger/utils.rb +476 -125
  927. data/lib/phusion_passenger/utils/file_system_watcher.rb +186 -0
  928. data/lib/phusion_passenger/utils/hosts_file_parser.rb +130 -0
  929. data/lib/phusion_passenger/utils/tmpdir.rb +70 -0
  930. data/lib/phusion_passenger/utils/unseekable_socket.rb +196 -0
  931. data/lib/phusion_passenger/wsgi/application_spawner.rb +24 -20
  932. data/lib/phusion_passenger/wsgi/request_handler.py +1 -1
  933. data/misc/copy_boost_headers.rb +36 -9
  934. data/misc/find_owner_pipe_leaks.rb +1 -1
  935. data/misc/render_error_pages.rb +1 -1
  936. data/misc/union_station_gateway.crt +32 -0
  937. data/test/config.yml.example +24 -13
  938. data/test/cxx/ApplicationPool_PoolTest.cpp +33 -0
  939. data/test/cxx/ApplicationPool_PoolTestCases.cpp +1029 -0
  940. data/test/cxx/ApplicationPool_ServerTest.cpp +308 -0
  941. data/test/cxx/ApplicationPool_Server_PoolTest.cpp +80 -0
  942. data/test/{Base64Test.cpp → cxx/Base64Test.cpp} +4 -2
  943. data/test/{CachedFileStatTest.cpp → cxx/CachedFileStatTest.cpp} +3 -3
  944. data/test/{CxxTestMain.cpp → cxx/CxxTestMain.cpp} +6 -27
  945. data/test/cxx/EventedClientTest.cpp +386 -0
  946. data/test/{FileChangeCheckerTest.cpp → cxx/FileChangeCheckerTest.cpp} +3 -5
  947. data/test/cxx/FileDescriptorTest.cpp +69 -0
  948. data/test/{HttpStatusExtractorTest.cpp → cxx/HttpStatusExtractorTest.cpp} +1 -1
  949. data/test/cxx/IOUtilsTest.cpp +398 -0
  950. data/test/cxx/LoggingTest.cpp +914 -0
  951. data/test/cxx/MessageChannelTest.cpp +672 -0
  952. data/test/cxx/MessageReadersWritersTest.cpp +574 -0
  953. data/test/cxx/MessageServerTest.cpp +383 -0
  954. data/test/{PoolOptionsTest.cpp → cxx/PoolOptionsTest.cpp} +2 -3
  955. data/test/{ScgiRequestParserTest.cpp → cxx/ScgiRequestParserTest.cpp} +53 -1
  956. data/test/cxx/ServerInstanceDirTest.cpp +186 -0
  957. data/test/cxx/SpawnManagerTest.cpp +161 -0
  958. data/test/cxx/StaticStringTest.cpp +86 -0
  959. data/test/{SystemTimeTest.cpp → cxx/SystemTimeTest.cpp} +2 -2
  960. data/test/cxx/TestSupport.cpp +166 -0
  961. data/test/cxx/TestSupport.h +254 -0
  962. data/test/cxx/UtilsTest.cpp +521 -0
  963. data/test/cxx/VariantMapTest.cpp +179 -0
  964. data/test/integration_tests/apache2_tests.rb +198 -127
  965. data/test/integration_tests/cgi_environment_spec.rb +26 -0
  966. data/test/integration_tests/mycook_spec.rb +2 -28
  967. data/test/integration_tests/nginx_tests.rb +125 -16
  968. data/test/integration_tests/spec_helper.rb +19 -0
  969. data/test/oxt/backtrace_test.cpp +19 -59
  970. data/test/oxt/counter.hpp +55 -0
  971. data/test/oxt/dynamic_thread_group_test.cpp +131 -0
  972. data/test/oxt/oxt_test_main.cpp +2 -2
  973. data/test/oxt/spin_lock_test.cpp +59 -0
  974. data/test/oxt/syscall_interruption_test.cpp +1 -1
  975. data/test/ruby/abstract_request_handler_spec.rb +346 -25
  976. data/test/ruby/abstract_server_collection_spec.rb +4 -3
  977. data/test/ruby/abstract_server_spec.rb +37 -27
  978. data/test/ruby/admin_tools_spec.rb +362 -0
  979. data/test/ruby/analytics_logger_spec.rb +253 -0
  980. data/test/ruby/{application_spec.rb → app_process_spec.rb} +14 -14
  981. data/test/ruby/classic_rails/application_spawner_spec.rb +89 -0
  982. data/test/ruby/classic_rails/framework_spawner_spec.rb +92 -0
  983. data/test/ruby/debug_logging_spec.rb +141 -0
  984. data/test/ruby/message_channel_spec.rb +51 -25
  985. data/test/ruby/rack/application_spawner_spec.rb +99 -82
  986. data/test/ruby/shared/abstract_server_spec.rb +23 -0
  987. data/test/ruby/shared/rails/analytics_logging_extensions_spec.rb +375 -0
  988. data/test/ruby/shared/spawners/classic_rails/framework_spawner_spec.rb +38 -0
  989. data/test/ruby/shared/spawners/classic_rails/lack_of_rails_gem_version_spec.rb +19 -0
  990. data/test/ruby/shared/spawners/classic_rails/spawner_spec.rb +15 -0
  991. data/test/ruby/shared/spawners/non_preloading_spawner_spec.rb +27 -0
  992. data/test/ruby/shared/spawners/preloading_spawner_spec.rb +29 -0
  993. data/test/ruby/shared/spawners/reload_all_spec.rb +36 -0
  994. data/test/ruby/shared/spawners/reload_single_spec.rb +52 -0
  995. data/test/ruby/shared/spawners/spawn_server_spec.rb +28 -0
  996. data/test/ruby/shared/spawners/spawner_spec.rb +273 -0
  997. data/test/ruby/shared/utils/pseudo_io_spec.rb +60 -0
  998. data/test/ruby/spawn_manager_spec.rb +104 -175
  999. data/test/ruby/spec_helper.rb +104 -0
  1000. data/test/ruby/utils/file_system_watcher_spec.rb +221 -0
  1001. data/test/ruby/utils/hosts_file_parser.rb +258 -0
  1002. data/test/ruby/utils/unseekable_socket_spec.rb +66 -0
  1003. data/test/ruby/utils_spec.rb +410 -59
  1004. data/test/ruby/wsgi/application_spawner_spec.rb +16 -20
  1005. data/test/stub/apache2/httpd.conf.erb +11 -6
  1006. data/test/stub/message_channel.rb +3 -1
  1007. data/test/stub/message_channel_2.rb +3 -1
  1008. data/test/stub/message_channel_3.rb +5 -3
  1009. data/test/stub/nginx/nginx.conf.erb +3 -2
  1010. data/test/stub/rails_apps/1.2/empty/Rakefile +10 -0
  1011. data/test/stub/rails_apps/1.2/empty/app/controllers/application.rb +7 -0
  1012. data/test/stub/rails_apps/{foobar → 1.2/empty}/app/helpers/application_helper.rb +0 -0
  1013. data/test/stub/rails_apps/{mycook → 1.2/empty}/config/boot.rb +3 -3
  1014. data/test/stub/rails_apps/1.2/empty/config/database.yml +31 -0
  1015. data/test/stub/rails_apps/1.2/empty/config/environment.rb +66 -0
  1016. data/test/stub/rails_apps/1.2/empty/config/environments/development.rb +21 -0
  1017. data/test/stub/rails_apps/{foobar → 1.2/empty}/config/environments/production.rb +0 -0
  1018. data/test/stub/rails_apps/1.2/empty/config/environments/staging.rb +18 -0
  1019. data/test/stub/rails_apps/1.2/empty/config/environments/test.rb +19 -0
  1020. data/test/stub/rails_apps/1.2/empty/config/routes.rb +23 -0
  1021. data/test/stub/rails_apps/1.2/empty/doc/README_FOR_APP +2 -0
  1022. data/test/stub/rails_apps/{mycook → 1.2/empty}/public/404.html +0 -0
  1023. data/test/stub/rails_apps/1.2/empty/public/500.html +30 -0
  1024. data/test/stub/rails_apps/1.2/empty/public/dispatch.cgi +10 -0
  1025. data/test/stub/rails_apps/1.2/empty/public/dispatch.fcgi +24 -0
  1026. data/test/stub/rails_apps/1.2/empty/public/dispatch.rb +10 -0
  1027. data/test/stub/rails_apps/{mycook → 1.2/empty}/public/favicon.ico +0 -0
  1028. data/test/stub/rails_apps/{mycook → 1.2/empty}/public/images/rails.png +0 -0
  1029. data/test/stub/rails_apps/1.2/empty/public/robots.txt +1 -0
  1030. data/test/stub/rails_apps/1.2/empty/script/about +3 -0
  1031. data/test/stub/rails_apps/1.2/empty/script/breakpointer +3 -0
  1032. data/test/stub/rails_apps/1.2/empty/script/console +3 -0
  1033. data/test/stub/rails_apps/1.2/empty/script/destroy +3 -0
  1034. data/test/stub/rails_apps/1.2/empty/script/generate +3 -0
  1035. data/test/stub/rails_apps/1.2/empty/script/performance/benchmarker +3 -0
  1036. data/test/stub/rails_apps/1.2/empty/script/performance/profiler +3 -0
  1037. data/test/stub/rails_apps/1.2/empty/script/plugin +3 -0
  1038. data/test/stub/rails_apps/1.2/empty/script/process/inspector +3 -0
  1039. data/test/stub/rails_apps/1.2/empty/script/process/reaper +3 -0
  1040. data/test/stub/rails_apps/1.2/empty/script/process/spawner +3 -0
  1041. data/test/stub/rails_apps/1.2/empty/script/runner +3 -0
  1042. data/test/stub/rails_apps/1.2/empty/script/server +3 -0
  1043. data/test/stub/rails_apps/1.2/empty/test/test_helper.rb +28 -0
  1044. data/test/stub/rails_apps/2.0/empty/Rakefile +10 -0
  1045. data/test/stub/rails_apps/2.0/empty/app/controllers/application.rb +10 -0
  1046. data/test/stub/rails_apps/{mycook → 2.0/empty}/app/helpers/application_helper.rb +0 -0
  1047. data/test/stub/rails_apps/{foobar → 2.0/empty}/config/boot.rb +3 -3
  1048. data/test/stub/rails_apps/2.0/empty/config/database.yml +31 -0
  1049. data/test/stub/rails_apps/2.0/empty/config/environment.rb +59 -0
  1050. data/test/stub/rails_apps/{mycook → 2.0/empty}/config/environments/development.rb +1 -1
  1051. data/test/stub/rails_apps/2.0/empty/config/environments/production.rb +18 -0
  1052. data/test/stub/rails_apps/2.0/empty/config/environments/staging.rb +18 -0
  1053. data/test/stub/rails_apps/2.0/empty/config/environments/test.rb +22 -0
  1054. data/test/stub/rails_apps/{foobar → 2.0/empty}/config/initializers/inflections.rb +0 -0
  1055. data/test/stub/rails_apps/{foobar → 2.0/empty}/config/initializers/mime_types.rb +0 -0
  1056. data/test/stub/rails_apps/{foobar → 2.0/empty}/config/routes.rb +0 -0
  1057. data/test/stub/rails_apps/2.0/empty/doc/README_FOR_APP +2 -0
  1058. data/test/stub/rails_apps/2.0/empty/public/404.html +30 -0
  1059. data/test/stub/rails_apps/{mycook → 2.0/empty}/public/422.html +0 -0
  1060. data/test/stub/rails_apps/{mycook → 2.0/empty}/public/500.html +0 -0
  1061. data/test/stub/rails_apps/2.0/empty/public/dispatch.cgi +10 -0
  1062. data/test/stub/rails_apps/2.0/empty/public/dispatch.fcgi +24 -0
  1063. data/test/stub/rails_apps/2.0/empty/public/dispatch.rb +10 -0
  1064. data/test/stub/rails_apps/2.0/empty/public/favicon.ico +0 -0
  1065. data/test/stub/rails_apps/2.0/empty/public/images/rails.png +0 -0
  1066. data/test/stub/rails_apps/{mycook → 2.0/empty}/public/robots.txt +0 -0
  1067. data/test/stub/rails_apps/2.0/empty/script/about +3 -0
  1068. data/test/stub/rails_apps/2.0/empty/script/console +3 -0
  1069. data/test/stub/rails_apps/2.0/empty/script/destroy +3 -0
  1070. data/test/stub/rails_apps/2.0/empty/script/generate +3 -0
  1071. data/test/stub/rails_apps/2.0/empty/script/performance/benchmarker +3 -0
  1072. data/test/stub/rails_apps/2.0/empty/script/performance/profiler +3 -0
  1073. data/test/stub/rails_apps/2.0/empty/script/performance/request +3 -0
  1074. data/test/stub/rails_apps/2.0/empty/script/plugin +3 -0
  1075. data/test/stub/rails_apps/2.0/empty/script/process/inspector +3 -0
  1076. data/test/stub/rails_apps/2.0/empty/script/process/reaper +3 -0
  1077. data/test/stub/rails_apps/2.0/empty/script/process/spawner +3 -0
  1078. data/test/stub/rails_apps/2.0/empty/script/runner +3 -0
  1079. data/test/stub/rails_apps/2.0/empty/script/server +3 -0
  1080. data/test/stub/rails_apps/2.0/empty/test/test_helper.rb +38 -0
  1081. data/test/stub/rails_apps/2.2/empty/Rakefile +10 -0
  1082. data/test/stub/rails_apps/2.2/empty/app/controllers/application.rb +15 -0
  1083. data/test/stub/rails_apps/2.2/empty/app/helpers/application_helper.rb +3 -0
  1084. data/test/stub/rails_apps/2.2/empty/config/boot.rb +109 -0
  1085. data/test/stub/rails_apps/2.2/empty/config/database.yml +31 -0
  1086. data/test/stub/rails_apps/2.2/empty/config/environment.rb +75 -0
  1087. data/test/stub/rails_apps/{foobar → 2.2/empty}/config/environments/development.rb +0 -0
  1088. data/test/stub/rails_apps/2.2/empty/config/environments/production.rb +24 -0
  1089. data/test/stub/rails_apps/2.2/empty/config/environments/staging.rb +24 -0
  1090. data/test/stub/rails_apps/2.2/empty/config/environments/test.rb +22 -0
  1091. data/test/stub/rails_apps/2.2/empty/config/initializers/inflections.rb +10 -0
  1092. data/test/stub/rails_apps/{mycook → 2.2/empty}/config/initializers/mime_types.rb +0 -0
  1093. data/test/stub/rails_apps/2.2/empty/config/initializers/new_rails_defaults.rb +17 -0
  1094. data/test/stub/rails_apps/2.2/empty/config/locales/en.yml +5 -0
  1095. data/test/stub/rails_apps/2.2/empty/config/routes.rb +43 -0
  1096. data/test/stub/rails_apps/2.2/empty/doc/README_FOR_APP +5 -0
  1097. data/test/stub/rails_apps/2.2/empty/public/404.html +30 -0
  1098. data/test/stub/rails_apps/2.2/empty/public/422.html +30 -0
  1099. data/test/stub/rails_apps/2.2/empty/public/500.html +33 -0
  1100. data/test/stub/rails_apps/2.2/empty/public/dispatch.cgi +10 -0
  1101. data/test/stub/rails_apps/2.2/empty/public/dispatch.fcgi +24 -0
  1102. data/test/stub/rails_apps/2.2/empty/public/dispatch.rb +10 -0
  1103. data/test/stub/rails_apps/2.2/empty/public/favicon.ico +0 -0
  1104. data/test/stub/rails_apps/2.2/empty/public/images/rails.png +0 -0
  1105. data/test/stub/rails_apps/2.2/empty/public/robots.txt +5 -0
  1106. data/test/stub/rails_apps/2.2/empty/script/about +4 -0
  1107. data/test/stub/rails_apps/2.2/empty/script/console +3 -0
  1108. data/test/stub/rails_apps/2.2/empty/script/dbconsole +3 -0
  1109. data/test/stub/rails_apps/2.2/empty/script/destroy +3 -0
  1110. data/test/stub/rails_apps/2.2/empty/script/generate +3 -0
  1111. data/test/stub/rails_apps/2.2/empty/script/performance/benchmarker +3 -0
  1112. data/test/stub/rails_apps/2.2/empty/script/performance/profiler +3 -0
  1113. data/test/stub/rails_apps/2.2/empty/script/performance/request +3 -0
  1114. data/test/stub/rails_apps/2.2/empty/script/plugin +3 -0
  1115. data/test/stub/rails_apps/2.2/empty/script/process/inspector +3 -0
  1116. data/test/stub/rails_apps/2.2/empty/script/process/reaper +3 -0
  1117. data/test/stub/rails_apps/2.2/empty/script/process/spawner +3 -0
  1118. data/test/stub/rails_apps/2.2/empty/script/runner +3 -0
  1119. data/test/stub/rails_apps/2.2/empty/script/server +3 -0
  1120. data/test/stub/rails_apps/2.2/empty/test/performance/browsing_test.rb +9 -0
  1121. data/test/stub/rails_apps/2.2/empty/test/test_helper.rb +38 -0
  1122. data/test/stub/rails_apps/2.3/empty/Rakefile +10 -0
  1123. data/test/stub/rails_apps/2.3/empty/app/controllers/application_controller.rb +10 -0
  1124. data/test/stub/rails_apps/2.3/empty/app/helpers/application_helper.rb +3 -0
  1125. data/test/stub/rails_apps/2.3/empty/config/boot.rb +110 -0
  1126. data/test/stub/rails_apps/2.3/empty/config/database.yml +31 -0
  1127. data/test/stub/rails_apps/2.3/empty/config/environment.rb +41 -0
  1128. data/test/stub/rails_apps/2.3/empty/config/environments/development.rb +17 -0
  1129. data/test/stub/rails_apps/2.3/empty/config/environments/production.rb +28 -0
  1130. data/test/stub/rails_apps/2.3/empty/config/environments/staging.rb +28 -0
  1131. data/test/stub/rails_apps/2.3/empty/config/environments/test.rb +28 -0
  1132. data/test/stub/rails_apps/2.3/empty/config/initializers/backtrace_silencers.rb +7 -0
  1133. data/test/stub/rails_apps/2.3/empty/config/initializers/inflections.rb +10 -0
  1134. data/test/stub/rails_apps/2.3/empty/config/initializers/mime_types.rb +5 -0
  1135. data/test/stub/rails_apps/2.3/empty/config/initializers/new_rails_defaults.rb +21 -0
  1136. data/test/stub/rails_apps/2.3/empty/config/initializers/session_store.rb +15 -0
  1137. data/test/stub/rails_apps/2.3/empty/config/locales/en.yml +5 -0
  1138. data/test/stub/rails_apps/2.3/empty/config/routes.rb +43 -0
  1139. data/test/stub/rails_apps/2.3/empty/db/seeds.rb +7 -0
  1140. data/test/stub/rails_apps/2.3/empty/doc/README_FOR_APP +2 -0
  1141. data/test/stub/rails_apps/2.3/empty/public/404.html +30 -0
  1142. data/test/stub/rails_apps/2.3/empty/public/422.html +30 -0
  1143. data/test/stub/rails_apps/2.3/empty/public/500.html +30 -0
  1144. data/test/stub/rails_apps/2.3/empty/public/favicon.ico +0 -0
  1145. data/test/stub/rails_apps/2.3/empty/public/images/rails.png +0 -0
  1146. data/test/stub/rails_apps/2.3/empty/public/robots.txt +5 -0
  1147. data/test/stub/rails_apps/2.3/empty/script/about +4 -0
  1148. data/test/stub/rails_apps/2.3/empty/script/console +3 -0
  1149. data/test/stub/rails_apps/2.3/empty/script/dbconsole +3 -0
  1150. data/test/stub/rails_apps/2.3/empty/script/destroy +3 -0
  1151. data/test/stub/rails_apps/2.3/empty/script/generate +3 -0
  1152. data/test/stub/rails_apps/2.3/empty/script/performance/benchmarker +3 -0
  1153. data/test/stub/rails_apps/2.3/empty/script/performance/profiler +3 -0
  1154. data/test/stub/rails_apps/2.3/empty/script/plugin +3 -0
  1155. data/test/stub/rails_apps/2.3/empty/script/runner +3 -0
  1156. data/test/stub/rails_apps/2.3/empty/script/server +3 -0
  1157. data/test/stub/rails_apps/2.3/empty/test/performance/browsing_test.rb +9 -0
  1158. data/test/stub/rails_apps/2.3/empty/test/test_helper.rb +38 -0
  1159. data/test/stub/rails_apps/2.3/foobar/Rakefile +10 -0
  1160. data/test/stub/rails_apps/{foobar/app/controllers/application.rb → 2.3/foobar/app/controllers/application_controller.rb} +0 -0
  1161. data/test/stub/rails_apps/{foobar → 2.3/foobar}/app/controllers/bar_controller_1.rb +0 -0
  1162. data/test/stub/rails_apps/{foobar → 2.3/foobar}/app/controllers/bar_controller_2.rb +0 -0
  1163. data/test/stub/rails_apps/{foobar → 2.3/foobar}/app/controllers/foo_controller.rb +0 -0
  1164. data/test/stub/rails_apps/2.3/foobar/app/helpers/application_helper.rb +3 -0
  1165. data/test/stub/rails_apps/2.3/foobar/config/boot.rb +110 -0
  1166. data/test/stub/rails_apps/{foobar → 2.3/foobar}/config/database.yml +0 -0
  1167. data/test/stub/rails_apps/{foobar → 2.3/foobar}/config/environment.rb +1 -1
  1168. data/test/stub/rails_apps/2.3/foobar/config/environments/development.rb +17 -0
  1169. data/test/stub/rails_apps/2.3/foobar/config/environments/production.rb +18 -0
  1170. data/test/stub/rails_apps/2.3/foobar/config/environments/staging.rb +18 -0
  1171. data/test/stub/rails_apps/{mycook → 2.3/foobar}/config/initializers/inflections.rb +0 -0
  1172. data/test/stub/rails_apps/2.3/foobar/config/initializers/mime_types.rb +5 -0
  1173. data/test/stub/rails_apps/2.3/foobar/config/routes.rb +35 -0
  1174. data/test/stub/rails_apps/2.3/foobar/script/about +3 -0
  1175. data/test/stub/rails_apps/2.3/foobar/script/console +3 -0
  1176. data/test/stub/rails_apps/2.3/foobar/script/dbconsole +3 -0
  1177. data/test/stub/rails_apps/2.3/foobar/script/destroy +3 -0
  1178. data/test/stub/rails_apps/2.3/foobar/script/generate +3 -0
  1179. data/test/stub/rails_apps/2.3/foobar/script/performance/benchmarker +3 -0
  1180. data/test/stub/rails_apps/2.3/foobar/script/performance/profiler +3 -0
  1181. data/test/stub/rails_apps/2.3/foobar/script/performance/request +3 -0
  1182. data/test/stub/rails_apps/2.3/foobar/script/plugin +3 -0
  1183. data/test/stub/rails_apps/2.3/foobar/script/process/inspector +3 -0
  1184. data/test/stub/rails_apps/2.3/foobar/script/process/reaper +3 -0
  1185. data/test/stub/rails_apps/2.3/foobar/script/process/spawner +3 -0
  1186. data/test/stub/rails_apps/2.3/foobar/script/runner +3 -0
  1187. data/test/stub/rails_apps/2.3/foobar/script/server +3 -0
  1188. data/test/stub/rails_apps/2.3/mycook/Rakefile +10 -0
  1189. data/test/stub/rails_apps/{mycook/app/controllers/application.rb → 2.3/mycook/app/controllers/application_controller.rb} +0 -0
  1190. data/test/stub/rails_apps/{mycook → 2.3/mycook}/app/controllers/recipes_controller.rb +0 -0
  1191. data/test/stub/rails_apps/{mycook → 2.3/mycook}/app/controllers/uploads_controller.rb +0 -0
  1192. data/test/stub/rails_apps/{mycook → 2.3/mycook}/app/controllers/welcome_controller.rb +0 -0
  1193. data/test/stub/rails_apps/2.3/mycook/app/helpers/application_helper.rb +3 -0
  1194. data/test/stub/rails_apps/{mycook → 2.3/mycook}/app/views/layouts/default.rhtml +0 -0
  1195. data/test/stub/rails_apps/{mycook → 2.3/mycook}/app/views/recipes/create.rhtml +0 -0
  1196. data/test/stub/rails_apps/{mycook → 2.3/mycook}/app/views/recipes/index.rhtml +0 -0
  1197. data/test/stub/rails_apps/{mycook → 2.3/mycook}/app/views/recipes/new.rhtml +0 -0
  1198. data/test/stub/rails_apps/{mycook → 2.3/mycook}/app/views/uploads/index.rhtml +0 -0
  1199. data/test/stub/rails_apps/{mycook → 2.3/mycook}/app/views/uploads/new.html.erb +0 -0
  1200. data/test/stub/rails_apps/{mycook → 2.3/mycook}/app/views/welcome/cached.rhtml +0 -0
  1201. data/test/stub/rails_apps/{mycook → 2.3/mycook}/app/views/welcome/index.rhtml +0 -0
  1202. data/test/stub/rails_apps/2.3/mycook/config/boot.rb +110 -0
  1203. data/test/stub/rails_apps/{mycook → 2.3/mycook}/config/database.yml +0 -0
  1204. data/test/stub/rails_apps/{mycook → 2.3/mycook}/config/environment.rb +1 -1
  1205. data/test/stub/rails_apps/2.3/mycook/config/environments/development.rb +18 -0
  1206. data/test/stub/rails_apps/{mycook → 2.3/mycook}/config/environments/production.rb +0 -0
  1207. data/test/stub/rails_apps/2.3/mycook/config/initializers/inflections.rb +10 -0
  1208. data/test/stub/rails_apps/2.3/mycook/config/initializers/mime_types.rb +5 -0
  1209. data/test/stub/rails_apps/{mycook → 2.3/mycook}/config/routes.rb +0 -0
  1210. data/test/stub/rails_apps/{mycook → 2.3/mycook}/log/useless.txt +0 -0
  1211. data/test/stub/rails_apps/2.3/mycook/public/404.html +30 -0
  1212. data/test/stub/rails_apps/2.3/mycook/public/422.html +30 -0
  1213. data/test/stub/rails_apps/2.3/mycook/public/500.html +30 -0
  1214. data/test/stub/rails_apps/{mycook → 2.3/mycook}/public/dispatch.cgi +0 -0
  1215. data/test/stub/rails_apps/{mycook → 2.3/mycook}/public/dispatch.fcgi +0 -0
  1216. data/test/stub/rails_apps/{mycook → 2.3/mycook}/public/dispatch.rb +1 -1
  1217. data/test/stub/rails_apps/2.3/mycook/public/favicon.ico +0 -0
  1218. data/test/stub/rails_apps/{mycook → 2.3/mycook}/public/images/angrywizard.gif +0 -0
  1219. data/test/stub/rails_apps/{mycook → 2.3/mycook}/public/images/cookbook.gif +0 -0
  1220. data/test/stub/rails_apps/{mycook → 2.3/mycook}/public/images/header.png +0 -0
  1221. data/test/stub/rails_apps/2.3/mycook/public/images/rails.png +0 -0
  1222. data/test/stub/rails_apps/{mycook → 2.3/mycook}/public/javascripts/application.js +0 -0
  1223. data/test/stub/rails_apps/{mycook → 2.3/mycook}/public/javascripts/controls.js +73 -73
  1224. data/test/stub/rails_apps/{mycook → 2.3/mycook}/public/javascripts/dragdrop.js +166 -165
  1225. data/test/stub/rails_apps/{mycook → 2.3/mycook}/public/javascripts/effects.js +174 -166
  1226. data/test/stub/rails_apps/{mycook → 2.3/mycook}/public/javascripts/prototype.js +362 -267
  1227. data/test/stub/rails_apps/2.3/mycook/public/robots.txt +5 -0
  1228. data/test/stub/rails_apps/{mycook → 2.3/mycook}/public/uploads.html +0 -0
  1229. data/test/stub/rails_apps/{mycook → 2.3/mycook}/public/welcome/cached.html +0 -0
  1230. data/test/stub/rails_apps/2.3/mycook/script/about +3 -0
  1231. data/test/stub/rails_apps/2.3/mycook/script/console +3 -0
  1232. data/test/stub/rails_apps/2.3/mycook/script/dbconsole +3 -0
  1233. data/test/stub/rails_apps/2.3/mycook/script/destroy +3 -0
  1234. data/test/stub/rails_apps/2.3/mycook/script/generate +3 -0
  1235. data/test/stub/rails_apps/2.3/mycook/script/performance/benchmarker +3 -0
  1236. data/test/stub/rails_apps/2.3/mycook/script/performance/profiler +3 -0
  1237. data/test/stub/rails_apps/2.3/mycook/script/performance/request +3 -0
  1238. data/test/stub/rails_apps/2.3/mycook/script/plugin +3 -0
  1239. data/test/stub/rails_apps/2.3/mycook/script/process/inspector +3 -0
  1240. data/test/stub/rails_apps/2.3/mycook/script/process/reaper +3 -0
  1241. data/test/stub/rails_apps/2.3/mycook/script/process/spawner +3 -0
  1242. data/test/stub/rails_apps/2.3/mycook/script/runner +3 -0
  1243. data/test/stub/rails_apps/2.3/mycook/script/server +3 -0
  1244. data/test/stub/rails_apps/{mycook → 2.3/mycook}/sites/some.site/public/uploads.html +0 -0
  1245. data/test/stub/rails_apps/{mycook → 2.3/mycook}/sites/some.site/public/welcome/cached.html +0 -0
  1246. data/test/stub/rails_apps/{mycook → 2.3/mycook}/tmp/cache/useless.txt +0 -0
  1247. data/test/stub/rails_apps/{mycook → 2.3/mycook}/tmp/pids/useless.txt +0 -0
  1248. data/test/stub/rails_apps/{mycook → 2.3/mycook}/tmp/sessions/useless.txt +0 -0
  1249. data/test/stub/rails_apps/{mycook → 2.3/mycook}/tmp/sockets/useless.txt +0 -0
  1250. data/test/stub/rails_apps/3.0/empty/Gemfile +22 -0
  1251. data/test/stub/rails_apps/3.0/empty/Rakefile +10 -0
  1252. data/test/stub/rails_apps/3.0/empty/app/controllers/application_controller.rb +4 -0
  1253. data/test/stub/rails_apps/3.0/empty/app/helpers/application_helper.rb +2 -0
  1254. data/test/stub/rails_apps/3.0/empty/app/views/layouts/application.html.erb +14 -0
  1255. data/test/stub/rails_apps/3.0/empty/config.ru +4 -0
  1256. data/test/stub/rails_apps/3.0/empty/config/application.rb +48 -0
  1257. data/test/stub/rails_apps/3.0/empty/config/boot.rb +13 -0
  1258. data/test/stub/rails_apps/3.0/empty/config/database.yml +22 -0
  1259. data/test/stub/rails_apps/3.0/empty/config/environment.rb +5 -0
  1260. data/test/stub/rails_apps/3.0/empty/config/environments/development.rb +19 -0
  1261. data/test/stub/rails_apps/3.0/empty/config/environments/production.rb +48 -0
  1262. data/test/stub/rails_apps/3.0/empty/config/environments/test.rb +32 -0
  1263. data/test/stub/rails_apps/3.0/empty/config/initializers/backtrace_silencers.rb +7 -0
  1264. data/test/stub/rails_apps/3.0/empty/config/initializers/inflections.rb +10 -0
  1265. data/test/stub/rails_apps/3.0/empty/config/initializers/mime_types.rb +5 -0
  1266. data/test/stub/rails_apps/3.0/empty/config/initializers/passenger.rb +1 -0
  1267. data/test/stub/rails_apps/3.0/empty/config/initializers/secret_token.rb +7 -0
  1268. data/test/stub/rails_apps/3.0/empty/config/initializers/session_store.rb +8 -0
  1269. data/test/stub/rails_apps/3.0/empty/config/locales/en.yml +5 -0
  1270. data/test/stub/rails_apps/3.0/empty/config/routes.rb +58 -0
  1271. data/test/stub/rails_apps/3.0/empty/db/seeds.rb +7 -0
  1272. data/test/stub/rails_apps/3.0/empty/doc/README_FOR_APP +2 -0
  1273. data/test/stub/rails_apps/3.0/empty/log/development.log +3 -0
  1274. data/test/stub/rails_apps/3.0/empty/public/404.html +26 -0
  1275. data/test/stub/rails_apps/3.0/empty/public/422.html +26 -0
  1276. data/test/stub/rails_apps/3.0/empty/public/500.html +26 -0
  1277. data/test/stub/rails_apps/3.0/empty/public/favicon.ico +0 -0
  1278. data/test/stub/rails_apps/3.0/empty/public/index.html +279 -0
  1279. data/test/stub/rails_apps/3.0/empty/public/robots.txt +5 -0
  1280. data/test/stub/rails_apps/3.0/empty/script/rails +9 -0
  1281. data/test/stub/rails_apps/3.0/empty/test/performance/browsing_test.rb +9 -0
  1282. data/test/stub/rails_apps/3.0/empty/test/test_helper.rb +13 -0
  1283. data/test/stub/spawn_server.rb +4 -2
  1284. data/test/stub/vendor_rails/minimal/actionpack/lib/action_controller.rb +3 -0
  1285. data/test/stub/vendor_rails/minimal/railties/lib/initializer.rb +7 -2
  1286. data/test/support/apache2_controller.rb +10 -2
  1287. data/test/support/nginx_controller.rb +3 -2
  1288. data/test/support/test_helper.rb +282 -46
  1289. data/test/{support → tut}/tut.h +6 -0
  1290. data/test/{support → tut}/tut_reporter.h +0 -0
  1291. metadata +824 -266
  1292. data/benchmark/ApplicationPool.cpp +0 -52
  1293. data/benchmark/accept_vs_socketpair_vs_named_pipes.rb +0 -126
  1294. data/benchmark/dispatcher.rb +0 -42
  1295. data/benchmark/overhead_of_password_checking.rb +0 -81
  1296. data/benchmark/socket_connections_vs_persistent_pipe.rb +0 -99
  1297. data/benchmark/unix_sockets_vs_pipes.rb +0 -83
  1298. data/ext/boost/LICENSE.TXT +0 -23
  1299. data/ext/boost/VERSION.TXT +0 -1
  1300. data/ext/boost/detail/sp_counted_base.hpp +0 -81
  1301. data/ext/boost/src/pthread/exceptions.cpp +0 -146
  1302. data/ext/boost/src/win32/exceptions.cpp +0 -124
  1303. data/ext/boost/src/win32/thread.cpp +0 -629
  1304. data/ext/boost/src/win32/timeconv.inl +0 -130
  1305. data/ext/boost/src/win32/tss_dll.cpp +0 -72
  1306. data/ext/boost/src/win32/tss_pe.cpp +0 -269
  1307. data/ext/boost/thread/pthread/thread.hpp +0 -339
  1308. data/ext/boost/thread/pthread/tss.hpp +0 -103
  1309. data/ext/common/Application.h +0 -511
  1310. data/ext/common/ApplicationPoolServer.h +0 -794
  1311. data/ext/common/ApplicationPoolServerExecutable.cpp +0 -743
  1312. data/ext/common/ApplicationPoolStatusReporter.h +0 -336
  1313. data/ext/common/DummySpawnManager.h +0 -108
  1314. data/ext/common/StandardApplicationPool.h +0 -821
  1315. data/ext/common/SystemTime.h +0 -88
  1316. data/lib/phusion_passenger/admin_tools/control_process.rb +0 -150
  1317. data/lib/phusion_passenger/railz/application_spawner.rb +0 -463
  1318. data/lib/phusion_passenger/templates/invalid_app_root.html.erb +0 -9
  1319. data/test/ApplicationPoolServerTest.cpp +0 -114
  1320. data/test/ApplicationPoolServer_ApplicationPoolTest.cpp +0 -33
  1321. data/test/ApplicationPoolTest.cpp +0 -599
  1322. data/test/MessageChannelTest.cpp +0 -320
  1323. data/test/SpawnManagerTest.cpp +0 -64
  1324. data/test/StandardApplicationPoolTest.cpp +0 -27
  1325. data/test/StaticStringTest.cpp +0 -51
  1326. data/test/UtilsTest.cpp +0 -257
  1327. data/test/ruby/rails/application_spawner_spec.rb +0 -159
  1328. data/test/ruby/rails/framework_spawner_spec.rb +0 -133
  1329. data/test/ruby/rails/minimal_spawner_spec.rb +0 -93
  1330. data/test/ruby/rails/spawner_error_handling_spec.rb +0 -107
  1331. data/test/ruby/rails/spawner_privilege_lowering_spec.rb +0 -97
  1332. data/test/ruby/spawn_server_spec.rb +0 -26
  1333. data/test/stub/MessageServer.dSYM/Contents/Info.plist +0 -25
  1334. data/test/stub/MessageServer.dSYM/Contents/Resources/DWARF/MessageServer +0 -0
  1335. data/test/support/Support.cpp +0 -84
  1336. data/test/support/Support.h +0 -118
  1337. data/test/support/config.rb +0 -38
  1338. data/test/support/run_rspec_tests.rb +0 -10
@@ -2,8 +2,8 @@
2
2
  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3
3
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4
4
  <head>
5
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
- <meta name="generator" content="AsciiDoc 8.5.2" />
5
+ <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
6
+ <meta name="generator" content="AsciiDoc 8.6.1" />
7
7
  <title>Phusion Passenger users guide, Nginx version</title>
8
8
  <style type="text/css">
9
9
  /* Debug borders */
@@ -180,8 +180,8 @@ div.quoteblock > div.attribution {
180
180
  text-align: right;
181
181
  }
182
182
 
183
- div.verseblock > div.content {
184
- white-space: pre;
183
+ div.verseblock > pre.content {
184
+ font-family: inherit;
185
185
  }
186
186
  div.verseblock > div.attribution {
187
187
  padding-top: 0.75em;
@@ -260,6 +260,7 @@ div.tableblock > table {
260
260
  thead, p.table.header {
261
261
  font-family: sans-serif;
262
262
  font-weight: bold;
263
+ color: #527bbd;
263
264
  }
264
265
  tfoot {
265
266
  font-weight: bold;
@@ -339,6 +340,14 @@ span.footnote, span.footnoteref {
339
340
  min-width: 100px;
340
341
  }
341
342
 
343
+ div.colist td {
344
+ padding-right: 0.5em;
345
+ padding-bottom: 0.3em;
346
+ vertical-align: top;
347
+ }
348
+ div.colist td img {
349
+ margin-top: 0.3em;
350
+ }
342
351
 
343
352
  @media print {
344
353
  div#footer-badges { display: none; }
@@ -373,47 +382,7 @@ div.toclevel4 {
373
382
  margin-left: 6em;
374
383
  font-size: 0.9em;
375
384
  }
376
- /* Workarounds for IE6's broken and incomplete CSS2. */
377
-
378
- div.sidebar-content {
379
- background: #ffffee;
380
- border: 1px solid silver;
381
- padding: 0.5em;
382
- }
383
- div.sidebar-title, div.image-title {
384
- color: #527bbd;
385
- font-family: sans-serif;
386
- font-weight: bold;
387
- margin-top: 0.0em;
388
- margin-bottom: 0.5em;
389
- }
390
-
391
- div.listingblock div.content {
392
- border: 1px solid silver;
393
- background: #f4f4f4;
394
- padding: 0.5em;
395
- }
396
-
397
- div.quoteblock-attribution {
398
- padding-top: 0.5em;
399
- text-align: right;
400
- }
401
-
402
- div.verseblock-content {
403
- white-space: pre;
404
- }
405
- div.verseblock-attribution {
406
- padding-top: 0.75em;
407
- text-align: left;
408
- }
409
385
 
410
- div.exampleblock-content {
411
- border-left: 3px solid #dddddd;
412
- padding-left: 0.5em;
413
- }
414
-
415
- /* IE6 sets dynamically generated links as visited. */
416
- div#toc a:visited { color: blue; }
417
386
  </style>
418
387
  <script type="text/javascript">
419
388
  /*<![CDATA[*/
@@ -549,12 +518,12 @@ footnotes: function () {
549
518
  /*]]>*/
550
519
  </script>
551
520
  </head>
552
- <body>
521
+ <body class="article">
553
522
  <div id="header">
554
523
  <h1>Phusion Passenger users guide, Nginx version</h1>
555
- <div id="toc">
556
- <div id="toctitle">Table of Contents</div>
557
- <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
524
+ <div id="toc">
525
+ <div id="toctitle">Table of Contents</div>
526
+ <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
558
527
  </div>
559
528
  </div>
560
529
  <div id="content">
@@ -601,38 +570,46 @@ How to solve common problems.
601
570
  using the commandline.</p></div>
602
571
  </div>
603
572
  </div>
604
- <h2 id="_supported_operating_systems">1. Supported operating systems</h2>
573
+ <div class="sect1">
574
+ <h2 id="_support_information">1. Support information</h2>
605
575
  <div class="sectionbody">
576
+ <div class="sect2">
577
+ <h3 id="_supported_operating_systems">1.1. Supported operating systems</h3>
606
578
  <div class="paragraph"><p>Phusion Passenger works on any POSIX-compliant operating system. In other
607
579
  words: practically any operating system on earth, except Microsoft Windows.</p></div>
608
- <div class="paragraph"><p>Phusion Passenger for Nginx has been tested on:</p></div>
580
+ <div class="paragraph"><p>Phusion Passenger is confirmed on a large number of operating systems and Linux
581
+ distributions, including, but not limited to, Ubuntu, Debian, CentOS/Fedora/RHEL,
582
+ Gentoo, Mac OS X, FreeBSD and Solaris. Both 32-bit and 64-bit platforms are supported.
583
+ Please
584
+ <a href="http://code.google.com/p/phusion-passenger/issues/list">report a bug</a>
585
+ or
586
+ <a href="http://groups.google.com/group/phusion-passenger">join our discussion forum</a>
587
+ if it doesn&#8217;t work on your POSIX-compliant operating system.</p></div>
588
+ </div>
589
+ <div class="sect2">
590
+ <h3 id="_where_to_get_support">1.2. Where to get support</h3>
609
591
  <div class="ulist"><ul>
610
592
  <li>
611
593
  <p>
612
- Ubuntu Linux 8.04 (x86)
613
- </p>
614
- </li>
615
- <li>
616
- <p>
617
- Gentoo Linux (AMD64)
594
+ <a href="http://code.google.com/p/phusion-passenger/issues/list">Issue tracker</a> - report
595
+ bugs here.
618
596
  </p>
619
597
  </li>
620
598
  <li>
621
599
  <p>
622
- MacOS X Leopard (x86)
600
+ <a href="http://groups.google.com/group/phusion-passenger">Discussion forum</a> - post a
601
+ message here if you&#8217;re experiencing problems.
623
602
  </p>
624
603
  </li>
625
604
  </ul></div>
626
- <div class="paragraph"><p>Other operating systems have not been tested, but Phusion Passenger will probably
627
- work fine on them. Please
628
- <a href="http://code.google.com/p/phusion-passenger/issues/list">report a bug</a>
629
- or
630
- <a href="http://groups.google.com/group/phusion-passenger">join our discussion list</a>
631
- if it doesn&#8217;t.</p></div>
632
605
  </div>
633
- <h2 id="install_passenger">2. Installing Phusion Passenger</h2>
606
+ </div>
607
+ </div>
608
+ <div class="sect1">
609
+ <h2 id="_installing_phusion_passenger">2. Installing Phusion Passenger</h2>
634
610
  <div class="sectionbody">
635
- <h3 id="_overview">2.1. Overview</h3><div style="clear:left"></div>
611
+ <div class="sect2">
612
+ <h3 id="_overview">2.1. Overview</h3>
636
613
  <div class="paragraph"><p>As you might already know, Nginx does not support loadable modules, in contrast
637
614
  to most other web servers (e.g. Apache). Therefore, to install Phusion Passenger
638
615
  for Nginx, one must recompile and reinstall Nginx with Phusion Passenger support.
@@ -666,7 +643,9 @@ as <em>root</em>. If the installer fails because of permission errors, it will t
666
643
  you.</td>
667
644
  </tr></table>
668
645
  </div>
669
- <h3 id="specifying_ruby_installation">2.2. Specifying the correct Ruby installation</h3><div style="clear:left"></div>
646
+ </div>
647
+ <div class="sect2">
648
+ <h3 id="specifying_ruby_installation">2.2. Specifying the correct Ruby installation</h3>
670
649
  <div class="paragraph"><p>If your system has multiple Ruby installations&#8201;&#8212;&#8201;which is likely the case on
671
650
  MacOS X, or if you&#8217;ve also installed
672
651
  <a href="http://www.rubyenterpriseedition.com">Ruby Enterprise Edition</a>&#8201;&#8212;&#8201;then you
@@ -694,11 +673,15 @@ following Ruby installations:</p></div>
694
673
  <div class="content">
695
674
  <pre><tt>export PATH=/opt/myruby/bin:$PATH</tt></pre>
696
675
  </div></div>
697
- <h3 id="_installing_phusion_passenger_for_nginx_through_the_installer">2.3. Installing Phusion Passenger for Nginx through the installer</h3><div style="clear:left"></div>
676
+ </div>
677
+ <div class="sect2">
678
+ <h3 id="_installing_phusion_passenger_for_nginx_through_the_installer">2.3. Installing Phusion Passenger for Nginx through the installer</h3>
679
+ <div class="sect3">
698
680
  <h4 id="_obtaining_the_phusion_passenger_files_and_running_the_installer">2.3.1. Obtaining the Phusion Passenger files and running the installer</h4>
699
681
  <div class="paragraph"><p>You must obtain the Phusion Passenger files in order to run the installer.
700
682
  This can be done either by installing the Phusion Passenger gem, or by
701
683
  downloading the source tarball.</p></div>
684
+ <div class="sect4">
702
685
  <h5 id="_gem">Gem</h5>
703
686
  <div class="paragraph"><p>First, install the Phusion Passenger gem by running:</p></div>
704
687
  <div class="listingblock">
@@ -711,6 +694,8 @@ downloading the source tarball.</p></div>
711
694
  <pre><tt>passenger-install-nginx-module</tt></pre>
712
695
  </div></div>
713
696
  <div class="paragraph"><p>Please follow the instructions given by the installer.</p></div>
697
+ </div>
698
+ <div class="sect4">
714
699
  <h5 id="_source_tarball">Source tarball</h5>
715
700
  <div class="paragraph"><p>The source tarball can be download from the
716
701
  <a href="http://www.modrails.com/">Phusion Passenger website</a>. Extract the tarball to
@@ -737,13 +722,19 @@ tar xzvf ~/YourDownloadsFolder/passenger-x.x.x.tar.gz</tt></pre>
737
722
  Furthermore, the passenger-x.x.x folder must be accessible by Nginx.</td>
738
723
  </tr></table>
739
724
  </div>
725
+ </div>
726
+ </div>
727
+ <div class="sect3">
740
728
  <h4 id="_non_interactive_automatic_installation">2.3.2. Non-interactive/automatic installation</h4>
741
729
  <div class="paragraph"><p>By default, the installer is interactive. If you want to automate installation,
742
730
  then you can do so by passing various answers to the installer through command
743
731
  line options.</p></div>
744
732
  <div class="paragraph"><p>Please run the installer with <tt>--help</tt> for a list of available command line
745
733
  options.</p></div>
746
- <h3 id="_installing_phusion_passenger_for_nginx_manually">2.4. Installing Phusion Passenger for Nginx manually</h3><div style="clear:left"></div>
734
+ </div>
735
+ </div>
736
+ <div class="sect2">
737
+ <h3 id="_installing_phusion_passenger_for_nginx_manually">2.4. Installing Phusion Passenger for Nginx manually</h3>
747
738
  <div class="paragraph"><p>You can also install Phusion Passenger the way you install any other Nginx module.
748
739
  To do this, run Nginx&#8217;s configure script with <tt>--add-module=/path-to-passenger-root/ext/nginx</tt>.</p></div>
749
740
  <div class="paragraph"><p>If you installed Phusion Passenger via the gem, then <em>path-to-passenger-root</em>
@@ -758,7 +749,116 @@ so you&#8217;ll probably have to specify something like <tt>--add-module=/usr/li
758
749
  is the directory which contains the Phusion Passenger source code. So if you
759
750
  extracted the Phusion Passenger source code to <em>/opt/passenger-x.x.x</em>, then you&#8217;ll
760
751
  have to specify <tt>--add-module=/opt/passenger-x.x.x/ext/nginx</tt>.</p></div>
752
+ <div class="paragraph"><p>After having installed Nginx with Phusion Passenger support, you must paste the following
753
+ line into your Nginx configuration file:</p></div>
754
+ <div class="listingblock">
755
+ <div class="content">
756
+ <pre><tt>passenger_root /path-to-passenger-root;</tt></pre>
757
+ </div></div>
758
+ <div class="paragraph"><p>After having done so, restart Nginx.</p></div>
759
+ </div>
760
+ <div class="sect2">
761
+ <h3 id="_upgrading_or_downgrading_phusion_passenger_or_nginx_itself">2.5. Upgrading or downgrading Phusion Passenger or Nginx itself</h3>
762
+ <div class="paragraph"><p>Whether you&#8217;re upgrading/downgrading Phusion Passenger or Nginx itself (or perhaps both),
763
+ Nginx will have to be recompiled and reinstalled. The procedure is exactly the same as
764
+ a normal installation so just follow the instructions in section 2.3 or 2.4.</p></div>
765
+ <div class="paragraph"><p>When following the installation instructions, eventually <tt>passenger-install-nginx-module</tt>
766
+ or this document will instruct you to copy &amp; paste some settings into the Nginx
767
+ configuration file; something that looks along the lines of:</p></div>
768
+ <div class="listingblock">
769
+ <div class="content">
770
+ <pre><tt>passenger_root ...;
771
+ passenger_ruby ...;</tt></pre>
772
+ </div></div>
773
+ <div class="paragraph"><p>Because you already had Phusion Passenger installed, you already had similar settings
774
+ in your Nginx configuration file, just with different values. <strong>Replace</strong> the old settings with
775
+ the new ones that you are instructed to paste. It is important that the old settings are
776
+ removed, otherwise Phusion Passenger may malfunction.</p></div>
777
+ <div class="paragraph"><p>When you&#8217;re done, restart Nginx.</p></div>
778
+ </div>
779
+ <div class="sect2">
780
+ <h3 id="_unloading_disabling_phusion_passenger_from_nginx_without_uninstalling_it">2.6. Unloading (disabling) Phusion Passenger from Nginx without uninstalling it</h3>
781
+ <div class="paragraph"><p>You can temporarily unload (disable) Phusion Passenger from Nginx, without
782
+ uninstalling the Phusion Passenger files, so that Nginx behaves as if Phusion
783
+ Passenger was never installed in the first place. This might be useful to you if,
784
+ for example, you seem to be experiencing a problem caused by Phusion Passenger,
785
+ but you want to make sure whether that&#8217;s actually the case, without having
786
+ to through the hassle of uninstalling Phusion Passenger completely. When disabled,
787
+ Phusion Passenger will not occupy any memory or CPU or otherwise interfere with
788
+ Nginx.</p></div>
789
+ <div class="paragraph"><p>To unload Phusion Passenger, edit your Nginx configuration file(s)
790
+ and comment out all Phusion Passenger configuration directives.</p></div>
791
+ <div class="paragraph"><p>For example, if your configuration file looks like this&#8230;</p></div>
792
+ <div class="listingblock">
793
+ <div class="content">
794
+ <pre><tt>...
795
+
796
+ http {
797
+ passenger_root /somewhere/passenger-x.x.x;
798
+ passenger_ruby /usr/bin/ruby;
799
+ passenger_max_pool_size 10;
800
+
801
+ gzip on;
802
+
803
+ server {
804
+ server_name www.foo.com;
805
+ listen 80;
806
+ root /webapps/foo/public;
807
+ passenger_enabled on;
808
+ passenger_use_global_queue on;
809
+ }
810
+ }</tt></pre>
811
+ </div></div>
812
+ <div class="paragraph"><p>&#8230;then comment out the relevant directives, so that it looks like this:</p></div>
813
+ <div class="listingblock">
814
+ <div class="content">
815
+ <pre><tt>...
816
+
817
+ http {
818
+ # passenger_root /somewhere/passenger-x.x.x;
819
+ # passenger_ruby /usr/bin/ruby;
820
+ # passenger_max_pool_size 10;
821
+
822
+ gzip on;
823
+
824
+ server {
825
+ server_name www.foo.com;
826
+ listen 80;
827
+ root /webapps/foo/public;
828
+ # passenger_enabled on;
829
+ # passenger_use_global_queue on;
830
+ }
831
+ }</tt></pre>
832
+ </div></div>
833
+ <div class="paragraph"><p>After you&#8217;ve done this, save the file and restart Nginx.</p></div>
834
+ </div>
835
+ <div class="sect2">
836
+ <h3 id="_uninstalling_phusion_passenger">2.7. Uninstalling Phusion Passenger</h3>
837
+ <div class="paragraph"><p>To uninstall Phusion Passenger, please first remove all Phusion Passenger
838
+ configuration directives from your Nginx configuration file(s). After you&#8217;ve
839
+ done this, you need to remove the Phusion Passenger files.</p></div>
840
+ <div class="ulist"><ul>
841
+ <li>
842
+ <p>
843
+ If you installed Phusion Passenger via a gem, then type <tt>gem uninstall passenger</tt>.
844
+ You might have to run this as root.
845
+ </p>
846
+ </li>
847
+ <li>
848
+ <p>
849
+ If you installed Phusion Passenger via a source tarball, then remove the directory
850
+ in which you placed the extracted Phusion Passenger files. This directory is the
851
+ same as the one pointed to the by <em>PassengerRoot</em> configuration directive.
852
+ </p>
853
+ </li>
854
+ </ul></div>
855
+ <div class="paragraph"><p>After having done so, recompile and reinstall Nginx itself, this time without
856
+ Phusion Passenger support, in order to purge any Phusion Passenger code from the
857
+ Nginx binary.</p></div>
858
+ </div>
859
+ </div>
761
860
  </div>
861
+ <div class="sect1">
762
862
  <h2 id="deploying_a_ror_app">3. Deploying a Ruby on Rails application</h2>
763
863
  <div class="sectionbody">
764
864
  <div class="paragraph"><p>Suppose you have a Ruby on Rails application in <em>/webapps/mycook</em>, and you own
@@ -776,7 +876,8 @@ are run, is &#8220;production&#8221;. You can change this by changing the
776
876
  <a href="#RailsEnv">rails_env</a> configuration option.</td>
777
877
  </tr></table>
778
878
  </div>
779
- <h3 id="_deploying_to_a_virtual_host_8217_s_root">3.1. Deploying to a virtual host&#8217;s root</h3><div style="clear:left"></div>
879
+ <div class="sect2">
880
+ <h3 id="_deploying_to_a_virtual_host_8217_s_root">3.1. Deploying to a virtual host&#8217;s root</h3>
780
881
  <div class="paragraph"><p>Add a <em>server</em> virtual host entry to your Nginx configuration file. The virtual
781
882
  host&#8217;s root must point to your Ruby on Rails application&#8217;s <em>public</em> folder.</p></div>
782
883
  <div class="paragraph"><p>Inside the <em>server</em> block, set <em>passenger_enabled on</em>.</p></div>
@@ -797,7 +898,9 @@ host&#8217;s root must point to your Ruby on Rails application&#8217;s <em>publi
797
898
  }</tt></pre>
798
899
  </div></div>
799
900
  <div class="paragraph"><p>Then restart Nginx. The application has now been deployed.</p></div>
800
- <h3 id="deploying_rails_to_sub_uri">3.2. Deploying to a sub URI</h3><div style="clear:left"></div>
901
+ </div>
902
+ <div class="sect2">
903
+ <h3 id="deploying_rails_to_sub_uri">3.2. Deploying to a sub URI</h3>
801
904
  <div class="paragraph"><p>Suppose that you already have a <em>server</em> virtual host entry:</p></div>
802
905
  <div class="listingblock">
803
906
  <div class="content">
@@ -815,8 +918,8 @@ host&#8217;s root must point to your Ruby on Rails application&#8217;s <em>publi
815
918
  </div></div>
816
919
  <div class="paragraph"><p>And you want your Ruby on Rails application to be accessible from the URL
817
920
  <em>http://www.phusion.nl/rails</em>.</p></div>
818
- <div class="paragraph"><p>To do this, make a symlink from your Ruby on Rails application&#8217;s <em>public</em>
819
- folder to a directory in the document root. For example:</p></div>
921
+ <div class="paragraph"><p>To do this, make a symlink in the virtual host&#8217;s document root, and have it
922
+ point to your Ruby on Rails application&#8217;s <em>public</em> folder. For example:</p></div>
820
923
  <div class="listingblock">
821
924
  <div class="content">
822
925
  <pre><tt>ln -s /webapps/mycook/public /websites/phusion/rails</tt></pre>
@@ -860,7 +963,9 @@ option to the <em>server</em> block:</p></div>
860
963
  </td>
861
964
  </tr></table>
862
965
  </div>
863
- <h3 id="_redeploying_restarting_the_ruby_on_rails_application">3.3. Redeploying (restarting the Ruby on Rails application)</h3><div style="clear:left"></div>
966
+ </div>
967
+ <div class="sect2">
968
+ <h3 id="_redeploying_restarting_the_ruby_on_rails_application">3.3. Redeploying (restarting the Ruby on Rails application)</h3>
864
969
  <div class="paragraph"><p>Deploying a new version of a Ruby on Rails application is as simple as
865
970
  re-uploading the application files, and restarting the application.</p></div>
866
971
  <div class="paragraph"><p>There are two ways to restart the application:</p></div>
@@ -888,14 +993,21 @@ command line:</p></div>
888
993
  is not automatically deleted. Phusion Passenger checks whether the timestamp
889
994
  of this file has changed in order to determine whether the application should
890
995
  be restarted.</p></div>
891
- <h3 id="_migrations">3.4. Migrations</h3><div style="clear:left"></div>
996
+ </div>
997
+ <div class="sect2">
998
+ <h3 id="_migrations">3.4. Migrations</h3>
892
999
  <div class="paragraph"><p>Phusion Passenger is not related to Ruby on Rails migrations in any way. To
893
1000
  run migrations on your deployment server, please login to your deployment
894
1001
  server (e.g. with <em>ssh</em>) and type <tt>rake db:migrate RAILS_ENV=production</tt> in
895
1002
  a shell console, just like one would normally run migrations.</p></div>
896
- <h3 id="_capistrano_integration">3.5. Capistrano integration</h3><div style="clear:left"></div>
1003
+ </div>
1004
+ <div class="sect2">
1005
+ <h3 id="_capistrano_integration">3.5. Capistrano integration</h3>
897
1006
  <div class="paragraph"><p>See <a href="#capistrano">Capistrano recipe</a>.</p></div>
898
1007
  </div>
1008
+ </div>
1009
+ </div>
1010
+ <div class="sect1">
899
1011
  <h2 id="deploying_a_rack_app">4. Deploying a Rack-based Ruby application</h2>
900
1012
  <div class="sectionbody">
901
1013
  <div class="paragraph"><p>Phusion Passenger supports arbitrary Ruby web applications that follow the
@@ -947,7 +1059,8 @@ are run, is &#8220;production&#8221;. You can change this by changing the
947
1059
  <a href="#RackEnv">rack_env</a> configuration option.</td>
948
1060
  </tr></table>
949
1061
  </div>
950
- <h3 id="_tutorial_example_writing_and_deploying_a_hello_world_rack_application">4.1. Tutorial/example: writing and deploying a Hello World Rack application</h3><div style="clear:left"></div>
1062
+ <div class="sect2">
1063
+ <h3 id="_tutorial_example_writing_and_deploying_a_hello_world_rack_application">4.1. Tutorial/example: writing and deploying a Hello World Rack application</h3>
951
1064
  <div class="paragraph"><p>First we create a Phusion Passenger-compliant Rack directory structure:</p></div>
952
1065
  <div class="listingblock">
953
1066
  <div class="content">
@@ -968,7 +1081,7 @@ end
968
1081
  run app</tt></pre>
969
1082
  </div></div>
970
1083
  <div class="paragraph"><p>Finally, we deploy it by adding the following configuration options to
971
- the Apache configuration file:</p></div>
1084
+ the Nginx configuration file:</p></div>
972
1085
  <div class="listingblock">
973
1086
  <div class="content">
974
1087
  <pre><tt>http {
@@ -984,7 +1097,9 @@ the Apache configuration file:</p></div>
984
1097
  </div></div>
985
1098
  <div class="paragraph"><p>And we&#8217;re done! After an Nginx restart, the above Rack application will be available
986
1099
  under the URL <em>http://www.rackexample.com/</em>.</p></div>
987
- <h3 id="_deploying_to_a_virtual_host_8217_s_root_2">4.2. Deploying to a virtual host&#8217;s root</h3><div style="clear:left"></div>
1100
+ </div>
1101
+ <div class="sect2">
1102
+ <h3 id="_deploying_to_a_virtual_host_8217_s_root_2">4.2. Deploying to a virtual host&#8217;s root</h3>
988
1103
  <div class="paragraph"><p>Add a <em>server</em> virtual host entry to your Nginx configuration file. The virtual host&#8217;s
989
1104
  root must point to your Rack application&#8217;s <em>public</em> folder. You must also set
990
1105
  <em>passenger_enabled on</em> in the <em>server</em> block.</p></div>
@@ -1003,7 +1118,9 @@ root must point to your Rack application&#8217;s <em>public</em> folder. You mus
1003
1118
  }</tt></pre>
1004
1119
  </div></div>
1005
1120
  <div class="paragraph"><p>Then restart Nginx. The application has now been deployed.</p></div>
1006
- <h3 id="deploying_rack_to_sub_uri">4.3. Deploying to a sub URI</h3><div style="clear:left"></div>
1121
+ </div>
1122
+ <div class="sect2">
1123
+ <h3 id="deploying_rack_to_sub_uri">4.3. Deploying to a sub URI</h3>
1007
1124
  <div class="paragraph"><p>Suppose that you already have a virtual host:</p></div>
1008
1125
  <div class="listingblock">
1009
1126
  <div class="content">
@@ -1022,8 +1139,8 @@ root must point to your Rack application&#8217;s <em>public</em> folder. You mus
1022
1139
  </div></div>
1023
1140
  <div class="paragraph"><p>And you want your Rack application to be accessible from the URL
1024
1141
  <em>http://www.phusion.nl/rack</em>.</p></div>
1025
- <div class="paragraph"><p>To do this, make a symlink from your Rack application&#8217;s <em>public</em>
1026
- folder to a directory in the document root. For example:</p></div>
1142
+ <div class="paragraph"><p>To do this, make a symlink in the virtual host&#8217;s document root, and have it
1143
+ point to your Rack application&#8217;s <em>public</em> folder. For example:</p></div>
1027
1144
  <div class="listingblock">
1028
1145
  <div class="content">
1029
1146
  <pre><tt>ln -s /webapps/rackapp/public /websites/phusion/rack</tt></pre>
@@ -1046,7 +1163,7 @@ option to the <em>server</em> block:</p></div>
1046
1163
  ...
1047
1164
  }</tt></pre>
1048
1165
  </div></div>
1049
- <div class="paragraph"><p>Then restart Apache. The application has now been deployed.</p></div>
1166
+ <div class="paragraph"><p>Then restart Nginx. The application has now been deployed.</p></div>
1050
1167
  <div class="admonitionblock">
1051
1168
  <table><tr>
1052
1169
  <td class="icon">
@@ -1067,7 +1184,9 @@ option to the <em>server</em> block:</p></div>
1067
1184
  </td>
1068
1185
  </tr></table>
1069
1186
  </div>
1070
- <h3 id="_redeploying_restarting_the_rack_application">4.4. Redeploying (restarting the Rack application)</h3><div style="clear:left"></div>
1187
+ </div>
1188
+ <div class="sect2">
1189
+ <h3 id="_redeploying_restarting_the_rack_application">4.4. Redeploying (restarting the Rack application)</h3>
1071
1190
  <div class="paragraph"><p>Deploying a new version of a Rack application is as simple as
1072
1191
  re-uploading the application files, and restarting the application.</p></div>
1073
1192
  <div class="paragraph"><p>There are two ways to restart the application:</p></div>
@@ -1091,8 +1210,11 @@ command line:</p></div>
1091
1210
  <div class="content">
1092
1211
  <pre><tt>touch /webapps/rackapp/tmp/restart.txt</tt></pre>
1093
1212
  </div></div>
1094
- <h3 id="_rackup_specifications_for_various_web_frameworks">4.5. Rackup specifications for various web frameworks</h3><div style="clear:left"></div>
1213
+ </div>
1214
+ <div class="sect2">
1215
+ <h3 id="_rackup_specifications_for_various_web_frameworks">4.5. Rackup specifications for various web frameworks</h3>
1095
1216
  <div class="paragraph"><p>This subsection shows example <em>config.ru</em> files for various web frameworks.</p></div>
1217
+ <div class="sect3">
1096
1218
  <h4 id="_camping">4.5.1. Camping</h4>
1097
1219
  <div class="listingblock">
1098
1220
  <div class="content">
@@ -1109,6 +1231,8 @@ Camping.goes :Blog
1109
1231
  run Rack::Adapter::Camping.new(Blog)</tt></pre>
1110
1232
  </div></div>
1111
1233
  <div class="paragraph"><p>For Camping versions 2.0 and up, using <tt>run Blog</tt> as the final line will do.</p></div>
1234
+ </div>
1235
+ <div class="sect3">
1112
1236
  <h4 id="_halcyon">4.5.2. Halcyon</h4>
1113
1237
  <div class="listingblock">
1114
1238
  <div class="content">
@@ -1118,6 +1242,8 @@ $LOAD_PATH.unshift(Halcyon.root / 'lib')
1118
1242
  Halcyon::Runner.load_config Halcyon.root/'config'/'config.yml'
1119
1243
  run Halcyon::Runner.new</tt></pre>
1120
1244
  </div></div>
1245
+ </div>
1246
+ <div class="sect3">
1121
1247
  <h4 id="_mack">4.5.3. Mack</h4>
1122
1248
  <div class="listingblock">
1123
1249
  <div class="content">
@@ -1127,6 +1253,8 @@ require 'rubygems'
1127
1253
  require 'mack'
1128
1254
  run Mack::Utils::Server.build_app</tt></pre>
1129
1255
  </div></div>
1256
+ </div>
1257
+ <div class="sect3">
1130
1258
  <h4 id="_merb">4.5.4. Merb</h4>
1131
1259
  <div class="listingblock">
1132
1260
  <div class="content">
@@ -1143,6 +1271,8 @@ Merb::BootLoader.run
1143
1271
 
1144
1272
  run Merb::Rack::Application.new</tt></pre>
1145
1273
  </div></div>
1274
+ </div>
1275
+ <div class="sect3">
1146
1276
  <h4 id="_ramaze">4.5.5. Ramaze</h4>
1147
1277
  <div class="listingblock">
1148
1278
  <div class="content">
@@ -1153,6 +1283,8 @@ require "start"
1153
1283
  Ramaze.start!
1154
1284
  run Ramaze::Adapter::Base</tt></pre>
1155
1285
  </div></div>
1286
+ </div>
1287
+ <div class="sect3">
1156
1288
  <h4 id="_sinatra">4.5.6. Sinatra</h4>
1157
1289
  <div class="listingblock">
1158
1290
  <div class="content">
@@ -1163,13 +1295,18 @@ require 'app.rb'
1163
1295
  run Sinatra::Application</tt></pre>
1164
1296
  </div></div>
1165
1297
  </div>
1298
+ </div>
1299
+ </div>
1300
+ </div>
1301
+ <div class="sect1">
1166
1302
  <h2 id="_configuring_phusion_passenger">5. Configuring Phusion Passenger</h2>
1167
1303
  <div class="sectionbody">
1168
1304
  <div class="paragraph"><p>After installation, Phusion Passenger does not need any further configurations.
1169
1305
  Nevertheless, the system administrator may be interested in changing
1170
1306
  Phusion Passenger&#8217;s behavior. Phusion Passenger supports the following configuration
1171
1307
  options in the Nginx configuration file:</p></div>
1172
- <h3 id="_passenger_root_lt_directory_gt">5.1. passenger_root &lt;directory&gt;</h3><div style="clear:left"></div>
1308
+ <div class="sect2">
1309
+ <h3 id="_passenger_root_lt_directory_gt">5.1. passenger_root &lt;directory&gt;</h3>
1173
1310
  <div class="paragraph"><p>The location to the Phusion Passenger root directory. This configuration option
1174
1311
  is essential to Phusion Passenger, and allows Phusion Passenger to locate its own
1175
1312
  data files. The correct value is given by the installer.</p></div>
@@ -1177,47 +1314,180 @@ data files. The correct value is given by the installer.</p></div>
1177
1314
  this option as well. Please read
1178
1315
  <a href="#moving_phusion_passenger">Moving Phusion Passenger to a different directory</a> for more information.</p></div>
1179
1316
  <div class="paragraph"><p>This required option may only occur once, in the <em>http</em> configuration block.</p></div>
1180
- <h3 id="_passenger_log_level_lt_integer_gt">5.2. passenger_log_level &lt;integer&gt;</h3><div style="clear:left"></div>
1181
- <div class="paragraph"><p>This option allows one to specify how much information Phusion Passenger should
1182
- write to the Apache error log file. A higher log level value means that more
1183
- information will be logged.</p></div>
1184
- <div class="paragraph"><p>Possible values are:</p></div>
1317
+ </div>
1318
+ <div class="sect2">
1319
+ <h3 id="_passenger_ruby_lt_filename_gt">5.2. passenger_ruby &lt;filename&gt;</h3>
1320
+ <div class="paragraph"><p>This option allows one to specify the Ruby interpreter to use.</p></div>
1321
+ <div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration block.
1322
+ The default is <em>ruby</em>.</p></div>
1323
+ </div>
1324
+ <div class="sect2">
1325
+ <h3 id="PassengerSpawnMethod">5.3. passenger_spawn_method &lt;string&gt;</h3>
1326
+ <div class="admonitionblock">
1327
+ <table><tr>
1328
+ <td class="icon">
1329
+ <img src="./images/icons/tip.png" alt="Tip" />
1330
+ </td>
1331
+ <td class="content">
1332
+ <div class="title">"What spawn method should I use?"</div>
1333
+ <div class="paragraph"><p>This subsection attempts to describe spawn methods, but it&#8217;s okay if you don&#8217;t (want to)
1334
+ understand it, as it&#8217;s mostly a technical detail. You can basically follow this rule of thumb:</p></div>
1335
+ <div class="sidebarblock">
1336
+ <div class="content">
1337
+ <div class="paragraph"><p>If your application works on Mongrel, but not on Phusion Passenger, then set
1338
+ <tt>passenger_spawn_method</tt> to <em>conservative</em>. Otherwise, leave it at <em>smart-lv2</em> (the default).</p></div>
1339
+ </div></div>
1340
+ <div class="paragraph"><p>However, we do recommend you to try to understand it. The <em>smart</em> and <em>smart-lv2</em> spawn
1341
+ methods bring many benefits.</p></div>
1342
+ </td>
1343
+ </tr></table>
1344
+ </div>
1345
+ <div class="paragraph"><p>Internally, Phusion Passenger spawns multiple Ruby application processes in order to handle
1346
+ requests. But there are multiple ways with which processes can be spawned, each having
1347
+ its own set of pros and cons. Supported spawn methods are:</p></div>
1348
+ <div class="dlist"><dl>
1349
+ <dt class="hdlist1">
1350
+ <em>smart</em>
1351
+ </dt>
1352
+ <dd>
1353
+ <p>
1354
+ When this spawn method is used, Phusion Passenger will attempt to cache any
1355
+ framework code (e.g. Ruby on Rails itself) and application code for a limited
1356
+ period of time. Please read <a href="#spawning_methods_explained">Spawning methods explained</a>
1357
+ for a more detailed explanation of what smart spawning exactly does.
1358
+ </p>
1359
+ <div class="paragraph"><p><strong>Pros:</strong>
1360
+ This can significantly decrease spawn time (by as much as 90%). And, when Ruby Enterprise
1361
+ Edition is used, <a href="#reducing_memory_usage">memory usage can be reduced by 33% on average</a>.</p></div>
1362
+ <div class="paragraph"><p><strong>Cons:</strong>
1363
+ Some applications and libraries are not compatible with smart spawning.
1364
+ If that&#8217;s the case for your application, then you should use <em>conservative</em> as
1365
+ spawning method. Please read <a href="#spawning_methods_explained">Spawning methods explained</a>
1366
+ for possible compatibility issues.</p></div>
1367
+ </dd>
1368
+ <dt class="hdlist1">
1369
+ <em>smart-lv2</em>
1370
+ </dt>
1371
+ <dd>
1372
+ <p>
1373
+ This spawning method is similar to <em>smart</em> but it skips the framework spawner
1374
+ and uses the application spawner directly. This means the framework code is not
1375
+ cached between multiple applications, although it is still cached within
1376
+ instances of the same application. Please read
1377
+ <a href="#spawning_methods_explained">Spawning methods explained</a> for a more detailed
1378
+ explanation of what smart-lv2 spawning exactly does.
1379
+ </p>
1380
+ <div class="paragraph"><p><strong>Pros:</strong> It is compatible with a larger number of applications when compared to
1381
+ the <em>smart</em> method, and still performs some caching.</p></div>
1382
+ <div class="paragraph"><p><strong>Cons:</strong> It is slower than smart spawning if you have many applications which
1383
+ use the same framework version. It is therefore advised that shared hosts use the
1384
+ <em>smart</em> method instead.</p></div>
1385
+ </dd>
1386
+ <dt class="hdlist1">
1387
+ <em>conservative</em>
1388
+ </dt>
1389
+ <dd>
1390
+ <p>
1391
+ This spawning method is similar to the one used in Mongrel Cluster. It does not
1392
+ perform any code caching at all. Please read
1393
+ <a href="#spawning_methods_explained">Spawning methods explained</a> for a more detailed
1394
+ explanation of what conservative spawning exactly does.
1395
+ </p>
1396
+ <div class="paragraph"><p><strong>Pros:</strong>
1397
+ Conservative spawning is guaranteed to be compatible with all applications
1398
+ and libraries.</p></div>
1399
+ <div class="paragraph"><p><strong>Cons:</strong>
1400
+ Much slower than smart spawning. Every spawn action will be equally slow, though no slower than
1401
+ the startup time of a single server in Mongrel Cluster. Conservative spawning will also
1402
+ render <a href="#reducing_memory_usage">Ruby Enterprise Edition&#8217;s memory reduction technology</a> useless.</p></div>
1403
+ </dd>
1404
+ </dl></div>
1405
+ <div class="paragraph"><p>This option may occur in the following places:</p></div>
1185
1406
  <div class="ulist"><ul>
1186
1407
  <li>
1187
1408
  <p>
1188
- <em>0</em>: Show only errors and warnings.
1409
+ In the <em>http</em> configuration block.
1189
1410
  </p>
1190
1411
  </li>
1191
1412
  <li>
1192
1413
  <p>
1193
- <em>1</em>: Show the most important debugging information. This might be useful for
1194
- system administrators who are trying to figure out the cause of a
1195
- problem.
1414
+ In a <em>server</em> configuration block.
1196
1415
  </p>
1197
1416
  </li>
1198
1417
  <li>
1199
1418
  <p>
1200
- <em>2</em>: Show more debugging information. This is typically only useful for developers.
1419
+ In a <em>location</em> configuration block.
1201
1420
  </p>
1202
1421
  </li>
1203
1422
  <li>
1204
1423
  <p>
1205
- <em>3</em>: Show even more debugging information.
1424
+ In an <em>if</em> configuration scope.
1206
1425
  </p>
1207
1426
  </li>
1208
1427
  </ul></div>
1209
- <div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration block.
1210
- The default is <em>0</em>.</p></div>
1211
- <h3 id="_passenger_ruby_lt_filename_gt">5.3. passenger_ruby &lt;filename&gt;</h3><div style="clear:left"></div>
1212
- <div class="paragraph"><p>This option allows one to specify the Ruby interpreter to use.</p></div>
1213
- <div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration block.
1214
- The default is <em>ruby</em>.</p></div>
1215
- <h3 id="PassengerUseGlobalQueue">5.4. passenger_use_global_queue &lt;on|off&gt;</h3><div style="clear:left"></div>
1428
+ <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>smart-lv2</em>.</p></div>
1429
+ </div>
1430
+ <div class="sect2">
1431
+ <h3 id="_important_deployment_options">5.4. Important deployment options</h3>
1432
+ <div class="sect3">
1433
+ <h4 id="_passenger_enabled_lt_on_off_gt">5.4.1. passenger_enabled &lt;on|off&gt;</h4>
1434
+ <div class="paragraph"><p>This option may be specified in the <em>http</em> configuration block, a
1435
+ <em>server</em> configuration block, a <em>location</em> configuration block or
1436
+ an <em>if</em> configuration scope, to enable or disable Phusion Passenger
1437
+ for that server or that location.</p></div>
1438
+ <div class="paragraph"><p>Phusion Passenger is disabled by default, so you must explicitly enable
1439
+ it for server blocks that you wish to serve through Phusion Passenger.
1440
+ Please see <a href="#deploying_a_ror_app">Deploying a Ruby on Rails application</a>
1441
+ and <a href="#deploying_a_rack_app">Deploying a Rack-based Ruby application</a>
1442
+ for examples.</p></div>
1443
+ </div>
1444
+ <div class="sect3">
1445
+ <h4 id="PassengerBaseURI">5.4.2. passenger_base_uri &lt;uri&gt;</h4>
1446
+ <div class="paragraph"><p>Used to specify that the given URI is an distinct application that should
1447
+ be served by Phusion Passenger. This option can be used for both Rails and
1448
+ Rack applications. See <a href="#deploying_rails_to_sub_uri">Deploying Rails to a sub URI</a>
1449
+ for an example.</p></div>
1450
+ <div class="paragraph"><p>It is allowed to specify this option multiple times. Do this to deploy multiple
1451
+ applications in different sub-URIs under the same virtual host.</p></div>
1452
+ <div class="paragraph"><p>This option may occur in the following places:</p></div>
1453
+ <div class="ulist"><ul>
1454
+ <li>
1455
+ <p>
1456
+ In the <em>http</em> configuration block.
1457
+ </p>
1458
+ </li>
1459
+ <li>
1460
+ <p>
1461
+ In a <em>server</em> configuration block.
1462
+ </p>
1463
+ </li>
1464
+ <li>
1465
+ <p>
1466
+ In a <em>location</em> configuration block.
1467
+ </p>
1468
+ </li>
1469
+ <li>
1470
+ <p>
1471
+ In an <em>if</em> configuration scope.
1472
+ </p>
1473
+ </li>
1474
+ </ul></div>
1475
+ </div>
1476
+ </div>
1477
+ <div class="sect2">
1478
+ <h3 id="_connection_handling_options">5.5. Connection handling options</h3>
1479
+ <div class="sect3">
1480
+ <h4 id="PassengerUseGlobalQueue">5.5.1. passenger_use_global_queue &lt;on|off&gt;</h4>
1216
1481
  <div class="paragraph"><p>Turns the use of global queuing on or off.</p></div>
1217
1482
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
1218
1483
  <div class="ulist"><ul>
1219
1484
  <li>
1220
1485
  <p>
1486
+ In the <em>http</em> configuration block.
1487
+ </p>
1488
+ </li>
1489
+ <li>
1490
+ <p>
1221
1491
  In a <em>server</em> configuration block.
1222
1492
  </p>
1223
1493
  </li>
@@ -1232,7 +1502,7 @@ In an <em>if</em> configuration scope.
1232
1502
  </p>
1233
1503
  </li>
1234
1504
  </ul></div>
1235
- <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>off</em>.</p></div>
1505
+ <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>on</em>.</p></div>
1236
1506
  <div class="paragraph"><p><em>This feature is sponsored by <a href="http://www.37signals.com/">37signals</a>.</em></p></div>
1237
1507
  <div class="paragraph"><div class="title">What does this option do?</div><p>Recall that Phusion Passenger spawns multiple backend processes (e.g. multiple
1238
1508
  Ruby on Rails processes), each which processes HTTP requests serially. One of
@@ -1303,40 +1573,310 @@ D instead, because they only have short-living requests in their queues.</p></di
1303
1573
  queuing, all backend processes will share the same queue. The first backend
1304
1574
  process that becomes available will take from the queue, and so this
1305
1575
  &#8220;queuing-behind-long-running-request&#8221; problem will never occur.</p></div>
1306
- <div class="paragraph"><p>Turning global queuing off will yield a minor performance improvement (about 5%,
1307
- depending on how fast/slow your web application is), which is why it&#8217;s off by
1308
- default.</p></div>
1309
- <h3 id="PassengerUserSwitching">5.5. passenger_user_switching &lt;on|off&gt;</h3><div style="clear:left"></div>
1310
- <div class="paragraph"><p>Whether to enable <a href="#user_switching">user switching support</a>.</p></div>
1311
- <div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration block.
1312
- The default value is <em>on</em>.</p></div>
1313
- <h3 id="PassengerDefaultUser">5.6. passenger_default_user &lt;username&gt;</h3><div style="clear:left"></div>
1576
+ </div>
1577
+ <div class="sect3">
1578
+ <h4 id="_passenger_ignore_client_abort_lt_on_off_gt">5.5.2. passenger_ignore_client_abort &lt;on|off&gt;</h4>
1579
+ <div class="paragraph"><p>Normally, when the HTTP client aborts the connection (e.g. when the user clicked on "Stop"
1580
+ in the browser), the connection with the application process will be closed too. If the
1581
+ application process continues to send its response, then that will result in EPIPE errors
1582
+ in the application, which will be printed in the error log if the application doesn&#8217;t
1583
+ handle them gracefully.</p></div>
1584
+ <div class="paragraph"><p>If this option is turned on then upon client abort Phusion Passenger will continue to
1585
+ read the application process&#8217;s response while discarding all the read data. This prevents
1586
+ EPIPE errors but it&#8217;ll also mean the backend process will be unavailable for new requests
1587
+ until it is done sending its response.</p></div>
1588
+ <div class="paragraph"><p>This option may occur in the following places:</p></div>
1589
+ <div class="ulist"><ul>
1590
+ <li>
1591
+ <p>
1592
+ In the <em>http</em> configuration block.
1593
+ </p>
1594
+ </li>
1595
+ <li>
1596
+ <p>
1597
+ In a <em>server</em> configuration block.
1598
+ </p>
1599
+ </li>
1600
+ <li>
1601
+ <p>
1602
+ In a <em>location</em> configuration block.
1603
+ </p>
1604
+ </li>
1605
+ <li>
1606
+ <p>
1607
+ In an <em>if</em> configuration scope.
1608
+ </p>
1609
+ </li>
1610
+ </ul></div>
1611
+ <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>off</em>.</p></div>
1612
+ </div>
1613
+ <div class="sect3">
1614
+ <h4 id="_passenger_set_cgi_param_lt_cgi_environment_name_gt_lt_value_gt">5.5.3. passenger_set_cgi_param &lt;CGI environment name&gt; &lt;value&gt;</h4>
1615
+ <div class="paragraph"><p>Allows one to define additional CGI environment variables to pass to the backend
1616
+ application. This is equivalent to ngx_http_fastcgi_module&#8217;s <em>fastcgi_param</em>
1617
+ directive, and is comparable to ngx_http_proxy_module&#8217;s <em>proxy_set_header</em> option.
1618
+ Nginx variables in the value are interpolated.</p></div>
1619
+ <div class="paragraph"><p>For example:</p></div>
1620
+ <div class="listingblock">
1621
+ <div class="content">
1622
+ <pre><tt># Application will see a CGI environment "APP_NAME" with value "my super blog".
1623
+ passenger_set_cgi_param APP_NAME "my super blog";
1624
+
1625
+ # Nginx variables are interpolated.
1626
+ passenger_set_cgi_param EXTRA_REQUEST_METHOD method=$request_method;</tt></pre>
1627
+ </div></div>
1628
+ <div class="paragraph"><p>If you want to set an HTTP header, then you must set it in the CGI environment name
1629
+ format, i.e. <em>HTTP_*</em>:</p></div>
1630
+ <div class="listingblock">
1631
+ <div class="content">
1632
+ <pre><tt># !!!THIS IS WRONG!!! Don't do this!
1633
+ passenger_set_cgi_param X-Forwarded-For 127.0.0.2;
1634
+
1635
+ # Instead, write it like this:
1636
+ passenger_set_cgi_param HTTP_X_FORWARDED_FOR 127.0.0.2;</tt></pre>
1637
+ </div></div>
1638
+ <div class="paragraph"><p>This option may occur in the following places:</p></div>
1639
+ <div class="ulist"><ul>
1640
+ <li>
1641
+ <p>
1642
+ In the <em>http</em> configuration block.
1643
+ </p>
1644
+ </li>
1645
+ <li>
1646
+ <p>
1647
+ In a <em>server</em> configuration block.
1648
+ </p>
1649
+ </li>
1650
+ <li>
1651
+ <p>
1652
+ In a <em>location</em> configuration block.
1653
+ </p>
1654
+ </li>
1655
+ <li>
1656
+ <p>
1657
+ In an <em>if</em> configuration scope.
1658
+ </p>
1659
+ </li>
1660
+ </ul></div>
1661
+ </div>
1662
+ <div class="sect3">
1663
+ <h4 id="_passenger_pass_header_lt_header_name_gt">5.5.4. passenger_pass_header &lt;header name&gt;</h4>
1664
+ <div class="paragraph"><p>Some headers generated by backend applications are not forwarded to the HTTP client,
1665
+ e.g. <em>X-Accel-Redirect</em> which is directly processed by Nginx and then discarded from
1666
+ the final response. This directive allows one to force Nginx to pass those headers
1667
+ anyway, similar to how <em>proxy_pass_header</em> works.</p></div>
1668
+ <div class="paragraph"><p>For example:</p></div>
1669
+ <div class="listingblock">
1670
+ <div class="content">
1671
+ <pre><tt>location / {
1672
+ passenger_pass_header X-Accel-Redirect;
1673
+ }</tt></pre>
1674
+ </div></div>
1675
+ <div class="paragraph"><p>This option may occur in the following places:</p></div>
1676
+ <div class="ulist"><ul>
1677
+ <li>
1678
+ <p>
1679
+ In the <em>http</em> configuration block.
1680
+ </p>
1681
+ </li>
1682
+ <li>
1683
+ <p>
1684
+ In a <em>server</em> configuration block.
1685
+ </p>
1686
+ </li>
1687
+ <li>
1688
+ <p>
1689
+ In a <em>location</em> configuration block.
1690
+ </p>
1691
+ </li>
1692
+ <li>
1693
+ <p>
1694
+ In an <em>if</em> configuration scope.
1695
+ </p>
1696
+ </li>
1697
+ </ul></div>
1698
+ </div>
1699
+ <div class="sect3">
1700
+ <h4 id="_passenger_buffer_response_lt_on_off_gt">5.5.5. passenger_buffer_response &lt;on|off&gt;</h4>
1701
+ <div class="paragraph"><p>When turned on, application-generated responses are buffered in memory and also on
1702
+ disk if the response is larger than a certain threshold. By buffering responses,
1703
+ protection is provided against slow HTTP clients that can not read your response
1704
+ immediately.</p></div>
1705
+ <div class="paragraph"><p>For example, consider an HTTP client that&#8217;s on a dial-up modem link, and your
1706
+ application instance generates a 2 MB response. If response buffering is turned
1707
+ off then your application instance will be blocked until the entire 2 MB has been
1708
+ sent out to the HTTP client. This disallows your application instance to do any useful
1709
+ work in the mean time. By enabling response buffering, Phusion Passenger will read
1710
+ the application response as quickly as possible and will take care of slow clients.</p></div>
1711
+ <div class="paragraph"><p>However, keep in mind that enabling this option will make streaming responses
1712
+ impossible. Consider for example this piece of Rails code:</p></div>
1713
+ <div class="listingblock">
1714
+ <div class="content">
1715
+ <pre><tt>render :text =&gt; lambda { |response, output|
1716
+ 10.times do |i|
1717
+ output.write("entry #{i}\n")
1718
+ output.flush
1719
+ sleep 1
1720
+ end
1721
+ }</tt></pre>
1722
+ </div></div>
1723
+ <div class="paragraph"><p>&#8230;or this piece of Rack code:</p></div>
1724
+ <div class="listingblock">
1725
+ <div class="content">
1726
+ <pre><tt>class Response
1727
+ def each
1728
+ 10.times do |i|
1729
+ yield("entry #{i}\n")
1730
+ sleep 1
1731
+ end
1732
+ end
1733
+ end
1734
+
1735
+ app = lambda do |env|
1736
+ [200, { "Content-Type" =&gt; "text/plain" }, Response.new]
1737
+ end</tt></pre>
1738
+ </div></div>
1739
+ <div class="paragraph"><p>When response buffering is turned on, Phusion Passenger will wait until
1740
+ the application is done sending the entire response before forwarding it
1741
+ to the client. The client will not receive anything for 10 seconds,
1742
+ after which it receives the entire response at once.
1743
+ When response buffering is turned off, it works as expected: the client
1744
+ receives an "entry X" message every second for 10 seconds.</p></div>
1745
+ <div class="paragraph"><p>This option may occur in the following places:</p></div>
1746
+ <div class="ulist"><ul>
1747
+ <li>
1748
+ <p>
1749
+ In the <em>http</em> configuration block.
1750
+ </p>
1751
+ </li>
1752
+ <li>
1753
+ <p>
1754
+ In a <em>server</em> configuration block.
1755
+ </p>
1756
+ </li>
1757
+ <li>
1758
+ <p>
1759
+ In a <em>location</em> configuration block.
1760
+ </p>
1761
+ </li>
1762
+ <li>
1763
+ <p>
1764
+ In an <em>if</em> configuration scope.
1765
+ </p>
1766
+ </li>
1767
+ </ul></div>
1768
+ <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>on</em>.</p></div>
1769
+ </div>
1770
+ </div>
1771
+ <div class="sect2">
1772
+ <h3 id="_security_options">5.6. Security options</h3>
1773
+ <div class="sect3">
1774
+ <h4 id="PassengerUserSwitching">5.6.1. passenger_user_switching &lt;on|off&gt;</h4>
1775
+ <div class="paragraph"><p>Whether to enable <a href="#user_switching">user switching support</a>.</p></div>
1776
+ <div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration block.
1777
+ The default value is <em>on</em>.</p></div>
1778
+ </div>
1779
+ <div class="sect3">
1780
+ <h4 id="_passenger_user_lt_username_gt">5.6.2. passenger_user &lt;username&gt;</h4>
1781
+ <div class="paragraph"><p>If <a href="#user_switching">user switching support</a> is enabled, then Phusion Passenger will
1782
+ by default run the web application as the owner if the file <em>config/environment.rb</em>
1783
+ (for Rails apps) or <em>config.ru</em> (for Rack apps). This option allows you to override
1784
+ that behavior and explicitly set a user to run the web application as, regardless
1785
+ of the ownership of <em>environment.rb</em>/<em>config.ru</em>.</p></div>
1786
+ <div class="paragraph"><p>This option may occur in the following places:</p></div>
1787
+ <div class="ulist"><ul>
1788
+ <li>
1789
+ <p>
1790
+ In the <em>http</em> configuration block.
1791
+ </p>
1792
+ </li>
1793
+ <li>
1794
+ <p>
1795
+ In a <em>server</em> configuration block.
1796
+ </p>
1797
+ </li>
1798
+ <li>
1799
+ <p>
1800
+ In a <em>location</em> configuration block.
1801
+ </p>
1802
+ </li>
1803
+ <li>
1804
+ <p>
1805
+ In an <em>if</em> configuration scope.
1806
+ </p>
1807
+ </li>
1808
+ </ul></div>
1809
+ <div class="paragraph"><p>In each place, it may be specified at most once.</p></div>
1810
+ </div>
1811
+ <div class="sect3">
1812
+ <h4 id="_passenger_user_lt_group_name_gt">5.6.3. passenger_user &lt;group name&gt;</h4>
1813
+ <div class="paragraph"><p>If <a href="#user_switching">user switching support</a> is enabled, then Phusion Passenger will
1814
+ by default run the web application as the primary group of the owner of the file
1815
+ <em>config/environment.rb</em> (for Rails apps) or <em>config.ru</em> (for Rack apps). This option
1816
+ allows you to override that behavior and explicitly set a group to run the web application
1817
+ as, regardless of the ownership of <em>environment.rb</em>/<em>config.ru</em>.</p></div>
1818
+ <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
1819
+ the web application&#8217;s group will be set to <em>environment.rb</em>/<em>config.ru</em>'s group.</p></div>
1820
+ <div class="paragraph"><p>This option may occur in the following places:</p></div>
1821
+ <div class="ulist"><ul>
1822
+ <li>
1823
+ <p>
1824
+ In the <em>http</em> configuration block.
1825
+ </p>
1826
+ </li>
1827
+ <li>
1828
+ <p>
1829
+ In a <em>server</em> configuration block.
1830
+ </p>
1831
+ </li>
1832
+ <li>
1833
+ <p>
1834
+ In a <em>location</em> configuration block.
1835
+ </p>
1836
+ </li>
1837
+ <li>
1838
+ <p>
1839
+ In an <em>if</em> configuration scope.
1840
+ </p>
1841
+ </li>
1842
+ </ul></div>
1843
+ <div class="paragraph"><p>In each place, it may be specified at most once.</p></div>
1844
+ </div>
1845
+ <div class="sect3">
1846
+ <h4 id="PassengerDefaultUser">5.6.4. passenger_default_user &lt;username&gt;</h4>
1314
1847
  <div class="paragraph"><p>Phusion Passenger enables <a href="#user_switching">user switching support</a> by default.
1315
- This configuration option allows one to specify which user Rails/Rack
1316
- applications must run as, if user switching fails or is disabled.</p></div>
1848
+ This configuration option allows one to specify the user that applications must
1849
+ run as, if user switching fails or is disabled.</p></div>
1317
1850
  <div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration block.
1318
1851
  The default value is <em>nobody</em>.</p></div>
1319
- <h3 id="_important_deployment_options">5.7. Important deployment options</h3><div style="clear:left"></div>
1320
- <h4 id="_passenger_enabled_lt_on_off_gt">5.7.1. passenger_enabled &lt;on|off&gt;</h4>
1321
- <div class="paragraph"><p>This option may be specified in a <em>server</em> configuration block, a
1322
- <em>location</em> configuration block or an <em>if</em> configuration scope, to
1323
- enable or disable Phusion Passenger for that server or that location.</p></div>
1324
- <div class="paragraph"><p>Phusion Passenger is disabled by default, so you must explicitly enable
1325
- it for server blocks that you wish to serve through Phusion Passenger.
1326
- Please see <a href="#deploying_a_ror_app">Deploying a Ruby on Rails application</a>
1327
- and <a href="#deploying_a_rack_app">Deploying a Rack-based Ruby application</a>
1328
- for examples.</p></div>
1329
- <h4 id="PassengerBaseURI">5.7.2. passenger_base_uri &lt;uri&gt;</h4>
1330
- <div class="paragraph"><p>Used to specify that the given URI is an distinct application that should
1331
- be served by Phusion Passenger. This option can be used for both Rails and
1332
- Rack applications. See <a href="#deploying_rails_to_sub_uri">Deploying Rails to a sub URI</a>
1333
- for an example.</p></div>
1334
- <div class="paragraph"><p>It is allowed to specify this option multiple times. Do this to deploy multiple
1335
- applications in different sub-URIs under the same virtual host.</p></div>
1852
+ </div>
1853
+ <div class="sect3">
1854
+ <h4 id="PassengerDefaultGroup">5.6.5. Passenger_default_group &lt;group name&gt;</h4>
1855
+ <div class="paragraph"><p>Phusion Passenger enables <a href="#user_switching">user switching support</a> by default.
1856
+ This configuration option allows one to specify the group that applications must
1857
+ run as, if user switching fails or is disabled.</p></div>
1858
+ <div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration block.
1859
+ The default value is the primary group of the user specifified by
1860
+ <a href="#PassengerDefaultUser">passenger_default_user</a>.</p></div>
1861
+ </div>
1862
+ <div class="sect3">
1863
+ <h4 id="_passenger_friendly_error_pages_lt_on_off_gt">5.6.6. passenger_friendly_error_pages &lt;on|off&gt;</h4>
1864
+ <div class="paragraph"><p>Phusion Passenger can display friendly error pages whenever an application fails
1865
+ to start. This friendly error page presents the startup error message, some
1866
+ suggestions for solving the problem, and a backtrace. This feature is very useful
1867
+ during application development and useful for less experienced system administrators,
1868
+ but the page might reveal potentially sensitive information, depending on the
1869
+ application. Experienced system administrators who are using Phusion Passenger
1870
+ on serious production servers should consider turning this feature off.</p></div>
1336
1871
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
1337
1872
  <div class="ulist"><ul>
1338
1873
  <li>
1339
1874
  <p>
1875
+ In the <em>http</em> configuration block.
1876
+ </p>
1877
+ </li>
1878
+ <li>
1879
+ <p>
1340
1880
  In a <em>server</em> configuration block.
1341
1881
  </p>
1342
1882
  </li>
@@ -1351,8 +1891,13 @@ In an <em>if</em> configuration scope.
1351
1891
  </p>
1352
1892
  </li>
1353
1893
  </ul></div>
1354
- <h3 id="_resource_control_and_optimization_options">5.8. Resource control and optimization options</h3><div style="clear:left"></div>
1355
- <h4 id="PassengerMaxPoolSize">5.8.1. passenger_max_pool_size &lt;integer&gt;</h4>
1894
+ <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>on</em>.</p></div>
1895
+ </div>
1896
+ </div>
1897
+ <div class="sect2">
1898
+ <h3 id="_resource_control_and_optimization_options">5.7. Resource control and optimization options</h3>
1899
+ <div class="sect3">
1900
+ <h4 id="PassengerMaxPoolSize">5.7.1. passenger_max_pool_size &lt;integer&gt;</h4>
1356
1901
  <div class="paragraph"><p>The maximum number of Ruby on Rails or Rack application instances that may
1357
1902
  be simultaneously active. A larger number results in higher memory usage,
1358
1903
  but improved ability to handle concurrent HTTP clients.</p></div>
@@ -1377,7 +1922,83 @@ The default value is <em>6</em>.</p></div>
1377
1922
  by about 33%. And it&#8217;s not hard to install.</td>
1378
1923
  </tr></table>
1379
1924
  </div>
1380
- <h4 id="_passenger_max_instances_per_app_lt_integer_gt">5.8.2. passenger_max_instances_per_app &lt;integer&gt;</h4>
1925
+ </div>
1926
+ <div class="sect3">
1927
+ <h4 id="PassengerMinInstances">5.7.2. passenger_min_instances &lt;integer&gt;</h4>
1928
+ <div class="paragraph"><p>This specifies the minimum number of application instances that must be kept around
1929
+ whenever Phusion Passenger cleans up idle instances. You should set this option to a
1930
+ non-zero value if you want to avoid potentially long startup times after a website
1931
+ has been idle for an extended period.</p></div>
1932
+ <div class="paragraph"><p>Please note that this option does <strong>not</strong> pre-start application instances during Nginx
1933
+ startup. It just makes sure that when the application is first accessed:</p></div>
1934
+ <div class="olist arabic"><ol class="arabic">
1935
+ <li>
1936
+ <p>
1937
+ at least the given number of instances will be spawned.
1938
+ </p>
1939
+ </li>
1940
+ <li>
1941
+ <p>
1942
+ the given number of processes will be kept around even when instances are being
1943
+ idle cleaned (see <a href="#PassengerPoolIdleTime">passenger_pool_idle_time</a>).
1944
+ </p>
1945
+ </li>
1946
+ </ol></div>
1947
+ <div class="paragraph"><p>If you want to pre-start application instances during Nginx startup, then you should use the <a href="#PassengerPreStart">passenger_pre_start</a> directive, possibly in combination with
1948
+ <em>passenger_min_instances</em>. This behavior might seem counter-intuitive at first sight,
1949
+ but <a href="#PassengerPreStart">passenger_pre_start</a> explains the rationale behind it.</p></div>
1950
+ <div class="paragraph"><p>For example, suppose that you have the following configuration:</p></div>
1951
+ <div class="listingblock">
1952
+ <div class="content">
1953
+ <pre><tt>http {
1954
+ ...
1955
+ passenger_max_pool_size 15;
1956
+ passenger_pool_idle_time 10;
1957
+
1958
+ server {
1959
+ listen 80;
1960
+ server_name foobar.com;
1961
+ root /webapps/foobar/public;
1962
+ passenger_min_instances 3;
1963
+ }
1964
+ }</tt></pre>
1965
+ </div></div>
1966
+ <div class="paragraph"><p>When you start Nginx, there are 0 application instances for <em>foobar.com</em>. Things will
1967
+ stay that way until someone visits <em>foobar.com</em>. Suppose that there is only 1 visitor.
1968
+ 1 application instance will be started immediately to serve the visitor, while 2 will
1969
+ be spawned in the background. After 10 seconds, when the idle timeout has
1970
+ been reached, these 3 application instances will not be cleaned up.</p></div>
1971
+ <div class="paragraph"><p>Now suppose that there&#8217;s a sudden spike of traffic, and 100 users visit <em>foobar.com</em>
1972
+ simultanously. Phusion Passenger will start 12 more application instances. After the idle
1973
+ timeout of 10 seconds have passed, Phusion Passenger will clean up 12 application
1974
+ instances, keeping 3 instances around.</p></div>
1975
+ <div class="paragraph"><p>The passenger_min_instances option may occur in the following places:</p></div>
1976
+ <div class="ulist"><ul>
1977
+ <li>
1978
+ <p>
1979
+ In the <em>http</em> configuration block.
1980
+ </p>
1981
+ </li>
1982
+ <li>
1983
+ <p>
1984
+ In a <em>server</em> configuration block.
1985
+ </p>
1986
+ </li>
1987
+ <li>
1988
+ <p>
1989
+ In a <em>location</em> configuration block.
1990
+ </p>
1991
+ </li>
1992
+ <li>
1993
+ <p>
1994
+ In an <em>if</em> configuration scope.
1995
+ </p>
1996
+ </li>
1997
+ </ul></div>
1998
+ <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>1</em>.</p></div>
1999
+ </div>
2000
+ <div class="sect3">
2001
+ <h4 id="_passenger_max_instances_per_app_lt_integer_gt">5.7.3. passenger_max_instances_per_app &lt;integer&gt;</h4>
1381
2002
  <div class="paragraph"><p>The maximum number of application instances that may be simultaneously active
1382
2003
  for a single application. This helps to make sure that a single application
1383
2004
  will not occupy all available slots in the application pool.</p></div>
@@ -1387,7 +2008,9 @@ may use, i.e. only the global limit of <a href="#PassengerMaxPoolSize">passenger
1387
2008
  will be enforced.</p></div>
1388
2009
  <div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration block.
1389
2010
  The default value is <em>0</em>.</p></div>
1390
- <h4 id="PassengerPoolIdleTime">5.8.3. passenger_pool_idle_time &lt;integer&gt;</h4>
2011
+ </div>
2012
+ <div class="sect3">
2013
+ <h4 id="PassengerPoolIdleTime">5.7.4. passenger_pool_idle_time &lt;integer&gt;</h4>
1391
2014
  <div class="paragraph"><p>The maximum number of seconds that an application instance may be idle. That is,
1392
2015
  if an application instance hasn&#8217;t received any traffic after the given number of
1393
2016
  seconds, then it will be shutdown in order to conserve memory.</p></div>
@@ -1407,107 +2030,262 @@ recommended if you&#8217;re on a non-shared host that&#8217;s only running a few
1407
2030
  applications, each which must be available at all times.</p></div>
1408
2031
  <div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration block.
1409
2032
  The default value is <em>300</em>.</p></div>
1410
- <h3 id="_ruby_on_rails_specific_options">5.9. Ruby on Rails-specific options</h3><div style="clear:left"></div>
1411
- <h4 id="RailsEnv">5.9.1. rails_env &lt;string&gt;</h4>
1412
- <div class="paragraph"><p>This option allows one to specify the default <tt>RAILS_ENV</tt> value.</p></div>
1413
- <div class="paragraph"><p>This option may occur in the following places:</p></div>
2033
+ </div>
2034
+ <div class="sect3">
2035
+ <h4 id="PassengerPreStart">5.7.5. passenger_pre_start &lt;url&gt;</h4>
2036
+ <div class="paragraph"><p>By default, Phusion Passenger does not start any application instances until said
2037
+ web application is first accessed. The result is that the first visitor of said
2038
+ web application might experience a small delay as Phusion Passenger is starting
2039
+ the web application on demand. If that is undesirable, then this directive can be
2040
+ used to pre-started application instances during Nginx startup.</p></div>
2041
+ <div class="paragraph"><p>A few things to be careful of:</p></div>
1414
2042
  <div class="ulist"><ul>
1415
2043
  <li>
1416
2044
  <p>
1417
- In a <em>server</em> configuration block.
2045
+ This directive accepts the <strong>URL</strong> of the web application you want to pre-start,
2046
+ not a on/off value! This might seem a bit weird, but read on for rationale. As
2047
+ for the specifics of the URL:
2048
+ </p>
2049
+ <div class="ulist"><ul>
2050
+ <li>
2051
+ <p>
2052
+ The domain part of the URL must be equal to the value of the <em>server_name</em>
2053
+ directive of the server block that defines the web application.
1418
2054
  </p>
1419
2055
  </li>
1420
2056
  <li>
1421
2057
  <p>
1422
- In a <em>location</em> configuration block.
2058
+ Unless the web application is deployed on port 80, the URL should contain
2059
+ the web application&#8217;s port number too.
1423
2060
  </p>
1424
2061
  </li>
1425
2062
  <li>
1426
2063
  <p>
1427
- In an <em>if</em> configuration scope.
2064
+ The path part of the URL must point to some URI that the web application
2065
+ handles.
1428
2066
  </p>
1429
2067
  </li>
1430
2068
  </ul></div>
1431
- <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>production</em>.</p></div>
1432
- <h4 id="_rails_spawn_method_lt_string_gt">5.9.2. rails_spawn_method &lt;string&gt;</h4>
1433
- <div class="admonitionblock">
1434
- <table><tr>
1435
- <td class="icon">
1436
- <img src="./images/icons/tip.png" alt="Tip" />
1437
- </td>
1438
- <td class="content">
1439
- <div class="title">"What spawn method should I use?"</div>
1440
- <div class="paragraph"><p>This subsection attempts to describe spawn methods, but it&#8217;s okay if you don&#8217;t (want to)
1441
- understand it, as it&#8217;s mostly a technical detail. You can basically follow this rule of thumb:</p></div>
1442
- <div class="sidebarblock">
1443
- <div class="sidebar-content">
1444
- <div class="paragraph"><p>If your application works on Mongrel, but not on Phusion Passenger, then set
1445
- <tt>rails_spawn_method</tt> to <em>conservative</em>. Otherwise, leave it at <em>smart-lv2</em> (the default).</p></div>
2069
+ </li>
2070
+ <li>
2071
+ <p>
2072
+ You will probably want to combine this option with
2073
+ <a href="#PassengerMinInstances">passenger_min_instances</a> because application instances
2074
+ started with <em>passenger_pre_start</em> are subject to the usual idle timeout rules.
2075
+ See the example below for an explanation.
2076
+ </p>
2077
+ </li>
2078
+ </ul></div>
2079
+ <div class="paragraph"><p>This option may only occur in the <em>http</em> configuration block. It may be specified
2080
+ any number of times.</p></div>
2081
+ <div class="sect4">
2082
+ <h5 id="_example_1_basic_usage">Example 1: basic usage</h5>
2083
+ <div class="paragraph"><p>Suppose that you have the following web applications.</p></div>
2084
+ <div class="listingblock">
2085
+ <div class="content">
2086
+ <pre><tt>server {
2087
+ listen 80;
2088
+ server_name foo.com;
2089
+ root /webapps/foo/public;
2090
+ passenger_enabled on;
2091
+ }
2092
+
2093
+ server {
2094
+ listen 3500;
2095
+ server_name bar.com;
2096
+ root /webapps/bar/public;
2097
+ passenger_enabled on;
2098
+ }</tt></pre>
2099
+ </div></div>
2100
+ <div class="paragraph"><p>You want both of them to be pre-started during Nginx startup. The URL for
2101
+ foo.com is <em>http://foo.com/</em> (or, equivalently, <em>http://foo.com:80/</em>) and
2102
+ the URL for bar.com is <em>http://bar.com:3500/</em>. So we add two passenger_pre_start
2103
+ directives, like this:</p></div>
2104
+ <div class="listingblock">
2105
+ <div class="content">
2106
+ <pre><tt>server {
2107
+ listen 80;
2108
+ server_name foo.com;
2109
+ root /webapps/foo/public;
2110
+ passenger_enabled on;
2111
+ }
2112
+
2113
+ server {
2114
+ listen 3500;
2115
+ server_name bar.com;
2116
+ root /webapps/bar/public;
2117
+ passenger_enabled on;
2118
+ }
2119
+
2120
+ passenger_pre_start http://foo.com/; # &lt;--- added
2121
+ passenger_pre_start http://bar.com:3500/; # &lt;--- added</tt></pre>
1446
2122
  </div></div>
1447
- <div class="paragraph"><p>However, we do recommend you to try to understand it. The <em>smart</em> and <em>smart-lv2</em> spawn
1448
- methods bring many benefits.</p></div>
1449
- </td>
1450
- </tr></table>
1451
2123
  </div>
1452
- <div class="paragraph"><p>Internally, Phusion Passenger spawns multiple Ruby on Rails processes in order to handle
1453
- requests. But there are multiple ways with which processes can be spawned, each having
1454
- its own set of pros and cons. Supported spawn methods are:</p></div>
1455
- <div class="dlist"><dl>
1456
- <dt class="hdlist1">
1457
- <em>smart</em>
1458
- </dt>
1459
- <dd>
2124
+ <div class="sect4">
2125
+ <h5 id="_example_2_pre_starting_apps_that_are_deployed_in_sub_uris">Example 2: pre-starting apps that are deployed in sub-URIs</h5>
2126
+ <div class="paragraph"><p>Suppose that you have a web application deployed in a sub-URI <em>/store</em>, like this:</p></div>
2127
+ <div class="listingblock">
2128
+ <div class="content">
2129
+ <pre><tt>server {
2130
+ listen 80;
2131
+ server_name myblog.com;
2132
+ root /webapps/wordpress;
2133
+ rails_base_uri /store;
2134
+ }</tt></pre>
2135
+ </div></div>
2136
+ <div class="paragraph"><p>Then specify the <em>server_name</em> valuue followed by the sub-URI, like this:</p></div>
2137
+ <div class="listingblock">
2138
+ <div class="content">
2139
+ <pre><tt>server {
2140
+ listen 80;
2141
+ server_name myblog.com;
2142
+ root /webapps/wordpress;
2143
+ rails_base_uri /store;
2144
+ }
2145
+
2146
+ passenger_pre_start http://myblog.com/store; # &lt;----- added</tt></pre>
2147
+ </div></div>
2148
+ <div class="paragraph"><p>The sub-URI <strong>must</strong> be included; if you don&#8217;t then the directive will have no effect.
2149
+ The following example is wrong and won&#8217;t pre-start the store web application:</p></div>
2150
+ <div class="listingblock">
2151
+ <div class="content">
2152
+ <pre><tt>passenger_pre_start http://myblog.com/; # &lt;----- WRONG! Missing "/store" part.</tt></pre>
2153
+ </div></div>
2154
+ </div>
2155
+ <div class="sect4">
2156
+ <h5 id="_example_3_combining_with_passenger_min_instances">Example 3: combining with passenger_min_instances</h5>
2157
+ <div class="paragraph"><p>Application instances started with passenger_pre_start are
2158
+ also subject to the idle timeout rules as specified by
2159
+ <a href="#PassengerPoolIdleTime">passenger_pool_idle_time</a>! That means that by default,
2160
+ the pre-started application instances for foo.com are bar.com are shut down
2161
+ after a few minutes of inactivity. If you don&#8217;t want that to happen, then
2162
+ you should combine passenger_pre_start with
2163
+ <a href="#PassengerMinInstances">passenger_min_instances</a>, like this:</p></div>
2164
+ <div class="listingblock">
2165
+ <div class="content">
2166
+ <pre><tt>server {
2167
+ listen 80;
2168
+ server_name foo.com;
2169
+ root /webapps/foo/public;
2170
+ passenger_enabled on;
2171
+ passenger_min_instances 1; # &lt;--- added
2172
+ }
2173
+
2174
+ server {
2175
+ listen 3500;
2176
+ server_name bar.com;
2177
+ root /webapps/bar/public;
2178
+ passenger_enabled on;
2179
+ passenger_min_instances 1; # &lt;--- added
2180
+ }
2181
+
2182
+ passenger_pre_start http://foo.com/;
2183
+ passenger_pre_start http://bar.com:3500/;</tt></pre>
2184
+ </div></div>
2185
+ </div>
2186
+ <div class="sect4">
2187
+ <h5 id="_so_why_a_url_why_not_just_an_on_off_flag">So why a URL? Why not just an on/off flag?</h5>
2188
+ <div class="paragraph"><p>A directive that accepts a simple on/off flag is definitely more intuitive,
2189
+ but due technical difficulties w.r.t. the way Nginx works, it&#8217;s very hard
2190
+ to implement it like that:</p></div>
2191
+ <div class="paragraph"><p>It is very hard to obtain a full list of web applications defined in the
2192
+ Nginx configuration file(s). In other words, it&#8217;s hard for Phusion Passenger
2193
+ to know which web applications are deployed on Nginx until a web application
2194
+ is first accessed, and without such a list Phusion Passenger wouldn&#8217;t know
2195
+ which web applications to pre-start. So as a compromise, we made it accept a
2196
+ URL.</p></div>
2197
+ </div>
2198
+ <div class="sect4">
2199
+ <h5 id="_what_does_phusion_passenger_do_with_the_url">What does Phusion Passenger do with the URL?</h5>
2200
+ <div class="paragraph"><p>During Nginx startup, Phusion Passenger will send a dummy HEAD request to the
2201
+ given URL and discard the result. In other words, Phusion Passenger simulates a
2202
+ web access at the given URL. However this simulated request is always sent to
2203
+ localhost, <strong>not</strong> to the IP that the domain resolves to. Suppose that bar.com
2204
+ in example 1 resolves to 209.85.227.99; Phusion Passenger will
2205
+ send the following HTTP request to 127.0.0.1 port 3500 (and not to 209.85.227.99
2206
+ port 3500):</p></div>
2207
+ <div class="listingblock">
2208
+ <div class="content">
2209
+ <pre><tt>HEAD / HTTP/1.1
2210
+ Host: bar.com
2211
+ Connection: close</tt></pre>
2212
+ </div></div>
2213
+ <div class="paragraph"><p>Similarly, for example 2, Phusion Passenger will send the following HTTP request
2214
+ to 127.0.0.1 port 80:</p></div>
2215
+ <div class="listingblock">
2216
+ <div class="content">
2217
+ <pre><tt>HEAD /store HTTP/1.1
2218
+ Host: myblog.com
2219
+ Connection: close</tt></pre>
2220
+ </div></div>
2221
+ </div>
2222
+ <div class="sect4">
2223
+ <h5 id="_do_i_need_to_edit_etc_hosts_and_point_the_domain_in_the_url_to_127_0_0_1">Do I need to edit /etc/hosts and point the domain in the URL to 127.0.0.1?</h5>
2224
+ <div class="paragraph"><p>No. See previous subsection.</p></div>
2225
+ </div>
2226
+ <div class="sect4">
2227
+ <h5 id="_my_web_application_consists_of_multiple_web_servers_what_url_do_i_need_to_specify_and_in_which_web_server_8217_s_nginx_config_file">My web application consists of multiple web servers. What URL do I need to specify, and in which web server&#8217;s Nginx config file?</h5>
2228
+ <div class="paragraph"><p>Put the web application&#8217;s <em>server_name</em> value and the server block&#8217;s
2229
+ port in the URL, and put
2230
+ passenger_pre_start on all machines that you want to pre-start the web application
2231
+ on. The simulated web request is always sent to 127.0.0.1, with the domain name
2232
+ in the URL as value for the <em>Host</em> HTTP header, so you don&#8217;t need to worry about
2233
+ the request ending up at a different web server in the cluster.</p></div>
2234
+ </div>
2235
+ <div class="sect4">
2236
+ <h5 id="_does_passenger_pre_start_support_https_urls">Does passenger_pre_start support https:// URLs?</h5>
2237
+ <div class="paragraph"><p>Yes. And it does not perform any certificate validation.</p></div>
2238
+ </div>
2239
+ </div>
2240
+ </div>
2241
+ <div class="sect2">
2242
+ <h3 id="_logging_and_debugging_options">5.8. Logging and debugging options</h3>
2243
+ </div>
2244
+ <div class="sect2">
2245
+ <h3 id="_passenger_log_level_lt_integer_gt">5.9. passenger_log_level &lt;integer&gt;</h3>
2246
+ <div class="paragraph"><p>This option allows one to specify how much information Phusion Passenger should
2247
+ write to the Nginx error log file. A higher log level value means that more
2248
+ information will be logged.</p></div>
2249
+ <div class="paragraph"><p>Possible values are:</p></div>
2250
+ <div class="ulist"><ul>
2251
+ <li>
1460
2252
  <p>
1461
- When this spawn method is used, Phusion Passenger will attempt to cache Ruby on Rails
1462
- framework code and application code for a limited period of time. Please read
1463
- <a href="#spawning_methods_explained">Spawning methods explained</a> for a more detailed
1464
- explanation of what smart spawning exactly does.
2253
+ <em>0</em>: Show only errors and warnings.
1465
2254
  </p>
1466
- <div class="paragraph"><p><strong>Pros:</strong>
1467
- This can significantly decrease spawn time (by as much as 90%). And, when Ruby Enterprise
1468
- Edition is used, <a href="#reducing_memory_usage">memory usage can be reduced by 33% on average</a>.</p></div>
1469
- <div class="paragraph"><p><strong>Cons:</strong>
1470
- Some Ruby on Rails applications and libraries are not compatible with smart spawning.
1471
- If that&#8217;s the case for your application, then you should use <em>conservative</em> as
1472
- spawning method.</p></div>
1473
- </dd>
1474
- <dt class="hdlist1">
1475
- <em>smart-lv2</em>
1476
- </dt>
1477
- <dd>
2255
+ </li>
2256
+ <li>
1478
2257
  <p>
1479
- This spawning method is similar to <em>smart</em> but it skips the framework spawner
1480
- and uses the application spawner directly. This means the framework code is not
1481
- cached between multiple applications, although it is still cached within
1482
- instances of the same application. Please read
1483
- <a href="#spawning_methods_explained">Spawning methods explained</a> for a more detailed
1484
- explanation of what smart-lv2 spawning exactly does.
2258
+ <em>1</em>: Show the most important debugging information. This might be useful for
2259
+ system administrators who are trying to figure out the cause of a
2260
+ problem.
1485
2261
  </p>
1486
- <div class="paragraph"><p><strong>Pros:</strong> It is compatible with a larger number of applications when compared to
1487
- the <em>smart</em> method, and still performs some caching.</p></div>
1488
- <div class="paragraph"><p><strong>Cons:</strong> It is slower than smart spawning if you have many applications which
1489
- use the same framework version. It is therefore advised that shared hosts use the
1490
- <em>smart</em> method instead.</p></div>
1491
- </dd>
1492
- <dt class="hdlist1">
1493
- <em>conservative</em>
1494
- </dt>
1495
- <dd>
2262
+ </li>
2263
+ <li>
1496
2264
  <p>
1497
- This spawning method is similar to the one used in Mongrel Cluster. It does not
1498
- perform any code caching at all. Please read
1499
- <a href="#spawning_methods_explained">Spawning methods explained</a> for a more detailed
1500
- explanation of what conservative spawning exactly does.
2265
+ <em>2</em>: Show more debugging information. This is typically only useful for developers.
1501
2266
  </p>
1502
- <div class="paragraph"><p><strong>Pros:</strong>
1503
- Conservative spawning is guaranteed to be compatible with all Rails applications
1504
- and libraries.</p></div>
1505
- <div class="paragraph"><p><strong>Cons:</strong>
1506
- Much slower than smart spawning. Every spawn action will be equally slow, though no slower than
1507
- the startup time of a single server in Mongrel Cluster. Conservative spawning will also
1508
- render <a href="#reducing_memory_usage">Ruby Enterprise Edition&#8217;s memory reduction technology</a> useless.</p></div>
1509
- </dd>
1510
- </dl></div>
2267
+ </li>
2268
+ <li>
2269
+ <p>
2270
+ <em>3</em>: Show even more debugging information.
2271
+ </p>
2272
+ </li>
2273
+ </ul></div>
2274
+ <div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration block.
2275
+ The default is <em>0</em>.</p></div>
2276
+ </div>
2277
+ <div class="sect2">
2278
+ <h3 id="_passenger_debug_log_file_lt_filename_gt">5.10. passenger_debug_log_file &lt;filename&gt;</h3>
2279
+ <div class="paragraph"><p>By default Phusion Passenger debugging and error messages are written to the global
2280
+ web server error log. This option allows one to specify the file that debugging and
2281
+ error messages should be written to instead.</p></div>
2282
+ <div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration block.</p></div>
2283
+ </div>
2284
+ <div class="sect2">
2285
+ <h3 id="_ruby_on_rails_specific_options">5.11. Ruby on Rails-specific options</h3>
2286
+ <div class="sect3">
2287
+ <h4 id="RailsEnv">5.11.1. rails_env &lt;string&gt;</h4>
2288
+ <div class="paragraph"><p>This option allows one to specify the default <tt>RAILS_ENV</tt> value.</p></div>
1511
2289
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
1512
2290
  <div class="ulist"><ul>
1513
2291
  <li>
@@ -1531,8 +2309,10 @@ In an <em>if</em> configuration scope.
1531
2309
  </p>
1532
2310
  </li>
1533
2311
  </ul></div>
1534
- <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>smart-lv2</em>.</p></div>
1535
- <h4 id="_rails_framework_spawner_idle_time_lt_integer_gt">5.9.3. rails_framework_spawner_idle_time &lt;integer&gt;</h4>
2312
+ <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>production</em>.</p></div>
2313
+ </div>
2314
+ <div class="sect3">
2315
+ <h4 id="_rails_framework_spawner_idle_time_lt_integer_gt">5.11.2. rails_framework_spawner_idle_time &lt;integer&gt;</h4>
1536
2316
  <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
1537
2317
  Phusion Passenger do. That is, it will automatically shutdown if it hasn&#8217;t done
1538
2318
  anything for a given period.</p></div>
@@ -1569,7 +2349,9 @@ In an <em>if</em> configuration scope.
1569
2349
  </li>
1570
2350
  </ul></div>
1571
2351
  <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>
1572
- <h4 id="_rails_app_spawner_idle_time_lt_integer_gt">5.9.4. rails_app_spawner_idle_time &lt;integer&gt;</h4>
2352
+ </div>
2353
+ <div class="sect3">
2354
+ <h4 id="_rails_app_spawner_idle_time_lt_integer_gt">5.11.3. rails_app_spawner_idle_time &lt;integer&gt;</h4>
1573
2355
  <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
1574
2356
  Phusion Passenger do. That is, it will automatically shutdown if it hasn&#8217;t done
1575
2357
  anything for a given period.</p></div>
@@ -1606,13 +2388,22 @@ In an <em>if</em> configuration scope.
1606
2388
  </li>
1607
2389
  </ul></div>
1608
2390
  <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>
1609
- <h3 id="_rack_specific_options">5.10. Rack-specific options</h3><div style="clear:left"></div>
1610
- <h4 id="RackEnv">5.10.1. rack_env &lt;string&gt;</h4>
2391
+ </div>
2392
+ </div>
2393
+ <div class="sect2">
2394
+ <h3 id="_rack_specific_options">5.12. Rack-specific options</h3>
2395
+ <div class="sect3">
2396
+ <h4 id="RackEnv">5.12.1. rack_env &lt;string&gt;</h4>
1611
2397
  <div class="paragraph"><p>This option allows one to specify the default <tt>RACK_ENV</tt> value.</p></div>
1612
2398
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
1613
2399
  <div class="ulist"><ul>
1614
2400
  <li>
1615
2401
  <p>
2402
+ In the <em>http</em> configuration block.
2403
+ </p>
2404
+ </li>
2405
+ <li>
2406
+ <p>
1616
2407
  In a <em>server</em> configuration block.
1617
2408
  </p>
1618
2409
  </li>
@@ -1629,11 +2420,25 @@ In an <em>if</em> configuration scope.
1629
2420
  </ul></div>
1630
2421
  <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>production</em>.</p></div>
1631
2422
  </div>
1632
- <h2 id="_analysis_and_system_maintenance_tools">6. Analysis and system maintenance tools</h2>
2423
+ </div>
2424
+ <div class="sect2">
2425
+ <h3 id="_deprecated_options">5.13. Deprecated options</h3>
2426
+ <div class="paragraph"><p>The following options have been deprecated, but are still supported for backwards
2427
+ compatibility reasons.</p></div>
2428
+ <div class="sect3">
2429
+ <h4 id="_rails_spawn_method">5.13.1. rails_spawn_method</h4>
2430
+ <div class="paragraph"><p>Deprecated in favor of <a href="#PassengerSpawnMethod">passenger_spawn_method</a>.</p></div>
2431
+ </div>
2432
+ </div>
2433
+ </div>
2434
+ </div>
2435
+ <div class="sect1">
2436
+ <h2 id="_analysis_and_system_maintenance">6. Analysis and system maintenance</h2>
1633
2437
  <div class="sectionbody">
1634
2438
  <div class="paragraph"><p>Phusion Passenger provides a set of tools, which are useful for system analysis,
1635
2439
  maintenance and troubleshooting.</p></div>
1636
- <h3 id="_inspecting_memory_usage">6.1. Inspecting memory usage</h3><div style="clear:left"></div>
2440
+ <div class="sect2">
2441
+ <h3 id="_inspecting_memory_usage">6.1. Inspecting memory usage</h3>
1637
2442
  <div class="paragraph"><p>Process inspection tools such as <tt>ps</tt> and <tt>top</tt> are useful, but they
1638
2443
  <a href="http://groups.google.com/group/phusion-passenger/msg/1fd1c233456d3180">rarely show the correct memory usage</a>.
1639
2444
  The real memory usage is usually lower than what <tt>ps</tt> and <tt>top</tt> report.</p></div>
@@ -1683,7 +2488,9 @@ don&#8217;t provide facilities for determining processes' private dirty RSS. On
1683
2488
  the Resident Set Size is reported instead.</td>
1684
2489
  </tr></table>
1685
2490
  </div>
1686
- <h3 id="_inspecting_phusion_passenger_8217_s_internal_status">6.2. Inspecting Phusion Passenger&#8217;s internal status</h3><div style="clear:left"></div>
2491
+ </div>
2492
+ <div class="sect2">
2493
+ <h3 id="_inspecting_phusion_passenger_8217_s_internal_status">6.2. Inspecting Phusion Passenger&#8217;s internal status</h3>
1687
2494
  <div class="paragraph"><p>One can inspect Phusion Passenger&#8217;s internal status with the tool <tt>passenger-status</tt>.
1688
2495
  This tool must typically be run as root. For example:</p></div>
1689
2496
  <div class="listingblock">
@@ -1810,7 +2617,9 @@ Your application is frozen, i.e. has stopped responding. See
1810
2617
  </p>
1811
2618
  </li>
1812
2619
  </ol></div>
1813
- <h3 id="debugging_frozen">6.3. Debugging frozen applications</h3><div style="clear:left"></div>
2620
+ </div>
2621
+ <div class="sect2">
2622
+ <h3 id="debugging_frozen">6.3. Debugging frozen applications</h3>
1814
2623
  <div class="paragraph"><p>If one of your application instances is frozen (stopped responding), then you
1815
2624
  can figure out where it is frozen by killing it with <em>SIGABRT</em>. This will cause the
1816
2625
  application to raise an exception, with a backtrace.</p></div>
@@ -1831,9 +2640,77 @@ will restart killed application instances, as if nothing bad happened.</td>
1831
2640
  </tr></table>
1832
2641
  </div>
1833
2642
  </div>
2643
+ <div class="sect2">
2644
+ <h3 id="_accessing_individual_application_processes">6.4. Accessing individual application processes</h3>
2645
+ <div class="paragraph"><p>When a request is sent to the web server, Phusion Passenger will automatically forward
2646
+ the request to the most suitable application process, but sometimes it is desirable to
2647
+ be able to directly access the individual application processes. Use cases include, but
2648
+ are not limited to:</p></div>
2649
+ <div class="ulist"><ul>
2650
+ <li>
2651
+ <p>
2652
+ One wants to debug a memory leak or memory bloat problem that only seems to appear on
2653
+ certain URIs. One can send a request to a specific process to see whether that request
2654
+ causes the process&#8217;s memory usage to rise.
2655
+ </p>
2656
+ </li>
2657
+ <li>
2658
+ <p>
2659
+ The application caches data in local memory, and one wants to tell a specific
2660
+ application process to clear that local data.
2661
+ </p>
2662
+ </li>
2663
+ <li>
2664
+ <p>
2665
+ Other debugging use cases.
2666
+ </p>
2667
+ </li>
2668
+ </ul></div>
2669
+ <div class="paragraph"><p>All individual application processes are accessible via HTTP, so you can use standard
2670
+ HTTP tools like <em>curl</em>. The exact addresses can be obtained with the command
2671
+ <tt>passenger-status --verbose</tt>. These sockets are all bound to 127.0.0.1, but the port
2672
+ number is dynamically assigned. As a security measure, the sockets are also protected
2673
+ with a process-specific random password, which you can see in the
2674
+ <tt>passenger-status --verbose</tt> output. This password must be sent through the
2675
+ &#8220;X-Passenger-Connect-Password&#8221; HTTP header.</p></div>
2676
+ <div class="paragraph"><p>Example:</p></div>
2677
+ <div class="listingblock">
2678
+ <div class="content">
2679
+ <pre><tt>bash# passenger-status --verbose
2680
+ ----------- General information -----------
2681
+ max = 6
2682
+ count = 2
2683
+ active = 0
2684
+ inactive = 2
2685
+ Waiting on global queue: 0
2686
+
2687
+ ----------- Application groups -----------
2688
+ /Users/hongli/Sites/rack.test:
2689
+ App root: /Users/hongli/Sites/rack.test
2690
+ * PID: 24235 Sessions: 0 Processed: 7 Uptime: 17s
2691
+ URL : http://127.0.0.1:58122
2692
+ Password: nFfVOX1F8LjZ90HJh28Sd_htJOsgRsNne2QXKf8NIXw
2693
+ * PID: 24250 Sessions: 0 Processed: 4 Uptime: 1s
2694
+ URL : http://127.0.0.1:57933
2695
+ Password: _RGXlQ9EGDGJKLevQ_qflUtF1KmxEo2UiRzMwIE1sBY</tt></pre>
2696
+ </div></div>
2697
+ <div class="paragraph"><p>Here we see that the web application <em>rack.test</em> has two processes.
2698
+ Process 24235 is accessible via <a href="http://127.0.0.1:58122">http://127.0.0.1:58122</a>, and
2699
+ process 24250 is accessible via <a href="http://127.0.0.1:57933">http://127.0.0.1:57933</a>.</p></div>
2700
+ <div class="paragraph"><p>To access 24235 we must send its password, <em>nFfVOX1F8LjZ90HJh28Sd_htJOsgRsNne2QXKf8NIXw</em>,
2701
+ through the <em>X-Passenger-Connect-Password</em> HTTP header, like this:</p></div>
2702
+ <div class="listingblock">
2703
+ <div class="content">
2704
+ <pre><tt>bash# curl -H "X-Passenger-Connect-Password: nFfVOX1F8LjZ90HJh28Sd_htJOsgRsNne2QXKf8NIXw" http://127.0.0.1:58122/</tt></pre>
2705
+ </div></div>
2706
+ </div>
2707
+ </div>
2708
+ </div>
2709
+ <div class="sect1">
1834
2710
  <h2 id="_tips">7. Tips</h2>
1835
2711
  <div class="sectionbody">
1836
- <h3 id="user_switching">7.1. User switching (security)</h3><div style="clear:left"></div>
2712
+ <div class="sect2">
2713
+ <h3 id="user_switching">7.1. User switching (security)</h3>
1837
2714
  <div class="paragraph"><p>There is a problem that plagues most PHP web hosts, namely the fact that all PHP
1838
2715
  applications are run in the same user context as the web server. So for
1839
2716
  example, Joe&#8217;s PHP application will be able to read Jane&#8217;s PHP application&#8217;s
@@ -1848,10 +2725,8 @@ there are things that you should keep in mind:</p></div>
1848
2725
  <div class="ulist"><ul>
1849
2726
  <li>
1850
2727
  <p>
1851
- The owner of <em>environment.rb</em> must have read access to the Rails application&#8217;s
1852
- folder, and read/write access to the Rails application&#8217;s <em>logs</em> folder.
1853
- Likewise, the owner of <em>config.ru</em> must have read access to the Rack application&#8217;s
1854
- folder.
2728
+ The owner of <em>environment.rb</em>/<em>config.ru</em> must have read access to the application&#8217;s
2729
+ root directory, and read/write access to the application&#8217;s <em>logs</em> directory.
1855
2730
  </p>
1856
2731
  </li>
1857
2732
  <li>
@@ -1865,19 +2740,24 @@ This feature is only available if Apache is started by <em>root</em>. This is th
1865
2740
  Under no circumstances will applications be run as <em>root</em>. If
1866
2741
  <em>environment.rb</em>/<em>config.ru</em> is owned as root or by an unknown user, then the
1867
2742
  Rails/Rack application will run as the user specified by
1868
- <a href="#PassengerDefaultUser">PassengerDefaultUser (Apache)</a>/<a href="#PassengerDefaultUser">passenger_default_user (Nginx)</a>.
2743
+ <a href="#PassengerDefaultUser">passenger_default_user</a> and
2744
+ <a href="#PassengerDefaultGroup">passenger_default_group</a>.
1869
2745
  </p>
1870
2746
  </li>
1871
2747
  </ul></div>
1872
2748
  <div class="paragraph"><p>User switching can be disabled with the
1873
- <a href="#PassengerUserSwitching">PassengerUserSwitching (Apache)</a>/<a href="#PassengerUserSwitching">passenger_user_switching (Nginx)</a>
2749
+ <a href="#PassengerUserSwitching">passenger_user_switching</a>
1874
2750
  option.</p></div>
1875
- <h3 id="reducing_memory_usage">7.2. Reducing memory consumption of Ruby on Rails applications by 33%</h3><div style="clear:left"></div>
2751
+ </div>
2752
+ <div class="sect2">
2753
+ <h3 id="reducing_memory_usage">7.2. Reducing memory consumption of Ruby on Rails applications by 33%</h3>
1876
2754
  <div class="paragraph"><p>Is it possible to reduce memory consumption of your Rails applications by 33% on average,
1877
2755
  by using <a href="http://www.rubyenterpriseedition.com/">Ruby Enterprise Edition</a>.
1878
2756
  Please visit the website for details.</p></div>
1879
2757
  <div class="paragraph"><p>Note that this feature does not apply to Rack applications.</p></div>
1880
- <h3 id="capistrano">7.3. Capistrano recipe</h3><div style="clear:left"></div>
2758
+ </div>
2759
+ <div class="sect2">
2760
+ <h3 id="capistrano">7.3. Capistrano recipe</h3>
1881
2761
  <div class="paragraph"><p>Phusion Passenger can be combined with <a href="http://capify.org/">Capistrano</a>.
1882
2762
  The following Capistrano recipe demonstrates Phusion Passenger support.
1883
2763
  It assumes that you&#8217;re using Git as version control system.</p></div>
@@ -1909,7 +2789,9 @@ namespace :deploy do
1909
2789
  end
1910
2790
  end</tt></pre>
1911
2791
  </div></div>
1912
- <h3 id="bundler_support">7.4. Bundler support</h3><div style="clear:left"></div>
2792
+ </div>
2793
+ <div class="sect2">
2794
+ <h3 id="bundler_support">7.4. Bundler support</h3>
1913
2795
  <div class="paragraph"><p>Phusion Passenger has automatic support for <a href="http://gembundler.com/git.html">Bundler</a>.
1914
2796
  It works as follows:</p></div>
1915
2797
  <div class="ulist"><ul>
@@ -1940,7 +2822,9 @@ you can override Phusion Passenger&#8217;s Bundler support code by creating a fi
1940
2822
  <em>config/setup_load_paths.rb</em>. If this file exists then it will be required before loading
1941
2823
  the application startup file. In this file you can do whatever you need to setup Bundler
1942
2824
  or a similar system.</p></div>
1943
- <h3 id="moving_phusion_passenger">7.5. Moving Phusion Passenger to a different directory</h3><div style="clear:left"></div>
2825
+ </div>
2826
+ <div class="sect2">
2827
+ <h3 id="moving_phusion_passenger">7.5. Moving Phusion Passenger to a different directory</h3>
1944
2828
  <div class="paragraph"><p>It is possible to relocate the Phusion Passenger files to a different directory. It
1945
2829
  involves two steps:</p></div>
1946
2830
  <div class="olist arabic"><ol class="arabic">
@@ -1977,7 +2861,9 @@ Edit your Apache configuration file, and set:
1977
2861
  </div></div>
1978
2862
  </li>
1979
2863
  </ol></div>
1980
- <h3 id="_installing_multiple_ruby_on_rails_versions">7.6. Installing multiple Ruby on Rails versions</h3><div style="clear:left"></div>
2864
+ </div>
2865
+ <div class="sect2">
2866
+ <h3 id="_installing_multiple_ruby_on_rails_versions">7.6. Installing multiple Ruby on Rails versions</h3>
1981
2867
  <div class="paragraph"><p>Each Ruby on Rails applications that are going to be deployed may require a
1982
2868
  specific Ruby on Rails version. You can install a specific version with
1983
2869
  this command:</p></div>
@@ -1988,7 +2874,9 @@ this command:</p></div>
1988
2874
  <div class="paragraph"><p>where <em>X.X.X</em> is the version number of Ruby on Rails.</p></div>
1989
2875
  <div class="paragraph"><p>All of these versions will exist in parallel, and will not conflict with each
1990
2876
  other. Phusion Passenger will automatically make use of the correct version.</p></div>
1991
- <h3 id="_making_the_application_restart_after_each_request">7.7. Making the application restart after each request</h3><div style="clear:left"></div>
2877
+ </div>
2878
+ <div class="sect2">
2879
+ <h3 id="_making_the_application_restart_after_each_request">7.7. Making the application restart after each request</h3>
1992
2880
  <div class="paragraph"><p>In some situations it might be desirable to restart the web application after
1993
2881
  each request, for example when developing a non-Rails application that doesn&#8217;t
1994
2882
  support code reloading, or when developing a web framework.</p></div>
@@ -2009,7 +2897,9 @@ or when you&#8217;re not developing a Rails application and your web framework
2009
2897
  does not support code reloading.</td>
2010
2898
  </tr></table>
2011
2899
  </div>
2012
- <h3 id="sub_uri_deployment_uri_fix">7.8. How to fix broken images/CSS/JavaScript URIs in sub-URI deployments</h3><div style="clear:left"></div>
2900
+ </div>
2901
+ <div class="sect2">
2902
+ <h3 id="sub_uri_deployment_uri_fix">7.8. How to fix broken images/CSS/JavaScript URIs in sub-URI deployments</h3>
2013
2903
  <div class="paragraph"><p>Some people experience broken images and other broken static assets when they
2014
2904
  deploy their application to a sub-URI (i.e. <em>http://mysite.com/railsapp/</em>).
2015
2905
  The reason for this usually is that you used a
@@ -2045,7 +2935,92 @@ append a timestamp to the URI to better facilitate HTTP caching. For more inform
2045
2935
  please refer to
2046
2936
  <a href="http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html">the Rails API docs</a>.</p></div>
2047
2937
  </div>
2048
- <h2 id="_appendix_a_about_this_document">8. Appendix A: About this document</h2>
2938
+ </div>
2939
+ </div>
2940
+ <div class="sect1">
2941
+ <h2 id="_under_the_hood">8. Under the hood</h2>
2942
+ <div class="sectionbody">
2943
+ <div class="paragraph"><p>Phusion Passenger hides a lot of complexity for the end user (i.e. the web server
2944
+ system administrator), but sometimes it is desirable to know what is going on.
2945
+ This section describes a few things that Phusion Passenger does under the hood.</p></div>
2946
+ <div class="sect2">
2947
+ <h3 id="_page_caching_support">8.1. Page caching support</h3>
2948
+ <div class="paragraph"><p>For each HTTP request, Phusion Passenger will automatically look for a corresponding
2949
+ page cache file, and serve that if it exists. It does this by appending ".html" to
2950
+ the filename that the URI normally maps to, and checking whether that file exists.
2951
+ This check occurs after checking whether the original mapped filename exists (as part
2952
+ of static asset serving). All this is done without the need for special mod_rewrite
2953
+ rules.</p></div>
2954
+ <div class="paragraph"><p>For example, suppose that the browser requests <em>/foo/bar</em>.</p></div>
2955
+ <div class="olist arabic"><ol class="arabic">
2956
+ <li>
2957
+ <p>
2958
+ Phusion Passenger will first check whether this URI maps to a static file, i.e.
2959
+ whether the file <em>foo/bar</em> exists in the web application&#8217;s <em>public</em> directory.
2960
+ If it does then Phusion Passenger will serve this file through Apache immediately.
2961
+ </p>
2962
+ </li>
2963
+ <li>
2964
+ <p>
2965
+ If that doesn&#8217;t exist, then Phusion Passenger will check whether the file
2966
+ <em>foo/bar.html</em> exists. If it does then Phusion Passenger will serve this file
2967
+ through Apache immediately.
2968
+ </p>
2969
+ </li>
2970
+ <li>
2971
+ <p>
2972
+ If <em>foo/bar.html</em> doesn&#8217;t exist either, then Phusion Passenger will forward the
2973
+ request to the underlying web application.
2974
+ </p>
2975
+ </li>
2976
+ </ol></div>
2977
+ <div class="paragraph"><p>Note that Phusion Passenger&#8217;s page caching support doesn&#8217;t work if your web
2978
+ application uses a non-standard page cache directory, i.e. if it doesn&#8217;t cache to
2979
+ the <em>public</em> directory. In that case you&#8217;ll need to use mod_rewrite to serve such
2980
+ page cache files.</p></div>
2981
+ </div>
2982
+ <div class="sect2">
2983
+ <h3 id="application_detection">8.2. How Phusion Passenger detects whether a virtual host is a web application</h3>
2984
+ <div class="paragraph"><p>After you&#8217;ve read the deployment instructions you might wonder how Phusion Passenger
2985
+ knows that the server root points to a web application that Phusion Passenger is
2986
+ able to serve, and how it knows what kind of web application it is (e.g. Rails or Rack).</p></div>
2987
+ <div class="paragraph"><p>Phusion Passenger checks whether the virtual host is a Rails application by checking
2988
+ whether the following file exists:</p></div>
2989
+ <div class="listingblock">
2990
+ <div class="content">
2991
+ <pre><tt>dirname(DocumentRoot) + "/config/environment.rb"</tt></pre>
2992
+ </div></div>
2993
+ <div class="paragraph"><p>If you&#8217;re not a programmer and don&#8217;t understand the above pseudo-code snippet, it means
2994
+ that Phusion Passenger will:</p></div>
2995
+ <div class="olist arabic"><ol class="arabic">
2996
+ <li>
2997
+ <p>
2998
+ Extract the parent directory filename from the value of the &#8220;root&#8221; directive.
2999
+ </p>
3000
+ </li>
3001
+ <li>
3002
+ <p>
3003
+ Append the text "/config/environment.rb" to the result, and check whether the resulting
3004
+ filename exists.
3005
+ </p>
3006
+ </li>
3007
+ </ol></div>
3008
+ <div class="paragraph"><p>So suppose that your server root is <em>/webapps/foo/public</em>. Phusion Passenger will check
3009
+ whether the file <em>/webapps/foo/config/environment.rb</em> exists.</p></div>
3010
+ <div class="paragraph"><p>Note that Phusion Passenger for Nginx does <strong>not</strong> resolve any symlinks in the root path.
3011
+ So for example, suppose that your root points to <em>/home/www/example.com</em>, which in
3012
+ turn is a symlink to <em>/webapps/example.com/public</em>. Phusion Passenger for Nginx will check for
3013
+ <em>/home/www/config/environment.rb</em>, <strong>not</strong> <em>/webapps/example.com/config/environment.rb</em>.
3014
+ This file of course doesn&#8217;t exist, and as a result Phusion Passenger will not activate
3015
+ itself for this virtual host, and you&#8217;ll most likely see some output generated by the
3016
+ Nginx default directory handler such as a Forbidden error message.</p></div>
3017
+ <div class="paragraph"><p>Detection of Rack applications happens through the same mechanism, exception that
3018
+ Phusion Passenger will look for <em>config.ru</em> instead of <em>config/environment.rb</em>.</p></div>
3019
+ </div>
3020
+ </div>
3021
+ </div>
3022
+ <div class="sect1">
3023
+ <h2 id="_appendix_a_about_this_document">9. Appendix A: About this document</h2>
2049
3024
  <div class="sectionbody">
2050
3025
  <div class="paragraph"><p>The text of this document is licensed under the
2051
3026
  <a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons
@@ -2063,9 +3038,12 @@ Attribution-Share Alike 3.0 Unported License</a>.</p></div>
2063
3038
  </span></p></div>
2064
3039
  <div class="paragraph"><p>Phusion Passenger is a trademark of Hongli Lai &amp; Ninh Bui.</p></div>
2065
3040
  </div>
2066
- <h2 id="_appendix_b_terminology">9. Appendix B: Terminology</h2>
3041
+ </div>
3042
+ <div class="sect1">
3043
+ <h2 id="_appendix_b_terminology">10. Appendix B: Terminology</h2>
2067
3044
  <div class="sectionbody">
2068
- <h3 id="application_root">9.1. Application root</h3><div style="clear:left"></div>
3045
+ <div class="sect2">
3046
+ <h3 id="application_root">10.1. Application root</h3>
2069
3047
  <div class="paragraph"><p>The root directory of an application that&#8217;s served by Phusion Passenger.</p></div>
2070
3048
  <div class="paragraph"><p>In case of Ruby on Rails applications, this is the directory that contains
2071
3049
  <em>Rakefile</em>, <em>app/</em>, <em>config/</em>, <em>public/</em>, etc. In other words, the directory
@@ -2123,7 +3101,10 @@ For example, take the following directory structure:</p></div>
2123
3101
  +- ...</tt></pre>
2124
3102
  </div></div>
2125
3103
  </div>
2126
- <h2 id="spawning_methods_explained">10. Appendix C: Spawning methods explained</h2>
3104
+ </div>
3105
+ </div>
3106
+ <div class="sect1">
3107
+ <h2 id="spawning_methods_explained">11. Appendix C: Spawning methods explained</h2>
2127
3108
  <div class="sectionbody">
2128
3109
  <div class="paragraph"><p>At its core, Phusion Passenger is an HTTP proxy and process manager. It spawns
2129
3110
  Ruby on Rails/Rack/WSGI worker processes (which may also be referred to as
@@ -2132,7 +3113,8 @@ processes.</p></div>
2132
3113
  <div class="paragraph"><p>While this may sound simple, there&#8217;s not just one way to spawn worker processes.
2133
3114
  Let&#8217;s go over the different spawning methods. For simplicity&#8217;s sake, let&#8217;s
2134
3115
  assume that we&#8217;re only talking about Ruby on Rails applications.</p></div>
2135
- <h3 id="_the_most_straightforward_and_traditional_way_conservative_spawning">10.1. The most straightforward and traditional way: conservative spawning</h3><div style="clear:left"></div>
3116
+ <div class="sect2">
3117
+ <h3 id="_the_most_straightforward_and_traditional_way_conservative_spawning">11.1. The most straightforward and traditional way: conservative spawning</h3>
2136
3118
  <div class="paragraph"><p>Phusion Passenger could create a new Ruby process, which will then load the
2137
3119
  Rails application along with the entire Rails framework. This process will then
2138
3120
  enter an request handling main loop.</p></div>
@@ -2147,14 +3129,15 @@ programmers jargon, mongrel_cluster creates new Ruby processes by forking the
2147
3129
  current process and exec()-ing a new Ruby interpreter. Phusion Passenger on the
2148
3130
  other hand creates processes that reuse the already loaded Ruby interpreter. In
2149
3131
  programmers jargon, Phusion Passenger calls fork(), but not exec().</p></div>
2150
- <h3 id="_the_smart_spawning_method">10.2. The smart spawning method</h3><div style="clear:left"></div>
3132
+ </div>
3133
+ <div class="sect2">
3134
+ <h3 id="_the_smart_spawning_method">11.2. The smart spawning method</h3>
2151
3135
  <div class="admonitionblock">
2152
3136
  <table><tr>
2153
3137
  <td class="icon">
2154
3138
  <img src="./images/icons/note.png" alt="Note" />
2155
3139
  </td>
2156
- <td class="content">Smart spawning is only available for Ruby on Rails applications, not for
2157
- Rack applications or WSGI applications.</td>
3140
+ <td class="content">Smart spawning is supported for all Ruby applications but not for WSGI applications.</td>
2158
3141
  </tr></table>
2159
3142
  </div>
2160
3143
  <div class="paragraph"><p>While conservative spawning works well, it&#8217;s not as efficient as it could be
@@ -2170,7 +3153,8 @@ by application and Rails framework code, by utilizing so-called
2170
3153
  copy-on-write semantics of the virtual memory system on modern operating
2171
3154
  systems. As a side effect, the startup time is also reduced. This is technique
2172
3155
  is exploited by Phusion Passenger&#8217;s <em>smart</em> and <em>smart-lv2</em> spawn methods.</p></div>
2173
- <h4 id="_how_it_works">10.2.1. How it works</h4>
3156
+ <div class="sect3">
3157
+ <h4 id="_how_it_works">11.2.1. How it works</h4>
2174
3158
  <div class="paragraph"><p>When the <em>smart-lv2</em> spawn method is being used, Phusion Passenger will first
2175
3159
  create a so-called <em>ApplicationSpawner server</em> process. This process loads the
2176
3160
  entire Rails application along with the Rails framework, by loading
@@ -2220,7 +3204,9 @@ ApplicationSpawner and FrameworkSpawner servers have an idle timeout just
2220
3204
  </p>
2221
3205
  </li>
2222
3206
  </ul></div>
2223
- <h4 id="_summary_of_benefits">10.2.2. Summary of benefits</h4>
3207
+ </div>
3208
+ <div class="sect3">
3209
+ <h4 id="_summary_of_benefits">11.2.2. Summary of benefits</h4>
2224
3210
  <div class="paragraph"><p>Suppose that Phusion Passenger needs a new worker process for an application
2225
3211
  that uses Rails 2.2.1.</p></div>
2226
3212
  <div class="ulist"><ul>
@@ -2254,7 +3240,10 @@ process).</p></div>
2254
3240
  assuming that your Ruby interpreter is <a href="#reducing_memory_usage">copy-on-write friendly</a>.</p></div>
2255
3241
  <div class="paragraph"><p>Of course, smart spawning is not without gotchas. But if you understand the
2256
3242
  gotchas you can easily reap the benefits of smart spawning.</p></div>
2257
- <h3 id="_smart_spawning_gotcha_1_unintential_file_descriptor_sharing">10.3. Smart spawning gotcha #1: unintential file descriptor sharing</h3><div style="clear:left"></div>
3243
+ </div>
3244
+ </div>
3245
+ <div class="sect2">
3246
+ <h3 id="_smart_spawning_gotcha_1_unintential_file_descriptor_sharing">11.3. Smart spawning gotcha #1: unintential file descriptor sharing</h3>
2258
3247
  <div class="paragraph"><p>Because worker processes are created by forking from an ApplicationSpawner
2259
3248
  server, it will share all file descriptors that are opened by the
2260
3249
  ApplicationSpawner server. (This is part of the semantics of the Unix
@@ -2286,7 +3275,8 @@ http://www.gnu.org/software/src-highlite -->
2286
3275
  <div class="paragraph"><p>Note that Phusion Passenger automatically reestablishes the connection to the
2287
3276
  database upon creating a new worker process, which is why you normally do not
2288
3277
  encounter any database issues when using smart spawning mode.</p></div>
2289
- <h4 id="_example_1_memcached_connection_sharing_harmful">10.3.1. Example 1: Memcached connection sharing (harmful)</h4>
3278
+ <div class="sect3">
3279
+ <h4 id="_example_1_memcached_connection_sharing_harmful">11.3.1. Example 1: Memcached connection sharing (harmful)</h4>
2290
3280
  <div class="paragraph"><p>Suppose we have a Rails application that connects to a Memcached server in
2291
3281
  <em>environment.rb</em>. This causes the ApplicationSpawner to have a socket connection
2292
3282
  (file descriptor) to the Memcached server, as shown in the following figure:</p></div>
@@ -2376,7 +3366,9 @@ http://www.gnu.org/software/src-highlite -->
2376
3366
  <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
2377
3367
  <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
2378
3368
  <span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
2379
- <h4 id="_example_2_log_file_sharing_not_harmful">10.3.2. Example 2: Log file sharing (not harmful)</h4>
3369
+ </div>
3370
+ <div class="sect3">
3371
+ <h4 id="_example_2_log_file_sharing_not_harmful">11.3.2. Example 2: Log file sharing (not harmful)</h4>
2380
3372
  <div class="paragraph"><p>There are also cases in which unintential file descriptor sharing is not harmful.
2381
3373
  One such case is log file file descriptor sharing. Even if two processes write
2382
3374
  to the log file at the same time, the worst thing that can happen is that the
@@ -2385,7 +3377,10 @@ data in the log file is interleaved.</p></div>
2385
3377
  must synchronize write access via an inter-process synchronization mechanism,
2386
3378
  such as file locks. Reopening the log file, like you would have done in the
2387
3379
  Memcached example, doesn&#8217;t help.</p></div>
2388
- <h3 id="_smart_spawning_gotcha_2_the_need_to_revive_threads">10.4. Smart spawning gotcha #2: the need to revive threads</h3><div style="clear:left"></div>
3380
+ </div>
3381
+ </div>
3382
+ <div class="sect2">
3383
+ <h3 id="_smart_spawning_gotcha_2_the_need_to_revive_threads">11.4. Smart spawning gotcha #2: the need to revive threads</h3>
2389
3384
  <div class="paragraph"><p>Another part of the <em>fork()</em> system call&#8217;s semantics is the fact that threads
2390
3385
  disappear after a fork call. So if you&#8217;ve created any threads in environment.rb,
2391
3386
  then those threads will no longer be running in newly created worker process.
@@ -2406,7 +3401,9 @@ http://www.gnu.org/software/src-highlite -->
2406
3401
  <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
2407
3402
  <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
2408
3403
  <span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
2409
- <h3 id="_smart_spawning_gotcha_3_code_load_order">10.5. Smart spawning gotcha #3: code load order</h3><div style="clear:left"></div>
3404
+ </div>
3405
+ <div class="sect2">
3406
+ <h3 id="_smart_spawning_gotcha_3_code_load_order">11.5. Smart spawning gotcha #3: code load order</h3>
2410
3407
  <div class="paragraph"><p>This gotcha is only applicable to the <em>smart</em> spawn method, not the <em>smart-lv2</em>
2411
3408
  spawn method.</p></div>
2412
3409
  <div class="paragraph"><p>If your application expects the Rails framework to be not loaded during the
@@ -2424,10 +3421,12 @@ because it was already loaded, so a subsequent <tt>require "active_record/base"<
2424
3421
  has no effect.</p></div>
2425
3422
  </div>
2426
3423
  </div>
3424
+ </div>
3425
+ </div>
2427
3426
  <div id="footnotes"><hr /></div>
2428
3427
  <div id="footer">
2429
3428
  <div id="footer-text">
2430
- Last updated 2010-06-24 13:53:02 CEST
3429
+ Last updated 2010-09-14 15:23:30 CEST
2431
3430
  </div>
2432
3431
  </div>
2433
3432
  </body>