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>Passenger architectural overview</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
385
 
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
-
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>Passenger architectural overview</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">
@@ -566,9 +535,11 @@ as to explain (some of the) design choices that we have made.</p></div>
566
535
  <div class="paragraph"><p>Or it can be a fun read for people who just want to know how Passenger works.</p></div>
567
536
  </div>
568
537
  </div>
538
+ <div class="sect1">
569
539
  <h2 id="_about_the_involved_technologies">1. About the involved technologies</h2>
570
540
  <div class="sectionbody">
571
- <h3 id="typical_web_applications">1.1. Typical web applications</h3><div style="clear:left"></div>
541
+ <div class="sect2">
542
+ <h3 id="typical_web_applications">1.1. Typical web applications</h3>
572
543
  <div class="paragraph"><p>Before we describe Passenger, it is important to understand how typical web
573
544
  applications work, from the point of view of someone who wants to connect the
574
545
  application to a web server.</p></div>
@@ -639,7 +610,9 @@ could multiplex I/O with a single thread (e.g. by using <tt>select(2)</tt> or
639
610
  processes.</p></div>
640
611
  <div class="paragraph"><p>Of course, there are many variations possible. For example, load balancers
641
612
  could be used. But that is outside the scope of this document.</p></div>
642
- <h3 id="_ruby_on_rails">1.2. Ruby on Rails</h3><div style="clear:left"></div>
613
+ </div>
614
+ <div class="sect2">
615
+ <h3 id="_ruby_on_rails">1.2. Ruby on Rails</h3>
643
616
  <div class="paragraph"><p>Every Ruby on Rails application has a <em>dispatcher</em>. This dispatcher is
644
617
  responsible for processing HTTP requests. It does not speak HTTP directly.
645
618
  Instead, it accepts data structures that contain the information of an
@@ -658,7 +631,9 @@ syntax tree (AST)</a>) in memory. This is observed through the use of the
658
631
  memory statistics function in <a href="http://www.rubyenterpriseedition.com/">Ruby
659
632
  Enterprise Edition</a>. Also, a lot of the startup time of a Ruby on Rails
660
633
  application is spent on bootstrapping the Rails framework.</p></div>
661
- <h3 id="_apache">1.3. Apache</h3><div style="clear:left"></div>
634
+ </div>
635
+ <div class="sect2">
636
+ <h3 id="_apache">1.3. Apache</h3>
662
637
  <div class="paragraph"><p>The Apache web server has a pluggable I/O multiprocessing (the ability to
663
638
  handle more than 1 concurrent HTTP client at the same time) architecture. An
664
639
  Apache module which implements a particular multiprocessing strategy, is called
@@ -669,9 +644,13 @@ spawns multiple worker child processes. HTTP requests are first accepted by a
669
644
  so-called control process, and then forwarded to one of the worker processes.
670
645
  The next section contains a diagram which shows the prefork MPM&#8217;s architecture.</p></div>
671
646
  </div>
647
+ </div>
648
+ </div>
649
+ <div class="sect1">
672
650
  <h2 id="_passenger_architecture">2. Passenger architecture</h2>
673
651
  <div class="sectionbody">
674
- <h3 id="_overview">2.1. Overview</h3><div style="clear:left"></div>
652
+ <div class="sect2">
653
+ <h3 id="_overview">2.1. Overview</h3>
675
654
  <div class="paragraph"><p>Passenger&#8217;s architecture is a lot like setup #2 described in
676
655
  <a href="#typical_web_applications">Typical web applications</a>. In other words,
677
656
  Passenger extends Apache and allows it to act like an application server.
@@ -693,7 +672,9 @@ mod_ruby. If the Rails application crashes or leak memory, it will have no
693
672
  effect on Apache. In fact, stability is one of our highest goals. Passenger
694
673
  is carefully designed and implemented so that Apache shouldn&#8217;t crash because
695
674
  of Passenger.</p></div>
696
- <h3 id="_spawning_and_caching_of_code_and_applications">2.2. Spawning and caching of code and applications</h3><div style="clear:left"></div>
675
+ </div>
676
+ <div class="sect2">
677
+ <h3 id="_spawning_and_caching_of_code_and_applications">2.2. Spawning and caching of code and applications</h3>
697
678
  <div class="paragraph"><p>A very naive implementation of Passenger would spawn a Ruby on Rails
698
679
  application every time an HTTP request is received, just like CGI would.
699
680
  However, spawning Ruby on Rails applications is expensive. It can take 1 or 2
@@ -761,7 +742,9 @@ in particular the documentation about the <tt>ApplicationPool</tt>,
761
742
  <div class="paragraph"><p>The application pool is responsible for spawning applications, caching
762
743
  spawned applications' handles, and cleaning up applications which have been
763
744
  idle for an extended period of time.</p></div>
764
- <h3 id="spawn_server">2.3. The spawn server</h3><div style="clear:left"></div>
745
+ </div>
746
+ <div class="sect2">
747
+ <h3 id="spawn_server">2.3. The spawn server</h3>
765
748
  <div class="paragraph"><p>The spawn server is written in Ruby, and its code can be found in the directory
766
749
  <em>lib/passenger</em>. Its main executable is <em>bin/passenger-spawn-server</em>.
767
750
  <a href="rdoc/index.html">The spawn server&#8217;s RDoc documentation</a> documents the
@@ -815,6 +798,7 @@ application instance&#8217;s life time (through the application pool).</p></div>
815
798
  <div class="paragraph"><p>Also note that each layer is a seperate process. This is required because a
816
799
  single Ruby process can only load a single Ruby on Rails framework and a
817
800
  single application.</p></div>
801
+ <div class="sect3">
818
802
  <h4 id="_memory_sharing">2.3.1. Memory sharing</h4>
819
803
  <div class="paragraph"><p>On most modern Unix operating systems, when a child process is created, it will
820
804
  share most of its memory with the parent process. Processes are not supposed to
@@ -845,7 +829,10 @@ startup times. You just won&#8217;t be able to benefit from memory sharing.</p><
845
829
  </div>
846
830
  <div class="paragraph"><p>Note that <a href="http://rubini.us/">Rubinius</a>'s garbage collector is already
847
831
  copy-on-write friendly.</p></div>
848
- <h3 id="concurrent_requests">2.4. Handling of concurrent requests</h3><div style="clear:left"></div>
832
+ </div>
833
+ </div>
834
+ <div class="sect2">
835
+ <h3 id="concurrent_requests">2.4. Handling of concurrent requests</h3>
849
836
  <div class="paragraph"><p>As explained earlier, a single Rails application instance can only handle a
850
837
  single request at the same time. This is obviously undesirable. But before we
851
838
  dive into the solution, let us take a look how the &#8220;competition&#8221; solves this
@@ -879,6 +866,9 @@ that are either heavily loaded or have little memory.</p></div>
879
866
  algorithm, which is non-trivial. The algorithm is documented in detail in
880
867
  <a href="ApplicationPool%20algorithm.txt">ApplicationPool algorithm.txt</a>.</p></div>
881
868
  </div>
869
+ </div>
870
+ </div>
871
+ <div class="sect1">
882
872
  <h2 id="_appendix_a_about_this_document">3. Appendix A: About this document</h2>
883
873
  <div class="sectionbody">
884
874
  <div class="paragraph"><p>The text of this document is licensed under the
@@ -891,10 +881,11 @@ Attribution-Share Alike 3.0 Unported License</a>.</p></div>
891
881
  </span></p></div>
892
882
  </div>
893
883
  </div>
884
+ </div>
894
885
  <div id="footnotes"><hr /></div>
895
886
  <div id="footer">
896
887
  <div id="footer-text">
897
- Last updated 2009-11-24 13:33:45 CEST
888
+ Last updated 2009-11-24 13:33:45 CET
898
889
  </div>
899
890
  </div>
900
891
  </body>
@@ -85,7 +85,7 @@ WARN_LOGFILE =
85
85
  #---------------------------------------------------------------------------
86
86
  # configuration options related to the input files
87
87
  #---------------------------------------------------------------------------
88
- INPUT = . ../ext/apache2
88
+ INPUT = . ../ext/apache2 ../ext/common ../ext/nginx
89
89
  INPUT_ENCODING = UTF-8
90
90
  FILE_PATTERNS = *.c *.cpp *.h
91
91
  RECURSIVE = NO
@@ -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>Security of user switching support in Passenger</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,15 +518,16 @@ footnotes: function () {
549
518
  /*]]>*/
550
519
  </script>
551
520
  </head>
552
- <body>
521
+ <body class="article">
553
522
  <div id="header">
554
523
  <h1>Security of user switching support in Passenger</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">
530
+ <div class="sect1">
561
531
  <h2 id="_problem_description">1. Problem description</h2>
562
532
  <div class="sectionbody">
563
533
  <div class="admonitionblock">
@@ -580,6 +550,8 @@ also a problem that typically plagues PHP web hosts.</p></div>
580
550
  inform the reader about the solutions have we have analyzed, so that
581
551
  Passenger&#8217;s security may be peer reviewed.</p></div>
582
552
  </div>
553
+ </div>
554
+ <div class="sect1">
583
555
  <h2 id="_analysis_of_possible_solutions">2. Analysis of possible solutions</h2>
584
556
  <div class="sectionbody">
585
557
  <div class="paragraph"><p>It seems that the only way to solve this problem on Unix, is to run each Rails
@@ -620,7 +592,8 @@ Using <em>sudo</em>.
620
592
  </li>
621
593
  </ol></div>
622
594
  <div class="paragraph"><p>Let us take a look at each method in detail.</p></div>
623
- <h3 id="apache_root">2.1. Apache must already be running as root</h3><div style="clear:left"></div>
595
+ <div class="sect2">
596
+ <h3 id="apache_root">2.1. Apache must already be running as root</h3>
624
597
  <div class="paragraph"><p>First, let us take a look at the typical Apache setup, in which Apache is bound
625
598
  to port 80, and uses the prefork MPM. Binding to any port lower than 1024
626
599
  requires root privileges, so Apache is typically run as root. This poses an
@@ -636,7 +609,7 @@ control process) is run as root. This is also true for
636
609
  Passenger can already launch Rails applications as a different user. But now we
637
610
  have to ask this question:</p></div>
638
611
  <div class="exampleblock">
639
- <div class="exampleblock-content">
612
+ <div class="content">
640
613
  <div class="paragraph"><p>If Apache is not running as root, are there still any Passenger users who
641
614
  want to run Rails applications as different users?</p></div>
642
615
  </div></div>
@@ -645,7 +618,9 @@ want to run Rails applications as different users?</p></div>
645
618
  incredibly easy, and requires no new framework to be written. However, testing
646
619
  this method in automated unit tests will require running the unit test suit as
647
620
  root.</p></div>
648
- <h3 id="_using_apache_8217_s_suexec">2.2. Using Apache&#8217;s suEXEC</h3><div style="clear:left"></div>
621
+ </div>
622
+ <div class="sect2">
623
+ <h3 id="_using_apache_8217_s_suexec">2.2. Using Apache&#8217;s suEXEC</h3>
649
624
  <div class="paragraph"><p>Apache&#8217;s <a href="http://httpd.apache.org/docs/2.0/suexec.html">suEXEC</a> allows one to
650
625
  run CGI processes as different users. But it seems that suEXEC can only be
651
626
  used for CGI, and is not a general-purpose mechanism. The
@@ -653,7 +628,9 @@ used for CGI, and is not a general-purpose mechanism. The
653
628
  PHP applications via suEXEC, but it requires patching suEXEC. If Passenger is
654
629
  to use suEXEC, then it is likely that we&#8217;ll have to patch suEXEC. The suEXEC
655
630
  website strongly discourages patching.</p></div>
656
- <h3 id="_using_a_setuid_root_wrapper_application">2.3. Using a setuid root wrapper application</h3><div style="clear:left"></div>
631
+ </div>
632
+ <div class="sect2">
633
+ <h3 id="_using_a_setuid_root_wrapper_application">2.3. Using a setuid root wrapper application</h3>
657
634
  <div class="paragraph"><p>If we use this method, we must be extremely careful. It must not be possible
658
635
  for arbitrary processes to gain root privileges. We want Passenger, and only
659
636
  Passenger, to be able to gain root privileges.</p></div>
@@ -694,7 +671,9 @@ allowed to use the wrapper. The wrapper can then check whether the calling
694
671
  process&#8217;s user is in the whitelist.</p></div>
695
672
  <div class="paragraph"><p>Writing a wrapper is not too hard. Furthermore, unit tests do not have to be
696
673
  run as root, in contrast to the run-Apache-as-root method.</p></div>
697
- <h3 id="setuid_root">2.4. Using a setuid $X wrapper application</h3><div style="clear:left"></div>
674
+ </div>
675
+ <div class="sect2">
676
+ <h3 id="setuid_root">2.4. Using a setuid $X wrapper application</h3>
698
677
  <div class="paragraph"><p>A setuid $X wrapper will work in a fashion similar to the setuid root wrapper,
699
678
  i.e. it will use a password file for authorization.</p></div>
700
679
  <div class="paragraph"><p>Passenger does not spawn Rails applications itself, but does so via the spawn
@@ -710,10 +689,14 @@ memory with each other, so a lot of memory is wasted compared to the other
710
689
  methods.</p></div>
711
690
  <div class="paragraph"><p>Implementing this will also take more work. One has to create a different
712
691
  wrapper for each user, and to install it.</p></div>
713
- <h3 id="_using_em_su_em">2.5. Using <em>su</em></h3><div style="clear:left"></div>
692
+ </div>
693
+ <div class="sect2">
694
+ <h3 id="_using_em_su_em">2.5. Using <em>su</em></h3>
714
695
  <div class="paragraph"><p>The standard Unix <em>su</em> tool asks for the root password. It&#8217;s a bad idea for
715
696
  Apache to know the root password, so using <em>su</em> is not a viable alternative.</p></div>
716
- <h3 id="_using_em_sudo_em">2.6. Using <em>sudo</em></h3><div style="clear:left"></div>
697
+ </div>
698
+ <div class="sect2">
699
+ <h3 id="_using_em_sudo_em">2.6. Using <em>sudo</em></h3>
717
700
  <div class="paragraph"><p>It might be possible to use the <em>sudo</em> utility. sudo can be configured in
718
701
  such a way that the user Apache runs as can use sudo without having to enter a
719
702
  password.</p></div>
@@ -726,7 +709,9 @@ potential security problems. Note that passing information via program arguments
726
709
  is not secure: it is possible to view that information with tools like <em>ps</em>,
727
710
  or (on Linux) by reading the file <tt>/proc/$PID/cmdline</tt>.</p></div>
728
711
  <div class="paragraph"><p>So it seems <em>sudo</em> is not a viable alternative.</p></div>
729
- <h3 id="_common_security_issues">2.7. Common security issues</h3><div style="clear:left"></div>
712
+ </div>
713
+ <div class="sect2">
714
+ <h3 id="_common_security_issues">2.7. Common security issues</h3>
730
715
  <div class="paragraph"><p>Whatever method Passenger will use, the following security principles must be
731
716
  honored:</p></div>
732
717
  <div class="ulist"><ul>
@@ -747,6 +732,9 @@ Is there a need for a user whitelist/blacklist? That is, is there a need for
747
732
  </li>
748
733
  </ul></div>
749
734
  </div>
735
+ </div>
736
+ </div>
737
+ <div class="sect1">
750
738
  <h2 id="_chosen_solution">3. Chosen solution</h2>
751
739
  <div class="sectionbody">
752
740
  <div class="paragraph"><p>Running Apache as root and writing a setuid root wrapper are the main
@@ -770,10 +758,11 @@ significant benefits, but if you have good reasons to think otherwise, please
770
758
  feel free to discuss it with us.</p></div>
771
759
  </div>
772
760
  </div>
761
+ </div>
773
762
  <div id="footnotes"><hr /></div>
774
763
  <div id="footer">
775
764
  <div id="footer-text">
776
- Last updated 2009-11-24 13:33:45 CEST
765
+ Last updated 2009-11-24 13:33:45 CET
777
766
  </div>
778
767
  </div>
779
768
  </body>
@@ -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</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
-
410
- div.exampleblock-content {
411
- border-left: 3px solid #dddddd;
412
- padding-left: 0.5em;
413
- }
414
385
 
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</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,8 +570,11 @@ 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
580
  <div class="paragraph"><p>Phusion Passenger is confirmed on a large number of operating systems and Linux
@@ -611,14 +583,37 @@ Gentoo, Mac OS X, FreeBSD and Solaris. Both 32-bit and 64-bit platforms are supp
611
583
  <div class="paragraph"><p>The only POSIX-compliant operating system on which Phusion Passenger for Apache is
612
584
  known not to work at this time, is OpenBSD. Please use Phusion Passenger for Nginx
613
585
  instead.</p></div>
614
- <div class="paragraph"><p>If Phusion Passenger does not work on your platform then please
586
+ <div class="paragraph"><p>Please
615
587
  <a href="http://code.google.com/p/phusion-passenger/issues/list">report a bug</a>
616
588
  or
617
- <a href="http://groups.google.com/group/phusion-passenger">join our discussion list</a>.</p></div>
589
+ <a href="http://groups.google.com/group/phusion-passenger">join our discussion forum</a>
590
+ if it doesn&#8217;t work on your POSIX-compliant operating system.</p></div>
618
591
  </div>
592
+ <div class="sect2">
593
+ <h3 id="_where_to_get_support">1.2. Where to get support</h3>
594
+ <div class="ulist"><ul>
595
+ <li>
596
+ <p>
597
+ <a href="http://code.google.com/p/phusion-passenger/issues/list">Issue tracker</a> - report
598
+ bugs here.
599
+ </p>
600
+ </li>
601
+ <li>
602
+ <p>
603
+ <a href="http://groups.google.com/group/phusion-passenger">Discussion forum</a> - post a
604
+ message here if you&#8217;re experiencing problems.
605
+ </p>
606
+ </li>
607
+ </ul></div>
608
+ </div>
609
+ </div>
610
+ </div>
611
+ <div class="sect1">
619
612
  <h2 id="_installing_upgrading_and_uninstalling_phusion_passenger">2. Installing, upgrading and uninstalling Phusion Passenger</h2>
620
613
  <div class="sectionbody">
621
- <h3 id="_generic_installation_instructions">2.1. Generic installation instructions</h3><div style="clear:left"></div>
614
+ <div class="sect2">
615
+ <h3 id="_generic_installation_instructions">2.1. Generic installation instructions</h3>
616
+ <div class="sect3">
622
617
  <h4 id="install_passenger">2.1.1. Overview of installation methods</h4>
623
618
  <div class="paragraph"><p>There are three ways to install Phusion Passenger:</p></div>
624
619
  <div class="olist arabic"><ol class="arabic">
@@ -645,11 +640,14 @@ By installing a native Linux package (e.g. Debian package).
645
640
  section for the installation method that you prefer. In our opinion, installing
646
641
  the gem or the native package is easiest. For these two installation methods,
647
642
  Phusion Passenger provides an easy-to-use installer.</p></div>
643
+ </div>
644
+ <div class="sect3">
648
645
  <h4 id="_preparation_gem_and_source_tarball_only">2.1.2. Preparation (gem and source tarball only)</h4>
649
646
  <div class="paragraph"><p>If you want to install Phusion Passenger via the gem or the source tarball,
650
647
  then some preparations might be required. You can skip this subsection if
651
648
  you&#8217;re installing Phusion Passenger via a native Linux package, because no
652
649
  compilation is necessary.</p></div>
650
+ <div class="sect4">
653
651
  <h5 id="_switching_to_a_root_command_prompt">Switching to a root command prompt</h5>
654
652
  <div class="paragraph"><p>Before installing, you will probably need to switch to the <tt>root</tt> user first.
655
653
  When you install Phusion Passenger via a gem or a source tarball, some Phusion
@@ -670,6 +668,8 @@ with installing Phusion Passenger.</p></div>
670
668
  <div class="content">
671
669
  <pre><tt>su</tt></pre>
672
670
  </div></div>
671
+ </div>
672
+ <div class="sect4">
673
673
  <h5 id="specifying_correct_apache_install">Specifying the correct Apache installation</h5>
674
674
  <div class="paragraph"><p>The Phusion Passenger installer will attempt to automatically detect Apache,
675
675
  and compile Phusion Passenger against that Apache version. It does this by
@@ -720,6 +720,8 @@ environment variable value that you set. To solve this problem, please become ro
720
720
  prior to setting any environment variables, as described in the previous subsection.</td>
721
721
  </tr></table>
722
722
  </div>
723
+ </div>
724
+ <div class="sect4">
723
725
  <h5 id="specifying_ruby_installation">Specifying the correct Ruby installation</h5>
724
726
  <div class="paragraph"><p>If your system has multiple Ruby installations&#8201;&#8212;&#8201;which is likely the case on
725
727
  MacOS X, or if you&#8217;ve also installed
@@ -748,6 +750,9 @@ following Ruby installations:</p></div>
748
750
  <div class="content">
749
751
  <pre><tt>export PATH=/opt/myruby/bin:$PATH</tt></pre>
750
752
  </div></div>
753
+ </div>
754
+ </div>
755
+ <div class="sect3">
751
756
  <h4 id="_installing_via_the_gem">2.1.3. Installing via the gem</h4>
752
757
  <div class="paragraph"><p>Please install the gem and then run the Phusion Passenger installer, by typing the
753
758
  following commands:</p></div>
@@ -757,6 +762,8 @@ following commands:</p></div>
757
762
  passenger-install-apache2-module</tt></pre>
758
763
  </div></div>
759
764
  <div class="paragraph"><p>Please follow the instructions given by the installer.</p></div>
765
+ </div>
766
+ <div class="sect3">
760
767
  <h4 id="_installing_via_the_source_tarball">2.1.4. Installing via the source tarball</h4>
761
768
  <div class="paragraph"><p>Extract the tarball to whatever location you prefer. <strong>The Phusion Passenger files
762
769
  are to reside in that location permanently.</strong> For example, if you would like
@@ -781,6 +788,8 @@ tar xzvf ~/YourDownloadsFolder/passenger-x.x.x.tar.gz</tt></pre>
781
788
  installation. Furthermore, the <em>passenger-x.x.x</em> folder must be accessible by Apache.</td>
782
789
  </tr></table>
783
790
  </div>
791
+ </div>
792
+ <div class="sect3">
784
793
  <h4 id="_installing_via_a_native_linux_package">2.1.5. Installing via a native Linux package</h4>
785
794
  <div class="paragraph"><p>John Leach from Brightbox has kindly provided an Ubuntu Hardy package for Phusion Passenger. The package is available from the <a href="http://apt.brightbox.net">Brightbox repository</a>.</p></div>
786
795
  <div class="paragraph"><p>Please install the native Linux package, e.g.:</p></div>
@@ -791,6 +800,8 @@ sudo sh -c 'wget -q -O - http://apt.brightbox.net/release.asc | apt-key add -'
791
800
  sudo apt-get update
792
801
  sudo apt-get install libapache2-mod-passenger</tt></pre>
793
802
  </div></div>
803
+ </div>
804
+ <div class="sect3">
794
805
  <h4 id="_what_does_the_installer_do">2.1.6. What does the installer do?</h4>
795
806
  <div class="paragraph"><p>Although we call it an &#8220;installer&#8221;, it doesn&#8217;t actually install anything.
796
807
  The installer checks whether all required dependencies are installed,
@@ -799,17 +810,29 @@ configuration file, but it doesn&#8217;t copy any files around.</p></div>
799
810
  <div class="paragraph"><p><tt>passenger-install-apache2-module</tt> is actually just a user-friendly frontend
800
811
  around the command <tt>rake apache2</tt>, which performs the actual compilation of
801
812
  Phusion Passenger.</p></div>
802
- <h3 id="_operating_system_specific_instructions_and_information">2.2. Operating system-specific instructions and information</h3><div style="clear:left"></div>
813
+ </div>
814
+ </div>
815
+ <div class="sect2">
816
+ <h3 id="_operating_system_specific_instructions_and_information">2.2. Operating system-specific instructions and information</h3>
817
+ <div class="sect3">
803
818
  <h4 id="_macos_x">2.2.1. MacOS X</h4>
804
819
  <div class="paragraph"><p>Ben Ruebenstein has written an excellent
805
820
  <a href="http://benr75.com/articles/2008/04/12/setup-mod_rails-phusion-mac-os-x-leopard">tutorial
806
821
  on installing Phusion Passenger on OS X</a>.</p></div>
822
+ </div>
823
+ <div class="sect3">
807
824
  <h4 id="_ubuntu_linux">2.2.2. Ubuntu Linux</h4>
808
825
  <div class="paragraph"><p>Ben Hughes has written an <a href="http://www.railsgarden.com/2008/04/12/configurating-passenger-mod_rails-on-slicehost-with-ubuntu-710/">article on installing Phusion Passenger on Ubuntu</a>.</p></div>
826
+ </div>
827
+ <div class="sect3">
809
828
  <h4 id="_opensolaris">2.2.3. OpenSolaris</h4>
810
829
  <div class="paragraph"><p>J Aaron Farr has written a <a href="http://cubiclemuses.com/cm/articles/2009/04/09/rails-passenger-open-solaris-ec2/">guide</a>
811
830
  about setting up Ruby on Rails and Phusion Passenger on OpenSolaris and EC2.</p></div>
812
- <h3 id="_upgrading_or_downgrading_phusion_passenger">2.3. Upgrading or downgrading Phusion Passenger</h3><div style="clear:left"></div>
831
+ </div>
832
+ </div>
833
+ <div class="sect2">
834
+ <h3 id="_upgrading_or_downgrading_phusion_passenger">2.3. Upgrading or downgrading Phusion Passenger</h3>
835
+ <div class="sect3">
813
836
  <h4 id="_via_a_gem_or_a_source_tarball">2.3.1. Via a gem or a source tarball</h4>
814
837
  <div class="paragraph"><p>To ugrade or downgrade Phusion Passenger via the gem or the source tarball, install the newer
815
838
  or older version as you normally would; that is, install the gem or unpack the tarball, and
@@ -822,20 +845,28 @@ the lines of:</p></div>
822
845
  PassengerRoot ...
823
846
  PassengerRuby ...</tt></pre>
824
847
  </div></div>
825
- <div class="paragraph"><p>Because you already have Phusion Passenger installed, you already have the same settings
826
- in your Apache configuration file, just with different values. Replace the old settings with
827
- the new ones that the installer outputs.</p></div>
848
+ <div class="paragraph"><p>Because you already had Phusion Passenger installed, you already had similar settings
849
+ in your Apache configuration file, just with different values. <strong>Replace</strong> the old settings with
850
+ the new ones that the installer outputs. It is important that the old settings are removed,
851
+ otherwise Phusion Passenger may malfunction.</p></div>
828
852
  <div class="paragraph"><p>When you&#8217;re done, restart Apache.</p></div>
853
+ </div>
854
+ <div class="sect3">
829
855
  <h4 id="_via_a_native_linux_package">2.3.2. Via a native Linux package</h4>
830
856
  <div class="paragraph"><p>There are no special instructions required to upgrade or downgrade Phusion Passenger
831
857
  via a native Linux package.</p></div>
832
- <h3 id="_unloading_disabling_phusion_passenger_from_apache_without_uninstalling_it">2.4. Unloading (disabling) Phusion Passenger from Apache without uninstalling it</h3><div style="clear:left"></div>
858
+ </div>
859
+ </div>
860
+ <div class="sect2">
861
+ <h3 id="_unloading_disabling_phusion_passenger_from_apache_without_uninstalling_it">2.4. Unloading (disabling) Phusion Passenger from Apache without uninstalling it</h3>
833
862
  <div class="paragraph"><p>You can temporarily unload (disable) Phusion Passenger from Apache, without
834
863
  uninstalling the Phusion Passenger files, so that Apache behaves as if Phusion
835
864
  Passenger was never installed in the first place. This might be useful to you if,
836
865
  for example, you seem to be experiencing a problem caused by Phusion Passenger,
837
866
  but you want to make sure whether that&#8217;s actually the case, without having
838
- to through the hassle of uninstalling Phusion Passenger completely.</p></div>
867
+ to through the hassle of uninstalling Phusion Passenger completely. When disabled,
868
+ Phusion Passenger will not occupy any memory or CPU or otherwise interfere with
869
+ Apache.</p></div>
839
870
  <div class="paragraph"><p>To unload Phusion Passenger from Apache, edit your Apache configuration file(s)
840
871
  and comment out:</p></div>
841
872
  <div class="ulist"><ul>
@@ -889,7 +920,9 @@ NameVirtualHosts *:80
889
920
  &lt;/VirtualHost&gt;</tt></pre>
890
921
  </div></div>
891
922
  <div class="paragraph"><p>After you&#8217;ve done this, save the file and restart Apache.</p></div>
892
- <h3 id="_uninstalling_phusion_passenger">2.5. Uninstalling Phusion Passenger</h3><div style="clear:left"></div>
923
+ </div>
924
+ <div class="sect2">
925
+ <h3 id="_uninstalling_phusion_passenger">2.5. Uninstalling Phusion Passenger</h3>
893
926
  <div class="paragraph"><p>To uninstall Phusion Passenger, please first remove all Phusion Passenger
894
927
  configuration directives from your Apache configuration file(s). After you&#8217;ve
895
928
  done this, you need to remove the Phusion Passenger files.</p></div>
@@ -915,6 +948,9 @@ If you installed Phusion Passenger via a Debian package, then remove type
915
948
  </li>
916
949
  </ul></div>
917
950
  </div>
951
+ </div>
952
+ </div>
953
+ <div class="sect1">
918
954
  <h2 id="_deploying_a_ruby_on_rails_application">3. Deploying a Ruby on Rails application</h2>
919
955
  <div class="sectionbody">
920
956
  <div class="paragraph"><p>Suppose you have a Ruby on Rails application in <em>/webapps/mycook</em>, and you own
@@ -932,7 +968,8 @@ are run, is &#8220;production&#8221;. You can change this by changing the
932
968
  <a href="#rails_env"><em>RailsEnv</em></a> configuration option.</td>
933
969
  </tr></table>
934
970
  </div>
935
- <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>
971
+ <div class="sect2">
972
+ <h3 id="_deploying_to_a_virtual_host_8217_s_root">3.1. Deploying to a virtual host&#8217;s root</h3>
936
973
  <div class="paragraph"><p>Add a virtual host entry to your Apache configuration file. Make sure that the
937
974
  following conditions are met:</p></div>
938
975
  <div class="ulist"><ul>
@@ -985,7 +1022,9 @@ all parent folders. That is, /webapps/mycook and /webapps must also be readable
985
1022
  </li>
986
1023
  </ul></div>
987
1024
  <div class="paragraph"><p>Then restart Apache. The application has now been deployed.</p></div>
988
- <h3 id="deploying_rails_to_sub_uri">3.2. Deploying to a sub URI</h3><div style="clear:left"></div>
1025
+ </div>
1026
+ <div class="sect2">
1027
+ <h3 id="deploying_rails_to_sub_uri">3.2. Deploying to a sub URI</h3>
989
1028
  <div class="paragraph"><p>Suppose that you already have a virtual host:</p></div>
990
1029
  <div class="listingblock">
991
1030
  <div class="content">
@@ -999,8 +1038,8 @@ all parent folders. That is, /webapps/mycook and /webapps must also be readable
999
1038
  </div></div>
1000
1039
  <div class="paragraph"><p>And you want your Ruby on Rails application to be accessible from the URL
1001
1040
  <em>http://www.phusion.nl/rails</em>.</p></div>
1002
- <div class="paragraph"><p>To do this, make a symlink from your Ruby on Rails application&#8217;s <em>public</em>
1003
- folder to a directory in the document root. For example:</p></div>
1041
+ <div class="paragraph"><p>To do this, make a symlink in the virtual host&#8217;s document root, and have it
1042
+ point to your Ruby on Rails application&#8217;s <em>public</em> folder. For example:</p></div>
1004
1043
  <div class="listingblock">
1005
1044
  <div class="content">
1006
1045
  <pre><tt>ln -s /webapps/mycook/public /websites/phusion/rails</tt></pre>
@@ -1068,7 +1107,9 @@ for more information.</td>
1068
1107
  </td>
1069
1108
  </tr></table>
1070
1109
  </div>
1071
- <h3 id="_redeploying_restarting_the_ruby_on_rails_application">3.3. Redeploying (restarting the Ruby on Rails application)</h3><div style="clear:left"></div>
1110
+ </div>
1111
+ <div class="sect2">
1112
+ <h3 id="_redeploying_restarting_the_ruby_on_rails_application">3.3. Redeploying (restarting the Ruby on Rails application)</h3>
1072
1113
  <div class="paragraph"><p>Deploying a new version of a Ruby on Rails application is as simple as
1073
1114
  re-uploading the application files, and restarting the application.</p></div>
1074
1115
  <div class="paragraph"><p>There are two ways to restart the application:</p></div>
@@ -1096,14 +1137,21 @@ command line:</p></div>
1096
1137
  is not automatically deleted. Phusion Passenger checks whether the timestamp
1097
1138
  of this file has changed in order to determine whether the application should
1098
1139
  be restarted.</p></div>
1099
- <h3 id="_migrations">3.4. Migrations</h3><div style="clear:left"></div>
1140
+ </div>
1141
+ <div class="sect2">
1142
+ <h3 id="_migrations">3.4. Migrations</h3>
1100
1143
  <div class="paragraph"><p>Phusion Passenger is not related to Ruby on Rails migrations in any way. To
1101
1144
  run migrations on your deployment server, please login to your deployment
1102
1145
  server (e.g. with <em>ssh</em>) and type <tt>rake db:migrate RAILS_ENV=production</tt> in
1103
1146
  a shell console, just like one would normally run migrations.</p></div>
1104
- <h3 id="_capistrano_integration">3.5. Capistrano integration</h3><div style="clear:left"></div>
1147
+ </div>
1148
+ <div class="sect2">
1149
+ <h3 id="_capistrano_integration">3.5. Capistrano integration</h3>
1105
1150
  <div class="paragraph"><p>See <a href="#capistrano">Capistrano recipe</a>.</p></div>
1106
1151
  </div>
1152
+ </div>
1153
+ </div>
1154
+ <div class="sect1">
1107
1155
  <h2 id="_deploying_a_rack_based_ruby_application">4. Deploying a Rack-based Ruby application</h2>
1108
1156
  <div class="sectionbody">
1109
1157
  <div class="paragraph"><p>Phusion Passenger supports arbitrary Ruby web applications that follow the
@@ -1155,7 +1203,8 @@ are run, is &#8220;production&#8221;. You can change this by changing the
1155
1203
  <a href="#rack_env"><em>RackEnv</em></a> configuration option.</td>
1156
1204
  </tr></table>
1157
1205
  </div>
1158
- <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>
1206
+ <div class="sect2">
1207
+ <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>
1159
1208
  <div class="paragraph"><p>First we create a Phusion Passenger-compliant Rack directory structure:</p></div>
1160
1209
  <div class="listingblock">
1161
1210
  <div class="content">
@@ -1190,7 +1239,9 @@ the Apache configuration file:</p></div>
1190
1239
  </div></div>
1191
1240
  <div class="paragraph"><p>And we&#8217;re done! After an Apache restart, the above Rack application will be available
1192
1241
  under the URL <em>http://www.rackexample.com/</em>.</p></div>
1193
- <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>
1242
+ </div>
1243
+ <div class="sect2">
1244
+ <h3 id="_deploying_to_a_virtual_host_8217_s_root_2">4.2. Deploying to a virtual host&#8217;s root</h3>
1194
1245
  <div class="paragraph"><p>Add a virtual host entry to your Apache configuration file. Make sure that the
1195
1246
  following conditions are met:</p></div>
1196
1247
  <div class="ulist"><ul>
@@ -1243,7 +1294,9 @@ all parent folders. That is, /webapps/rackapp and /webapps must also be readable
1243
1294
  </li>
1244
1295
  </ul></div>
1245
1296
  <div class="paragraph"><p>Then restart Apache. The application has now been deployed.</p></div>
1246
- <h3 id="deploying_rack_to_sub_uri">4.3. Deploying to a sub URI</h3><div style="clear:left"></div>
1297
+ </div>
1298
+ <div class="sect2">
1299
+ <h3 id="deploying_rack_to_sub_uri">4.3. Deploying to a sub URI</h3>
1247
1300
  <div class="paragraph"><p>Suppose that you already have a virtual host:</p></div>
1248
1301
  <div class="listingblock">
1249
1302
  <div class="content">
@@ -1257,8 +1310,8 @@ all parent folders. That is, /webapps/rackapp and /webapps must also be readable
1257
1310
  </div></div>
1258
1311
  <div class="paragraph"><p>And you want your Rack application to be accessible from the URL
1259
1312
  <em>http://www.phusion.nl/rack</em>.</p></div>
1260
- <div class="paragraph"><p>To do this, make a symlink from your Rack application&#8217;s <em>public</em>
1261
- folder to a directory in the document root. For example:</p></div>
1313
+ <div class="paragraph"><p>To do this, make a symlink in the virtual host&#8217;s document root, and have it
1314
+ point to your Rack application&#8217;s <em>public</em> folder. For example:</p></div>
1262
1315
  <div class="listingblock">
1263
1316
  <div class="content">
1264
1317
  <pre><tt>ln -s /webapps/rackapp/public /websites/phusion/rack</tt></pre>
@@ -1314,7 +1367,9 @@ MultiViews is disabled for this folder.
1314
1367
  </td>
1315
1368
  </tr></table>
1316
1369
  </div>
1317
- <h3 id="_redeploying_restarting_the_rack_application">4.4. Redeploying (restarting the Rack application)</h3><div style="clear:left"></div>
1370
+ </div>
1371
+ <div class="sect2">
1372
+ <h3 id="_redeploying_restarting_the_rack_application">4.4. Redeploying (restarting the Rack application)</h3>
1318
1373
  <div class="paragraph"><p>Deploying a new version of a Rack application is as simple as
1319
1374
  re-uploading the application files, and restarting the application.</p></div>
1320
1375
  <div class="paragraph"><p>There are two ways to restart the application:</p></div>
@@ -1338,8 +1393,11 @@ command line:</p></div>
1338
1393
  <div class="content">
1339
1394
  <pre><tt>touch /webapps/rackapp/tmp/restart.txt</tt></pre>
1340
1395
  </div></div>
1341
- <h3 id="_rackup_specifications_for_various_web_frameworks">4.5. Rackup specifications for various web frameworks</h3><div style="clear:left"></div>
1396
+ </div>
1397
+ <div class="sect2">
1398
+ <h3 id="_rackup_specifications_for_various_web_frameworks">4.5. Rackup specifications for various web frameworks</h3>
1342
1399
  <div class="paragraph"><p>This subsection shows example <em>config.ru</em> files for various web frameworks.</p></div>
1400
+ <div class="sect3">
1343
1401
  <h4 id="_camping">4.5.1. Camping</h4>
1344
1402
  <div class="listingblock">
1345
1403
  <div class="content">
@@ -1356,6 +1414,8 @@ Camping.goes :Blog
1356
1414
  run Rack::Adapter::Camping.new(Blog)</tt></pre>
1357
1415
  </div></div>
1358
1416
  <div class="paragraph"><p>For Camping versions 2.0 and up, using <tt>run Blog</tt> as the final line will do.</p></div>
1417
+ </div>
1418
+ <div class="sect3">
1359
1419
  <h4 id="_halcyon">4.5.2. Halcyon</h4>
1360
1420
  <div class="listingblock">
1361
1421
  <div class="content">
@@ -1365,6 +1425,8 @@ $LOAD_PATH.unshift(Halcyon.root / 'lib')
1365
1425
  Halcyon::Runner.load_config Halcyon.root/'config'/'config.yml'
1366
1426
  run Halcyon::Runner.new</tt></pre>
1367
1427
  </div></div>
1428
+ </div>
1429
+ <div class="sect3">
1368
1430
  <h4 id="_mack">4.5.3. Mack</h4>
1369
1431
  <div class="listingblock">
1370
1432
  <div class="content">
@@ -1374,6 +1436,8 @@ require 'rubygems'
1374
1436
  require 'mack'
1375
1437
  run Mack::Utils::Server.build_app</tt></pre>
1376
1438
  </div></div>
1439
+ </div>
1440
+ <div class="sect3">
1377
1441
  <h4 id="_merb">4.5.4. Merb</h4>
1378
1442
  <div class="listingblock">
1379
1443
  <div class="content">
@@ -1390,6 +1454,8 @@ Merb::BootLoader.run
1390
1454
 
1391
1455
  run Merb::Rack::Application.new</tt></pre>
1392
1456
  </div></div>
1457
+ </div>
1458
+ <div class="sect3">
1393
1459
  <h4 id="_ramaze">4.5.5. Ramaze</h4>
1394
1460
  <div class="listingblock">
1395
1461
  <div class="content">
@@ -1400,6 +1466,8 @@ require "start"
1400
1466
  Ramaze.start!
1401
1467
  run Ramaze::Adapter::Base</tt></pre>
1402
1468
  </div></div>
1469
+ </div>
1470
+ <div class="sect3">
1403
1471
  <h4 id="_sinatra">4.5.6. Sinatra</h4>
1404
1472
  <div class="listingblock">
1405
1473
  <div class="content">
@@ -1410,13 +1478,18 @@ require 'app.rb'
1410
1478
  run Sinatra::Application</tt></pre>
1411
1479
  </div></div>
1412
1480
  </div>
1481
+ </div>
1482
+ </div>
1483
+ </div>
1484
+ <div class="sect1">
1413
1485
  <h2 id="_configuring_phusion_passenger">5. Configuring Phusion Passenger</h2>
1414
1486
  <div class="sectionbody">
1415
1487
  <div class="paragraph"><p>After installation, Phusion Passenger does not need any further configurations.
1416
1488
  Nevertheless, the system administrator may be interested in changing
1417
1489
  Phusion Passenger&#8217;s behavior. Phusion Passenger&#8217;s Apache module supports the
1418
1490
  following configuration options:</p></div>
1419
- <h3 id="_passengerroot_lt_directory_gt">5.1. PassengerRoot &lt;directory&gt;</h3><div style="clear:left"></div>
1491
+ <div class="sect2">
1492
+ <h3 id="_passengerroot_lt_directory_gt">5.1. PassengerRoot &lt;directory&gt;</h3>
1420
1493
  <div class="paragraph"><p>The location to the Phusion Passenger root directory. This configuration option
1421
1494
  is essential to Phusion Passenger, and allows Phusion Passenger to locate its own
1422
1495
  data files. The correct value is given by the installer.</p></div>
@@ -1424,42 +1497,15 @@ data files. The correct value is given by the installer.</p></div>
1424
1497
  this option as well. Please read
1425
1498
  <a href="#moving_phusion_passenger">Moving Phusion Passenger to a different directory</a> for more information.</p></div>
1426
1499
  <div class="paragraph"><p>This required option may only occur once, in the global server configuration.</p></div>
1427
- <h3 id="_passengerloglevel_lt_integer_gt">5.2. PassengerLogLevel &lt;integer&gt;</h3><div style="clear:left"></div>
1428
- <div class="paragraph"><p>This option allows one to specify how much information Phusion Passenger should
1429
- write to the Apache error log file. A higher log level value means that more
1430
- information will be logged.</p></div>
1431
- <div class="paragraph"><p>Possible values are:</p></div>
1432
- <div class="ulist"><ul>
1433
- <li>
1434
- <p>
1435
- <em>0</em>: Show only errors and warnings.
1436
- </p>
1437
- </li>
1438
- <li>
1439
- <p>
1440
- <em>1</em>: Show the most important debugging information. This might be useful for
1441
- system administrators who are trying to figure out the cause of a
1442
- problem.
1443
- </p>
1444
- </li>
1445
- <li>
1446
- <p>
1447
- <em>2</em>: Show more debugging information. This is typically only useful for developers.
1448
- </p>
1449
- </li>
1450
- <li>
1451
- <p>
1452
- <em>3</em>: Show even more debugging information.
1453
- </p>
1454
- </li>
1455
- </ul></div>
1456
- <div class="paragraph"><p>This option may only occur once, in the global server configuration.
1457
- The default is <em>0</em>.</p></div>
1458
- <h3 id="PassengerRuby">5.3. PassengerRuby &lt;filename&gt;</h3><div style="clear:left"></div>
1500
+ </div>
1501
+ <div class="sect2">
1502
+ <h3 id="PassengerRuby">5.2. PassengerRuby &lt;filename&gt;</h3>
1459
1503
  <div class="paragraph"><p>This option allows one to specify the Ruby interpreter to use.</p></div>
1460
1504
  <div class="paragraph"><p>This option may only occur once, in the global server configuration.
1461
1505
  The default is <em>ruby</em>.</p></div>
1462
- <h3 id="PassengerAppRoot">5.4. PassengerAppRoot &lt;path/to/root&gt;</h3><div style="clear:left"></div>
1506
+ </div>
1507
+ <div class="sect2">
1508
+ <h3 id="PassengerAppRoot">5.3. PassengerAppRoot &lt;path/to/root&gt;</h3>
1463
1509
  <div class="paragraph"><p>By default, Phusion Passenger assumes that the application&#8217;s root directory
1464
1510
  is the parent directory of the <em>public</em> directory. This option allows one to
1465
1511
  specify the application&#8217;s root independently from the DocumentRoot, which
@@ -1498,7 +1544,105 @@ In <em>.htaccess</em>, if <tt>AllowOverride Options</tt> is on.
1498
1544
  # root is "/var/rails/zena/sites/example.com"
1499
1545
  &lt;/VirtualHost&gt;</tt></pre>
1500
1546
  </div></div>
1501
- <h3 id="PassengerUseGlobalQueue">5.5. PassengerUseGlobalQueue &lt;on|off&gt;</h3><div style="clear:left"></div>
1547
+ </div>
1548
+ <div class="sect2">
1549
+ <h3 id="PassengerSpawnMethod">5.4. PassengerSpawnMethod &lt;string&gt;</h3>
1550
+ <div class="admonitionblock">
1551
+ <table><tr>
1552
+ <td class="icon">
1553
+ <img src="./images/icons/tip.png" alt="Tip" />
1554
+ </td>
1555
+ <td class="content">
1556
+ <div class="title">"What spawn method should I use?"</div>
1557
+ <div class="paragraph"><p>This subsection attempts to describe spawn methods, but it&#8217;s okay if you don&#8217;t (want to)
1558
+ understand it, as it&#8217;s mostly a technical detail. You can basically follow this rule of thumb:</p></div>
1559
+ <div class="sidebarblock">
1560
+ <div class="content">
1561
+ <div class="paragraph"><p>If your application works on Mongrel, but not on Phusion Passenger, then set
1562
+ <tt>PassengerSpawnMethod</tt> to <em>conservative</em>. Otherwise, leave it at <em>smart-lv2</em> (the default).</p></div>
1563
+ </div></div>
1564
+ <div class="paragraph"><p>However, we do recommend you to try to understand it. The <em>smart</em> and <em>smart-lv2</em> spawn
1565
+ methods bring many benefits.</p></div>
1566
+ </td>
1567
+ </tr></table>
1568
+ </div>
1569
+ <div class="paragraph"><p>Internally, Phusion Passenger spawns multiple Ruby application processes in order to handle
1570
+ requests. But there are multiple ways with which processes can be spawned, each having
1571
+ its own set of pros and cons. Supported spawn methods are:</p></div>
1572
+ <div class="dlist"><dl>
1573
+ <dt class="hdlist1">
1574
+ <em>smart</em>
1575
+ </dt>
1576
+ <dd>
1577
+ <p>
1578
+ When this spawn method is used, Phusion Passenger will attempt to cache any
1579
+ framework code (e.g. Ruby on Rails itself) and application code for a limited
1580
+ period of time. Please read <a href="#spawning_methods_explained">Spawning methods explained</a>
1581
+ for a more detailed explanation of what smart spawning exactly does.
1582
+ </p>
1583
+ <div class="paragraph"><p><strong>Pros:</strong>
1584
+ This can significantly decrease spawn time (by as much as 90%). And, when Ruby Enterprise
1585
+ Edition is used, <a href="#reducing_memory_usage">memory usage can be reduced by 33% on average</a>.</p></div>
1586
+ <div class="paragraph"><p><strong>Cons:</strong>
1587
+ Some applications and libraries are not compatible with smart spawning.
1588
+ If that&#8217;s the case for your application, then you should use <em>conservative</em> as
1589
+ spawning method. Please read <a href="#spawning_methods_explained">Spawning methods explained</a>
1590
+ for possible compatibility issues.</p></div>
1591
+ </dd>
1592
+ <dt class="hdlist1">
1593
+ <em>smart-lv2</em>
1594
+ </dt>
1595
+ <dd>
1596
+ <p>
1597
+ This spawning method is similar to <em>smart</em> but it skips the framework spawner
1598
+ and uses the application spawner directly. This means the framework code is not
1599
+ cached between multiple applications, although it is still cached within
1600
+ instances of the same application. Please read
1601
+ <a href="#spawning_methods_explained">Spawning methods explained</a> for a more detailed
1602
+ explanation of what smart-lv2 spawning exactly does.
1603
+ </p>
1604
+ <div class="paragraph"><p><strong>Pros:</strong> It is compatible with a larger number of applications when compared to
1605
+ the <em>smart</em> method, and still performs some caching.</p></div>
1606
+ <div class="paragraph"><p><strong>Cons:</strong> It is slower than smart spawning if you have many applications which
1607
+ use the same framework version. It is therefore advised that shared hosts use the
1608
+ <em>smart</em> method instead.</p></div>
1609
+ </dd>
1610
+ <dt class="hdlist1">
1611
+ <em>conservative</em>
1612
+ </dt>
1613
+ <dd>
1614
+ <p>
1615
+ This spawning method is similar to the one used in Mongrel Cluster. It does not
1616
+ perform any code caching at all. Please read
1617
+ <a href="#spawning_methods_explained">Spawning methods explained</a> for a more detailed
1618
+ explanation of what conservative spawning exactly does.
1619
+ </p>
1620
+ <div class="paragraph"><p><strong>Pros:</strong>
1621
+ Conservative spawning is guaranteed to be compatible with all applications
1622
+ and libraries.</p></div>
1623
+ <div class="paragraph"><p><strong>Cons:</strong>
1624
+ Much slower than smart spawning. Every spawn action will be equally slow, though no slower than
1625
+ the startup time of a single server in Mongrel Cluster. Conservative spawning will also
1626
+ render <a href="#reducing_memory_usage">Ruby Enterprise Edition&#8217;s memory reduction technology</a> useless.</p></div>
1627
+ </dd>
1628
+ </dl></div>
1629
+ <div class="paragraph"><p>This option may occur in the following places:</p></div>
1630
+ <div class="ulist"><ul>
1631
+ <li>
1632
+ <p>
1633
+ In the global server configuration.
1634
+ </p>
1635
+ </li>
1636
+ <li>
1637
+ <p>
1638
+ In a virtual host configuration block.
1639
+ </p>
1640
+ </li>
1641
+ </ul></div>
1642
+ <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>smart-lv2</em>.</p></div>
1643
+ </div>
1644
+ <div class="sect2">
1645
+ <h3 id="PassengerUseGlobalQueue">5.5. PassengerUseGlobalQueue &lt;on|off&gt;</h3>
1502
1646
  <div class="paragraph"><p>Turns the use of global queuing on or off.</p></div>
1503
1647
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
1504
1648
  <div class="ulist"><ul>
@@ -1513,7 +1657,7 @@ In a virtual host configuration block.
1513
1657
  </p>
1514
1658
  </li>
1515
1659
  </ul></div>
1516
- <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>off</em>.</p></div>
1660
+ <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>on</em>.</p></div>
1517
1661
  <div class="paragraph"><p><em>This feature is sponsored by <a href="http://www.37signals.com/">37signals</a>.</em></p></div>
1518
1662
  <div class="paragraph"><div class="title">What does this option do?</div><p>Recall that Phusion Passenger spawns multiple backend processes (e.g. multiple
1519
1663
  Ruby on Rails processes), each which processes HTTP requests serially. One of
@@ -1584,20 +1728,9 @@ D instead, because they only have short-living requests in their queues.</p></di
1584
1728
  queuing, all backend processes will share the same queue. The first backend
1585
1729
  process that becomes available will take from the queue, and so this
1586
1730
  &#8220;queuing-behind-long-running-request&#8221; problem will never occur.</p></div>
1587
- <div class="paragraph"><p>Turning global queuing off will yield a minor performance improvement (about 5%,
1588
- depending on how fast/slow your web application is), which is why it&#8217;s off by
1589
- default.</p></div>
1590
- <h3 id="PassengerUserSwitching">5.6. PassengerUserSwitching &lt;on|off&gt;</h3><div style="clear:left"></div>
1591
- <div class="paragraph"><p>Whether to enable <a href="#user_switching">user switching support</a>.</p></div>
1592
- <div class="paragraph"><p>This option may only occur once, in the global server configuration.
1593
- The default value is <em>on</em>.</p></div>
1594
- <h3 id="PassengerDefaultUser">5.7. PassengerDefaultUser &lt;username&gt;</h3><div style="clear:left"></div>
1595
- <div class="paragraph"><p>Phusion Passenger enables <a href="#user_switching">user switching support</a> by default.
1596
- This configuration option allows one to specify which user Rails/Rack
1597
- applications must run as, if user switching fails or is disabled.</p></div>
1598
- <div class="paragraph"><p>This option may only occur once, in the global server configuration.
1599
- The default value is <em>nobody</em>.</p></div>
1600
- <h3 id="_passengerenabled_lt_on_off_gt">5.8. PassengerEnabled &lt;on|off&gt;</h3><div style="clear:left"></div>
1731
+ </div>
1732
+ <div class="sect2">
1733
+ <h3 id="_passengerenabled_lt_on_off_gt">5.6. PassengerEnabled &lt;on|off&gt;</h3>
1601
1734
  <div class="paragraph"><p>You can set this option to <em>off</em> to completely disable Phusion Passenger for
1602
1735
  a certain location. This is useful if, for example, you want to integrate a PHP
1603
1736
  application into the same virtual host as a Rails application.</p></div>
@@ -1641,7 +1774,9 @@ In <em>.htaccess</em>.
1641
1774
  </li>
1642
1775
  </ul></div>
1643
1776
  <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>on</em>.</p></div>
1644
- <h3 id="PassengerTempDir">5.9. PassengerTempDir &lt;directory&gt;</h3><div style="clear:left"></div>
1777
+ </div>
1778
+ <div class="sect2">
1779
+ <h3 id="PassengerTempDir">5.7. PassengerTempDir &lt;directory&gt;</h3>
1645
1780
  <div class="paragraph"><p>Specifies the directory that Phusion Passenger should use for storing temporary
1646
1781
  files. This includes things such as Unix socket files, buffered file uploads
1647
1782
  (see also <a href="#PassengerUploadBufferDir">PassengerUploadBufferDir</a>), etc.</p></div>
@@ -1664,7 +1799,9 @@ environment variable, like this:</p></div>
1664
1799
  sudo -E passenger-status
1665
1800
  # The -E option tells 'sudo' to preserve environment variables.</tt></pre>
1666
1801
  </div></div>
1667
- <h3 id="PassengerUploadBufferDir">5.10. PassengerUploadBufferDir &lt;directory&gt;</h3><div style="clear:left"></div>
1802
+ </div>
1803
+ <div class="sect2">
1804
+ <h3 id="PassengerUploadBufferDir">5.8. PassengerUploadBufferDir &lt;directory&gt;</h3>
1668
1805
  <div class="paragraph"><p>Phusion Passenger buffers large file uploads to disk in order prevent slow file
1669
1806
  uploads from blocking web applications. By default, a subdirectory in the
1670
1807
  system&#8217;s temporary files directory (or a subdirectory in the directory specified
@@ -1705,7 +1842,9 @@ In <em>.htaccess</em>, if <tt>AllowOverrides Options</tt> is enabled.
1705
1842
  </li>
1706
1843
  </ul></div>
1707
1844
  <div class="paragraph"><p>In each place, it may be specified at most once.</p></div>
1708
- <h3 id="_passengerrestartdir_lt_directory_gt">5.11. PassengerRestartDir &lt;directory&gt;</h3><div style="clear:left"></div>
1845
+ </div>
1846
+ <div class="sect2">
1847
+ <h3 id="_passengerrestartdir_lt_directory_gt">5.9. PassengerRestartDir &lt;directory&gt;</h3>
1709
1848
  <div class="paragraph"><p>As described in the deployment chapters of this document, Phusion Passenger
1710
1849
  checks the file <em>tmp/restart.txt</em> in the applications'
1711
1850
  <a href="#application_root">root directory</a> for restarting applications. Sometimes it
@@ -1773,8 +1912,127 @@ security flaw which allows an attacker to touch restart.txt, then that will
1773
1912
  allow the attacker to cause a Denial-of-Service.</p></div>
1774
1913
  <div class="paragraph"><p>You can prevent this from happening by pointing PassengerRestartDir to a
1775
1914
  directory that&#8217;s readable by Apache, but only writable by administrators.</p></div>
1776
- <h3 id="_resource_control_and_optimization_options">5.12. Resource control and optimization options</h3><div style="clear:left"></div>
1777
- <h4 id="_passengermaxpoolsize_lt_integer_gt">5.12.1. PassengerMaxPoolSize &lt;integer&gt;</h4>
1915
+ </div>
1916
+ <div class="sect2">
1917
+ <h3 id="_security_options">5.10. Security options</h3>
1918
+ <div class="sect3">
1919
+ <h4 id="PassengerUserSwitching">5.10.1. PassengerUserSwitching &lt;on|off&gt;</h4>
1920
+ <div class="paragraph"><p>Whether to enable <a href="#user_switching">user switching support</a>.</p></div>
1921
+ <div class="paragraph"><p>This option may only occur once, in the global server configuration.
1922
+ The default value is <em>on</em>.</p></div>
1923
+ </div>
1924
+ <div class="sect3">
1925
+ <h4 id="_passengeruser_lt_username_gt">5.10.2. PassengerUser &lt;username&gt;</h4>
1926
+ <div class="paragraph"><p>If <a href="#user_switching">user switching support</a> is enabled, then Phusion Passenger will
1927
+ by default run the web application as the owner if the file <em>config/environment.rb</em>
1928
+ (for Rails apps) or <em>config.ru</em> (for Rack apps). This option allows you to override
1929
+ that behavior and explicitly set a user to run the web application as, regardless
1930
+ of the ownership of <em>environment.rb</em>/<em>config.ru</em>.</p></div>
1931
+ <div class="paragraph"><p>This option may occur in the following places:</p></div>
1932
+ <div class="ulist"><ul>
1933
+ <li>
1934
+ <p>
1935
+ In the global server configuration.
1936
+ </p>
1937
+ </li>
1938
+ <li>
1939
+ <p>
1940
+ In a virtual host configuration block.
1941
+ </p>
1942
+ </li>
1943
+ <li>
1944
+ <p>
1945
+ In a <tt>&lt;Directory&gt;</tt> or <tt>&lt;Location&gt;</tt> block.
1946
+ </p>
1947
+ </li>
1948
+ </ul></div>
1949
+ <div class="paragraph"><p>In each place, it may be specified at most once.</p></div>
1950
+ </div>
1951
+ <div class="sect3">
1952
+ <h4 id="_passengergroup_lt_group_name_gt">5.10.3. PassengerGroup &lt;group name&gt;</h4>
1953
+ <div class="paragraph"><p>If <a href="#user_switching">user switching support</a> is enabled, then Phusion Passenger will
1954
+ by default run the web application as the primary group of the owner of the file
1955
+ <em>config/environment.rb</em> (for Rails apps) or <em>config.ru</em> (for Rack apps). This option
1956
+ allows you to override that behavior and explicitly set a group to run the web application
1957
+ as, regardless of the ownership of <em>environment.rb</em>/<em>config.ru</em>.</p></div>
1958
+ <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
1959
+ the web application&#8217;s group will be set to <em>environment.rb</em>/<em>config.ru</em>'s group.</p></div>
1960
+ <div class="paragraph"><p>This option may occur in the following places:</p></div>
1961
+ <div class="ulist"><ul>
1962
+ <li>
1963
+ <p>
1964
+ In the global server configuration.
1965
+ </p>
1966
+ </li>
1967
+ <li>
1968
+ <p>
1969
+ In a virtual host configuration block.
1970
+ </p>
1971
+ </li>
1972
+ <li>
1973
+ <p>
1974
+ In a <tt>&lt;Directory&gt;</tt> or <tt>&lt;Location&gt;</tt> block.
1975
+ </p>
1976
+ </li>
1977
+ </ul></div>
1978
+ <div class="paragraph"><p>In each place, it may be specified at most once.</p></div>
1979
+ </div>
1980
+ <div class="sect3">
1981
+ <h4 id="PassengerDefaultUser">5.10.4. PassengerDefaultUser &lt;username&gt;</h4>
1982
+ <div class="paragraph"><p>Phusion Passenger enables <a href="#user_switching">user switching support</a> by default.
1983
+ This configuration option allows one to specify the user that applications must
1984
+ run as, if user switching fails or is disabled.</p></div>
1985
+ <div class="paragraph"><p>This option may only occur once, in the global server configuration.
1986
+ The default value is <em>nobody</em>.</p></div>
1987
+ </div>
1988
+ <div class="sect3">
1989
+ <h4 id="PassengerDefaultGroup">5.10.5. PassengerDefaultGroup &lt;group name&gt;</h4>
1990
+ <div class="paragraph"><p>Phusion Passenger enables <a href="#user_switching">user switching support</a> by default.
1991
+ This configuration option allows one to specify the group that applications must
1992
+ run as, if user switching fails or is disabled.</p></div>
1993
+ <div class="paragraph"><p>This option may only occur once, in the global server configuration.
1994
+ The default value is the primary group of the user specifified by
1995
+ <a href="#PassengerDefaultUser">PassengerDefaultUser</a>.</p></div>
1996
+ </div>
1997
+ <div class="sect3">
1998
+ <h4 id="_passengerfriendlyerrorpages_lt_on_off_gt">5.10.6. PassengerFriendlyErrorPages &lt;on|off&gt;</h4>
1999
+ <div class="paragraph"><p>Phusion Passenger can display friendly error pages whenever an application fails
2000
+ to start. This friendly error page presents the startup error message, some
2001
+ suggestions for solving the problem, and a backtrace. This feature is very useful
2002
+ during application development and useful for less experienced system administrators,
2003
+ but the page might reveal potentially sensitive information, depending on the
2004
+ application. Experienced system administrators who are using Phusion Passenger
2005
+ on serious production servers should consider turning this feature off.</p></div>
2006
+ <div class="paragraph"><p>This option may occur in the following places:</p></div>
2007
+ <div class="ulist"><ul>
2008
+ <li>
2009
+ <p>
2010
+ In the global server configuration.
2011
+ </p>
2012
+ </li>
2013
+ <li>
2014
+ <p>
2015
+ In a virtual host configuration block.
2016
+ </p>
2017
+ </li>
2018
+ <li>
2019
+ <p>
2020
+ In a <tt>&lt;Directory&gt;</tt> or <tt>&lt;Location&gt;</tt> block.
2021
+ </p>
2022
+ </li>
2023
+ <li>
2024
+ <p>
2025
+ In <em>.htaccess</em>, if <tt>AllowOverride Options</tt> is on.
2026
+ </p>
2027
+ </li>
2028
+ </ul></div>
2029
+ <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>on</em>.</p></div>
2030
+ </div>
2031
+ </div>
2032
+ <div class="sect2">
2033
+ <h3 id="_resource_control_and_optimization_options">5.11. Resource control and optimization options</h3>
2034
+ <div class="sect3">
2035
+ <h4 id="_passengermaxpoolsize_lt_integer_gt">5.11.1. PassengerMaxPoolSize &lt;integer&gt;</h4>
1778
2036
  <div class="paragraph"><p>The maximum number of Ruby on Rails or Rack application instances that may
1779
2037
  be simultaneously active. A larger number results in higher memory usage,
1780
2038
  but improved ability to handle concurrent HTTP clients.</p></div>
@@ -1799,7 +2057,79 @@ The default value is <em>6</em>.</p></div>
1799
2057
  by about 33%. And it&#8217;s not hard to install.</td>
1800
2058
  </tr></table>
1801
2059
  </div>
1802
- <h4 id="_passengermaxinstancesperapp_lt_integer_gt">5.12.2. PassengerMaxInstancesPerApp &lt;integer&gt;</h4>
2060
+ </div>
2061
+ <div class="sect3">
2062
+ <h4 id="PassengerMinInstances">5.11.2. PassengerMinInstances &lt;integer&gt;</h4>
2063
+ <div class="paragraph"><p>This specifies the minimum number of application instances that must be kept around
2064
+ whenever Phusion Passenger cleans up idle instances. You should set this option to a
2065
+ non-zero value if you want to avoid potentially long startup times after a website
2066
+ has been idle for an extended period.</p></div>
2067
+ <div class="paragraph"><p>Please note that this option does <strong>not</strong> pre-start application instances during Apache
2068
+ startup. It just makes sure that when the application is first accessed:</p></div>
2069
+ <div class="olist arabic"><ol class="arabic">
2070
+ <li>
2071
+ <p>
2072
+ at least the given number of instances will be spawned.
2073
+ </p>
2074
+ </li>
2075
+ <li>
2076
+ <p>
2077
+ the given number of processes will be kept around even when instances are being
2078
+ idle cleaned (see <a href="#PassengerPoolIdleTime">PassengerPoolIdleTime</a>).
2079
+ </p>
2080
+ </li>
2081
+ </ol></div>
2082
+ <div class="paragraph"><p>If you want to pre-start application instances during Apache startup, then you should use the <a href="#PassengerPreStart">PassengerPreStart</a> directive, possibly in combination with
2083
+ <em>PassengerMinInstances</em>. This behavior might seem counter-intuitive at first sight,
2084
+ but <a href="#PassengerPreStart">PassengerPreStart</a> explains the rationale behind it.</p></div>
2085
+ <div class="paragraph"><p>For example, suppose that you have the following configuration:</p></div>
2086
+ <div class="listingblock">
2087
+ <div class="content">
2088
+ <pre><tt>PassengerMaxPoolSize 15
2089
+ PassengerPoolIdleTime 10
2090
+
2091
+ &lt;VirtualHost *:80&gt;
2092
+ ServerName foobar.com
2093
+ DocumentRoot /webapps/foobar/public
2094
+ PassengerMinInstances 3
2095
+ &lt;/VirtualHost&gt;</tt></pre>
2096
+ </div></div>
2097
+ <div class="paragraph"><p>When you start Apache, there are 0 application instances for <em>foobar.com</em>. Things will
2098
+ stay that way until someone visits <em>foobar.com</em>. Suppose that there is only 1 visitor.
2099
+ 1 application instance will be started immediately to serve the visitor, while 2 will
2100
+ be spawned in the background. After 10 seconds, when the idle timeout has
2101
+ been reached, these 3 application instances will not be cleaned up.</p></div>
2102
+ <div class="paragraph"><p>Now suppose that there&#8217;s a sudden spike of traffic, and 100 users visit <em>foobar.com</em>
2103
+ simultanously. Phusion Passenger will start 12 more application instances. After the idle
2104
+ timeout of 10 seconds have passed, Phusion Passenger will clean up 12 application
2105
+ instances, keeping 3 instances around.</p></div>
2106
+ <div class="paragraph"><p>The PassengerMinInstances option may occur in the following places:</p></div>
2107
+ <div class="ulist"><ul>
2108
+ <li>
2109
+ <p>
2110
+ In the global server configuration.
2111
+ </p>
2112
+ </li>
2113
+ <li>
2114
+ <p>
2115
+ In a virtual host configuration block.
2116
+ </p>
2117
+ </li>
2118
+ <li>
2119
+ <p>
2120
+ In a <tt>&lt;Directory&gt;</tt> or <tt>&lt;Location&gt;</tt> block.
2121
+ </p>
2122
+ </li>
2123
+ <li>
2124
+ <p>
2125
+ In <em>.htaccess</em>, if <tt>AllowOverride Limits</tt> is on.
2126
+ </p>
2127
+ </li>
2128
+ </ul></div>
2129
+ <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>1</em>.</p></div>
2130
+ </div>
2131
+ <div class="sect3">
2132
+ <h4 id="_passengermaxinstancesperapp_lt_integer_gt">5.11.3. PassengerMaxInstancesPerApp &lt;integer&gt;</h4>
1803
2133
  <div class="paragraph"><p>The maximum number of application instances that may be simultaneously active
1804
2134
  for a single application. This helps to make sure that a single application
1805
2135
  will not occupy all available slots in the application pool.</p></div>
@@ -1809,7 +2139,9 @@ may use, i.e. only the global limit of <a href="#PassengerMaxPoolSize">Passenger
1809
2139
  will be enforced.</p></div>
1810
2140
  <div class="paragraph"><p>This option may only occur once, in the global server configuration.
1811
2141
  The default value is <em>0</em>.</p></div>
1812
- <h4 id="PassengerPoolIdleTime">5.12.3. PassengerPoolIdleTime &lt;integer&gt;</h4>
2142
+ </div>
2143
+ <div class="sect3">
2144
+ <h4 id="PassengerPoolIdleTime">5.11.4. PassengerPoolIdleTime &lt;integer&gt;</h4>
1813
2145
  <div class="paragraph"><p>The maximum number of seconds that an application instance may be idle. That is,
1814
2146
  if an application instance hasn&#8217;t received any traffic after the given number of
1815
2147
  seconds, then it will be shutdown in order to conserve memory.</p></div>
@@ -1829,7 +2161,9 @@ recommended if you&#8217;re on a non-shared host that&#8217;s only running a few
1829
2161
  applications, each which must be available at all times.</p></div>
1830
2162
  <div class="paragraph"><p>This option may only occur once, in the global server configuration.
1831
2163
  The default value is <em>300</em>.</p></div>
1832
- <h4 id="PassengerMaxRequests">5.12.4. PassengerMaxRequests &lt;integer&gt;</h4>
2164
+ </div>
2165
+ <div class="sect3">
2166
+ <h4 id="PassengerMaxRequests">5.11.5. PassengerMaxRequests &lt;integer&gt;</h4>
1833
2167
  <div class="paragraph"><p>The maximum number of requests an application instance will process. After
1834
2168
  serving that many requests, the application instance will be shut down and
1835
2169
  Phusion Passenger will restart it. A value of 0 means that there is no maximum:
@@ -1875,7 +2209,9 @@ measure to avoid memory leaks.</p></div>
1875
2209
  </td>
1876
2210
  </tr></table>
1877
2211
  </div>
1878
- <h4 id="_passengerstatthrottlerate_lt_integer_gt">5.12.5. PassengerStatThrottleRate &lt;integer&gt;</h4>
2212
+ </div>
2213
+ <div class="sect3">
2214
+ <h4 id="_passengerstatthrottlerate_lt_integer_gt">5.11.6. PassengerStatThrottleRate &lt;integer&gt;</h4>
1879
2215
  <div class="paragraph"><p>By default, Phusion Passenger performs several filesystem checks (or, in
1880
2216
  programmers jargon, <em>stat() calls</em>) each time a request is processed:</p></div>
1881
2217
  <div class="ulist"><ul>
@@ -1905,27 +2241,257 @@ every request.</p></div>
1905
2241
  <div class="ulist"><ul>
1906
2242
  <li>
1907
2243
  <p>
1908
- In the global server configuration.
1909
- </p>
1910
- </li>
1911
- <li>
1912
- <p>
1913
- In a virtual host configuration block.
1914
- </p>
1915
- </li>
1916
- <li>
1917
- <p>
1918
- In a <tt>&lt;Directory&gt;</tt> or <tt>&lt;Location&gt;</tt> block.
2244
+ In the global server configuration.
2245
+ </p>
2246
+ </li>
2247
+ <li>
2248
+ <p>
2249
+ In a virtual host configuration block.
2250
+ </p>
2251
+ </li>
2252
+ <li>
2253
+ <p>
2254
+ In a <tt>&lt;Directory&gt;</tt> or <tt>&lt;Location&gt;</tt> block.
2255
+ </p>
2256
+ </li>
2257
+ <li>
2258
+ <p>
2259
+ In <em>.htaccess</em>, if <tt>AllowOverride Limits</tt> is on.
2260
+ </p>
2261
+ </li>
2262
+ </ul></div>
2263
+ <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>0</em>.</p></div>
2264
+ </div>
2265
+ <div class="sect3">
2266
+ <h4 id="PassengerPreStart">5.11.7. PassengerPreStart &lt;url&gt;</h4>
2267
+ <div class="paragraph"><p>By default, Phusion Passenger does not start any application instances until said
2268
+ web application is first accessed. The result is that the first visitor of said
2269
+ web application might experience a small delay as Phusion Passenger is starting
2270
+ the web application on demand. If that is undesirable, then this directive can be
2271
+ used to pre-started application instances during Apache startup.</p></div>
2272
+ <div class="paragraph"><p>A few things to be careful of:</p></div>
2273
+ <div class="ulist"><ul>
2274
+ <li>
2275
+ <p>
2276
+ This directive accepts the <strong>URL</strong> of the web application you want to pre-start,
2277
+ not a on/off value! This might seem a bit weird, but read on for rationale. As
2278
+ for the specifics of the URL:
2279
+ </p>
2280
+ <div class="ulist"><ul>
2281
+ <li>
2282
+ <p>
2283
+ The domain part of the URL must be equal to the value of the <em>ServerName</em>
2284
+ directive of the VirtualHost block that defines the web application.
2285
+ </p>
2286
+ </li>
2287
+ <li>
2288
+ <p>
2289
+ Unless the web application is deployed on port 80, the URL should contain
2290
+ the web application&#8217;s port number too.
2291
+ </p>
2292
+ </li>
2293
+ <li>
2294
+ <p>
2295
+ The path part of the URL must point to some URI that the web application
2296
+ handles.
2297
+ </p>
2298
+ </li>
2299
+ </ul></div>
2300
+ </li>
2301
+ <li>
2302
+ <p>
2303
+ You will probably want to combine this option with
2304
+ <a href="#PassengerMinInstances">PassengerMinInstances</a> because application instances
2305
+ started with <em>PassengerPreStart</em> are subject to the usual idle timeout rules.
2306
+ See the example below for an explanation.
2307
+ </p>
2308
+ </li>
2309
+ </ul></div>
2310
+ <div class="paragraph"><p>This option may occur in the following places:</p></div>
2311
+ <div class="ulist"><ul>
2312
+ <li>
2313
+ <p>
2314
+ In the global server configuration.
2315
+ </p>
2316
+ </li>
2317
+ <li>
2318
+ <p>
2319
+ In a virtual host configuration block.
2320
+ </p>
2321
+ </li>
2322
+ </ul></div>
2323
+ <div class="paragraph"><p>In each place, it may be specified any number of times.</p></div>
2324
+ <div class="sect4">
2325
+ <h5 id="_example_1_basic_usage">Example 1: basic usage</h5>
2326
+ <div class="paragraph"><p>Suppose that you have the following web applications.</p></div>
2327
+ <div class="listingblock">
2328
+ <div class="content">
2329
+ <pre><tt>&lt;VirtualHost *:80&gt;
2330
+ ServerName foo.com
2331
+ DocumentRoot /webapps/foo/public
2332
+ &lt;/VirtualHost&gt;
2333
+
2334
+ &lt;VirtualHost *:3500&gt;
2335
+ ServerName bar.com
2336
+ DocumentRoot /webapps/bar/public
2337
+ &lt;/VirtualHost&gt;</tt></pre>
2338
+ </div></div>
2339
+ <div class="paragraph"><p>You want both of them to be pre-started during Apache startup. The URL for
2340
+ foo.com is <em>http://foo.com/</em> (or, equivalently, <em>http://foo.com:80/</em>) and
2341
+ the URL for bar.com is <em>http://bar.com:3500/</em>. So we add two PassengerPreStart
2342
+ directives, like this:</p></div>
2343
+ <div class="listingblock">
2344
+ <div class="content">
2345
+ <pre><tt>&lt;VirtualHost *:80&gt;
2346
+ ServerName foo.com
2347
+ DocumentRoot /webapps/foo/public
2348
+ &lt;/VirtualHost&gt;
2349
+
2350
+ &lt;VirtualHost *:3500&gt;
2351
+ ServerName bar.com
2352
+ DocumentRoot /webapps/bar/public
2353
+ &lt;/VirtualHost&gt;
2354
+
2355
+ PassengerPreStart http://foo.com/ # &lt;--- added
2356
+ PassengerPreStart http://bar.com:3500/ # &lt;--- added</tt></pre>
2357
+ </div></div>
2358
+ </div>
2359
+ <div class="sect4">
2360
+ <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>
2361
+ <div class="paragraph"><p>Suppose that you have a web application deployed in a sub-URI <em>/store</em>, like this:</p></div>
2362
+ <div class="listingblock">
2363
+ <div class="content">
2364
+ <pre><tt>&lt;VirtualHost *:80&gt;
2365
+ ServerName myblog.com
2366
+ DocumentRoot /webapps/wordpress
2367
+ RailsBaseURI /store
2368
+ &lt;/VirtualHost&gt;</tt></pre>
2369
+ </div></div>
2370
+ <div class="paragraph"><p>Then specify the domain name of its containing virtual host followed by the sub-URI,
2371
+ like this:</p></div>
2372
+ <div class="listingblock">
2373
+ <div class="content">
2374
+ <pre><tt>&lt;VirtualHost *:80&gt;
2375
+ ServerName myblog.com
2376
+ DocumentRoot /webapps/wordpress
2377
+ RailsBaseURI /store
2378
+ &lt;/VirtualHost&gt;
2379
+
2380
+ PassengerPreStart http://myblog.com/store # &lt;----- added</tt></pre>
2381
+ </div></div>
2382
+ <div class="paragraph"><p>The sub-URI <strong>must</strong> be included; if you don&#8217;t then the directive will have no effect.
2383
+ The following example is wrong and won&#8217;t pre-start the store web application:</p></div>
2384
+ <div class="listingblock">
2385
+ <div class="content">
2386
+ <pre><tt>PassengerPreStart http://myblog.com/ # &lt;----- WRONG! Missing "/store" part.</tt></pre>
2387
+ </div></div>
2388
+ </div>
2389
+ <div class="sect4">
2390
+ <h5 id="_example_3_combining_with_passengermininstances">Example 3: combining with PassengerMinInstances</h5>
2391
+ <div class="paragraph"><p>Application instances started with PassengerPreStart are
2392
+ also subject to the idle timeout rules as specified by
2393
+ <a href="#PassengerPoolIdleTime">PassengerPoolIdleTime</a>! That means that by default,
2394
+ the pre-started application instances for foo.com are bar.com are shut down
2395
+ after a few minutes of inactivity. If you don&#8217;t want that to happen, then
2396
+ you should combine PassengerPreStart with
2397
+ <a href="#PassengerMinInstances">PassengerMinInstances</a>, like this:</p></div>
2398
+ <div class="listingblock">
2399
+ <div class="content">
2400
+ <pre><tt>&lt;VirtualHost *:80&gt;
2401
+ ServerName foo.com
2402
+ DocumentRoot /webapps/foo/public
2403
+ PassengerMinInstances 1 # &lt;--- added
2404
+ &lt;/VirtualHost&gt;
2405
+
2406
+ &lt;VirtualHost *:3500&gt;
2407
+ ServerName bar.com
2408
+ DocumentRoot /webapps/bar/public
2409
+ PassengerMinInstances 1 # &lt;--- added
2410
+ &lt;/VirtualHost&gt;
2411
+
2412
+ PassengerPreStart http://foo.com/
2413
+ PassengerPreStart http://bar.com:3500/</tt></pre>
2414
+ </div></div>
2415
+ </div>
2416
+ <div class="sect4">
2417
+ <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>
2418
+ <div class="paragraph"><p>A directive that accepts a simple on/off flag is definitely more intuitive,
2419
+ but due technical difficulties w.r.t. the way Apache works, it&#8217;s very hard
2420
+ to implement it like that:</p></div>
2421
+ <div class="ulist"><ul>
2422
+ <li>
2423
+ <p>
2424
+ It is very hard to obtain a full list of web applications defined in the
2425
+ Apache configuration file(s). In other words, it&#8217;s hard for Phusion Passenger
2426
+ to know which web applications are deployed on Apache until a web application
2427
+ is first accessed, and without such a list Phusion Passenger wouldn&#8217;t know
2428
+ which web applications to pre-start. It&#8217;s probably not completely impossible
2429
+ to obtain such a list, but this brings us to the following point;
1919
2430
  </p>
1920
2431
  </li>
1921
2432
  <li>
1922
2433
  <p>
1923
- In <em>.htaccess</em>, if <tt>AllowOverride Limits</tt> is on.
2434
+ Users expect things like <em>mod_env</em> to work even in combination with Phusion
2435
+ Passenger. For example some people put &#8220;SetEnv PATH=&#8230;.&#8221; in their virtual
2436
+ host block and they expect the web application to pick that environment variable
2437
+ up when it&#8217;s started. Information like this is stored in module-specific
2438
+ locations that Phusion Passenger cannot access directly. Even if the previous
2439
+ bullet point is solved and we can obtain a list of web applications,
2440
+ we cannot start the application with the correct mod_env information.
2441
+ mod_env is just one such example; there are probably many other Apache modules,
2442
+ all of which people expect to work, but we cannot answer to those expectations
2443
+ if PassengerPreStart is implemented as a simple on/off flag.
1924
2444
  </p>
1925
2445
  </li>
1926
2446
  </ul></div>
1927
- <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>0</em>.</p></div>
1928
- <h4 id="PassengerHighPerformance">5.12.6. PassengerHighPerformance &lt;on|off&gt;</h4>
2447
+ <div class="paragraph"><p>So as a compromise, we made it accept a URL. This is easier to implement for
2448
+ us and altough it looks weird, it behaves consistently w.r.t. cooperation
2449
+ with other Apache modules.</p></div>
2450
+ </div>
2451
+ <div class="sect4">
2452
+ <h5 id="_what_does_phusion_passenger_do_with_the_url">What does Phusion Passenger do with the URL?</h5>
2453
+ <div class="paragraph"><p>During Apache startup, Phusion Passenger will send a dummy HEAD request to the
2454
+ given URL and discard the result. In other words, Phusion Passenger simulates a
2455
+ web access at the given URL. However this simulated request is always sent to
2456
+ localhost, <strong>not</strong> to the IP that the domain resolves to. Suppose that bar.com
2457
+ in example 1 resolves to 209.85.227.99; Phusion Passenger will
2458
+ send the following HTTP request to 127.0.0.1 port 3500 (and not to 209.85.227.99
2459
+ port 3500):</p></div>
2460
+ <div class="listingblock">
2461
+ <div class="content">
2462
+ <pre><tt>HEAD / HTTP/1.1
2463
+ Host: bar.com
2464
+ Connection: close</tt></pre>
2465
+ </div></div>
2466
+ <div class="paragraph"><p>Similarly, for example 2, Phusion Passenger will send the following HTTP request
2467
+ to 127.0.0.1 port 80:</p></div>
2468
+ <div class="listingblock">
2469
+ <div class="content">
2470
+ <pre><tt>HEAD /store HTTP/1.1
2471
+ Host: myblog.com
2472
+ Connection: close</tt></pre>
2473
+ </div></div>
2474
+ </div>
2475
+ <div class="sect4">
2476
+ <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>
2477
+ <div class="paragraph"><p>No. See previous subsection.</p></div>
2478
+ </div>
2479
+ <div class="sect4">
2480
+ <h5 id="_my_web_application_consists_of_multiple_web_servers_what_url_do_i_need_to_specify_and_in_which_web_server_8217_s_apache_config_file">My web application consists of multiple web servers. What URL do I need to specify, and in which web server&#8217;s Apache config file?</h5>
2481
+ <div class="paragraph"><p>Put the web application&#8217;s virtual host&#8217;s ServerName value and the virtual host&#8217;s
2482
+ port in the URL, and put
2483
+ PassengerPreStart on all machines that you want to pre-start the web application
2484
+ on. The simulated web request is always sent to 127.0.0.1, with the domain name
2485
+ in the URL as value for the <em>Host</em> HTTP header, so you don&#8217;t need to worry about
2486
+ the request ending up at a different web server in the cluster.</p></div>
2487
+ </div>
2488
+ <div class="sect4">
2489
+ <h5 id="_does_passengerprestart_support_https_urls">Does PassengerPreStart support https:// URLs?</h5>
2490
+ <div class="paragraph"><p>Yes. And it does not perform any certificate validation.</p></div>
2491
+ </div>
2492
+ </div>
2493
+ <div class="sect3">
2494
+ <h4 id="PassengerHighPerformance">5.11.8. PassengerHighPerformance &lt;on|off&gt;</h4>
1929
2495
  <div class="paragraph"><p>By default, Phusion Passenger is compatible with mod_rewrite and most other
1930
2496
  Apache modules. However, a lot of effort is required in order to be compatible.
1931
2497
  If you turn <em>PassengerHighPerformance</em> to <em>on</em>, then Phusion Passenger will be
@@ -2001,8 +2567,12 @@ then you can enable high performance mode for a certain URL only. For example:</
2001
2567
  </div></div>
2002
2568
  <div class="paragraph"><p>This enables high performance mode for
2003
2569
  <a href="http://www.foo.com/chatroom/ajax_update_poll">http://www.foo.com/chatroom/ajax_update_poll</a> only.</p></div>
2004
- <h3 id="_compatibility_options">5.13. Compatibility options</h3><div style="clear:left"></div>
2005
- <h4 id="PassengerResolveSymlinksInDocumentRoot">5.13.1. PassengerResolveSymlinksInDocumentRoot &lt;on|off&gt;</h4>
2570
+ </div>
2571
+ </div>
2572
+ <div class="sect2">
2573
+ <h3 id="_compatibility_options">5.12. Compatibility options</h3>
2574
+ <div class="sect3">
2575
+ <h4 id="PassengerResolveSymlinksInDocumentRoot">5.12.1. PassengerResolveSymlinksInDocumentRoot &lt;on|off&gt;</h4>
2006
2576
  <div class="paragraph"><p>Configures whether Phusion Passenger should resolve symlinks in the document root.
2007
2577
  Please refer to <a href="#application_detection">How Phusion Passenger detects whether a virtual host is a web application</a> for more information.</p></div>
2008
2578
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
@@ -2029,7 +2599,9 @@ In <em>.htaccess</em>, if <tt>AllowOverride Options</tt> is on.
2029
2599
  </li>
2030
2600
  </ul></div>
2031
2601
  <div class="paragraph"><p>In each place, it may be specified at most once. It is off by default.</p></div>
2032
- <h4 id="_passengerallowencodedslashes_lt_on_off_gt">5.13.2. PassengerAllowEncodedSlashes &lt;on|off&gt;</h4>
2602
+ </div>
2603
+ <div class="sect3">
2604
+ <h4 id="_passengerallowencodedslashes_lt_on_off_gt">5.12.2. PassengerAllowEncodedSlashes &lt;on|off&gt;</h4>
2033
2605
  <div class="paragraph"><p>By default, Apache doesn&#8217;t support URLs with encoded slashes (%2f), e.g. URLs like
2034
2606
  this: <tt>/users/fujikura%2fyuu</tt>. If you access such an URL then Apache will return a
2035
2607
  404 Not Found error. This can be solved by turning on PassengerAllowEncodedSlashes
@@ -2094,8 +2666,55 @@ accessing <a href="http://www.example.com/about">http://www.example.com/about</a
2094
2666
  <a href="http://www.example.com/info/about">http://www.example.com/info/about</a>. Notice that PassengerAllowEncodedSlashes only
2095
2667
  interferes with passthrough rules, not with any other mod_rewrite rules. The rules for
2096
2668
  displaying maintenance.html will work fine even for URLs starting with "/users".</p></div>
2097
- <h3 id="_ruby_on_rails_specific_options">5.14. Ruby on Rails-specific options</h3><div style="clear:left"></div>
2098
- <h4 id="_railsautodetect_lt_on_off_gt">5.14.1. RailsAutoDetect &lt;on|off&gt;</h4>
2669
+ </div>
2670
+ </div>
2671
+ <div class="sect2">
2672
+ <h3 id="_logging_and_debugging_options">5.13. Logging and debugging options</h3>
2673
+ </div>
2674
+ <div class="sect2">
2675
+ <h3 id="_passengerloglevel_lt_integer_gt">5.14. PassengerLogLevel &lt;integer&gt;</h3>
2676
+ <div class="paragraph"><p>This option allows one to specify how much information Phusion Passenger should
2677
+ write to the Apache error log file. A higher log level value means that more
2678
+ information will be logged.</p></div>
2679
+ <div class="paragraph"><p>Possible values are:</p></div>
2680
+ <div class="ulist"><ul>
2681
+ <li>
2682
+ <p>
2683
+ <em>0</em>: Show only errors and warnings.
2684
+ </p>
2685
+ </li>
2686
+ <li>
2687
+ <p>
2688
+ <em>1</em>: Show the most important debugging information. This might be useful for
2689
+ system administrators who are trying to figure out the cause of a
2690
+ problem.
2691
+ </p>
2692
+ </li>
2693
+ <li>
2694
+ <p>
2695
+ <em>2</em>: Show more debugging information. This is typically only useful for developers.
2696
+ </p>
2697
+ </li>
2698
+ <li>
2699
+ <p>
2700
+ <em>3</em>: Show even more debugging information.
2701
+ </p>
2702
+ </li>
2703
+ </ul></div>
2704
+ <div class="paragraph"><p>This option may only occur once, in the global server configuration.
2705
+ The default is <em>0</em>.</p></div>
2706
+ </div>
2707
+ <div class="sect2">
2708
+ <h3 id="_passengerdebuglogfile_lt_filename_gt">5.15. PassengerDebugLogFile &lt;filename&gt;</h3>
2709
+ <div class="paragraph"><p>By default Phusion Passenger debugging and error messages are written to the global
2710
+ web server error log. This option allows one to specify the file that debugging and
2711
+ error messages should be written to instead.</p></div>
2712
+ <div class="paragraph"><p>This option may only occur once, in the global server configuration.</p></div>
2713
+ </div>
2714
+ <div class="sect2">
2715
+ <h3 id="_ruby_on_rails_specific_options">5.16. Ruby on Rails-specific options</h3>
2716
+ <div class="sect3">
2717
+ <h4 id="_railsautodetect_lt_on_off_gt">5.16.1. RailsAutoDetect &lt;on|off&gt;</h4>
2099
2718
  <div class="paragraph"><p>Whether Phusion Passenger should automatically detect whether a virtual host&#8217;s
2100
2719
  document root is a Ruby on Rails application. The default is <em>on</em>.</p></div>
2101
2720
  <div class="paragraph"><p>This option may occur in the global server configuration or in a virtual host
@@ -2123,7 +2742,9 @@ application by using the <a href="#RailsBaseURI">RailsBaseURI</a> configuration
2123
2742
  RailsBaseURI / # This line has been added.
2124
2743
  &lt;/VirtualHost&gt;</tt></pre>
2125
2744
  </div></div>
2126
- <h4 id="RailsBaseURI">5.14.2. RailsBaseURI &lt;uri&gt;</h4>
2745
+ </div>
2746
+ <div class="sect3">
2747
+ <h4 id="RailsBaseURI">5.16.2. RailsBaseURI &lt;uri&gt;</h4>
2127
2748
  <div class="paragraph"><p>Used to specify that the given URI is a Rails application. See
2128
2749
  <a href="#deploying_rails_to_sub_uri">Deploying Rails to a sub URI</a> for an example.</p></div>
2129
2750
  <div class="paragraph"><p>It is allowed to specify this option multiple times. Do this to deploy multiple
@@ -2151,7 +2772,9 @@ In <em>.htaccess</em>, if <tt>AllowOverride Options</tt> is on.
2151
2772
  </p>
2152
2773
  </li>
2153
2774
  </ul></div>
2154
- <h4 id="rails_env">5.14.3. RailsEnv &lt;string&gt;</h4>
2775
+ </div>
2776
+ <div class="sect3">
2777
+ <h4 id="rails_env">5.16.3. RailsEnv &lt;string&gt;</h4>
2155
2778
  <div class="paragraph"><p>This option allows one to specify the default <tt>RAILS_ENV</tt> value.</p></div>
2156
2779
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
2157
2780
  <div class="ulist"><ul>
@@ -2177,100 +2800,9 @@ In <em>.htaccess</em>, if <tt>AllowOverride Options</tt> is on.
2177
2800
  </li>
2178
2801
  </ul></div>
2179
2802
  <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>production</em>.</p></div>
2180
- <h4 id="RailsSpawnMethod">5.14.4. RailsSpawnMethod &lt;string&gt;</h4>
2181
- <div class="admonitionblock">
2182
- <table><tr>
2183
- <td class="icon">
2184
- <img src="./images/icons/tip.png" alt="Tip" />
2185
- </td>
2186
- <td class="content">
2187
- <div class="title">"What spawn method should I use?"</div>
2188
- <div class="paragraph"><p>This subsection attempts to describe spawn methods, but it&#8217;s okay if you don&#8217;t (want to)
2189
- understand it, as it&#8217;s mostly a technical detail. You can basically follow this rule of thumb:</p></div>
2190
- <div class="sidebarblock">
2191
- <div class="sidebar-content">
2192
- <div class="paragraph"><p>If your application works on Mongrel, but not on Phusion Passenger, then set
2193
- <tt>RailsSpawnMethod</tt> to <em>conservative</em>. Otherwise, leave it at <em>smart-lv2</em> (the default).</p></div>
2194
- </div></div>
2195
- <div class="paragraph"><p>However, we do recommend you to try to understand it. The <em>smart</em> and <em>smart-lv2</em> spawn
2196
- methods bring many benefits.</p></div>
2197
- </td>
2198
- </tr></table>
2199
2803
  </div>
2200
- <div class="paragraph"><p>Internally, Phusion Passenger spawns multiple Ruby on Rails processes in order to handle
2201
- requests. But there are multiple ways with which processes can be spawned, each having
2202
- its own set of pros and cons. Supported spawn methods are:</p></div>
2203
- <div class="dlist"><dl>
2204
- <dt class="hdlist1">
2205
- <em>smart</em>
2206
- </dt>
2207
- <dd>
2208
- <p>
2209
- When this spawn method is used, Phusion Passenger will attempt to cache Ruby on Rails
2210
- framework code and application code for a limited period of time. Please read
2211
- <a href="#spawning_methods_explained">Spawning methods explained</a> for a more detailed
2212
- explanation of what smart spawning exactly does.
2213
- </p>
2214
- <div class="paragraph"><p><strong>Pros:</strong>
2215
- This can significantly decrease spawn time (by as much as 90%). And, when Ruby Enterprise
2216
- Edition is used, <a href="#reducing_memory_usage">memory usage can be reduced by 33% on average</a>.</p></div>
2217
- <div class="paragraph"><p><strong>Cons:</strong>
2218
- Some Ruby on Rails applications and libraries are not compatible with smart spawning.
2219
- If that&#8217;s the case for your application, then you should use <em>conservative</em> as
2220
- spawning method.</p></div>
2221
- </dd>
2222
- <dt class="hdlist1">
2223
- <em>smart-lv2</em>
2224
- </dt>
2225
- <dd>
2226
- <p>
2227
- This spawning method is similar to <em>smart</em> but it skips the framework spawner
2228
- and uses the application spawner directly. This means the framework code is not
2229
- cached between multiple applications, although it is still cached within
2230
- instances of the same application. Please read
2231
- <a href="#spawning_methods_explained">Spawning methods explained</a> for a more detailed
2232
- explanation of what smart-lv2 spawning exactly does.
2233
- </p>
2234
- <div class="paragraph"><p><strong>Pros:</strong> It is compatible with a larger number of applications when compared to
2235
- the <em>smart</em> method, and still performs some caching.</p></div>
2236
- <div class="paragraph"><p><strong>Cons:</strong> It is slower than smart spawning if you have many applications which
2237
- use the same framework version. It is therefore advised that shared hosts use the
2238
- <em>smart</em> method instead.</p></div>
2239
- </dd>
2240
- <dt class="hdlist1">
2241
- <em>conservative</em>
2242
- </dt>
2243
- <dd>
2244
- <p>
2245
- This spawning method is similar to the one used in Mongrel Cluster. It does not
2246
- perform any code caching at all. Please read
2247
- <a href="#spawning_methods_explained">Spawning methods explained</a> for a more detailed
2248
- explanation of what conservative spawning exactly does.
2249
- </p>
2250
- <div class="paragraph"><p><strong>Pros:</strong>
2251
- Conservative spawning is guaranteed to be compatible with all Rails applications
2252
- and libraries.</p></div>
2253
- <div class="paragraph"><p><strong>Cons:</strong>
2254
- Much slower than smart spawning. Every spawn action will be equally slow, though no slower than
2255
- the startup time of a single server in Mongrel Cluster. Conservative spawning will also
2256
- render <a href="#reducing_memory_usage">Ruby Enterprise Edition&#8217;s memory reduction technology</a> useless.</p></div>
2257
- </dd>
2258
- </dl></div>
2259
- <div class="paragraph"><p>This option may occur in the following places:</p></div>
2260
- <div class="ulist"><ul>
2261
- <li>
2262
- <p>
2263
- In the global server configuration.
2264
- </p>
2265
- </li>
2266
- <li>
2267
- <p>
2268
- In a virtual host configuration block.
2269
- </p>
2270
- </li>
2271
- </ul></div>
2272
- <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>smart-lv2</em>.</p></div>
2273
- <h4 id="_railsframeworkspawneridletime_lt_integer_gt">5.14.5. RailsFrameworkSpawnerIdleTime &lt;integer&gt;</h4>
2804
+ <div class="sect3">
2805
+ <h4 id="_railsframeworkspawneridletime_lt_integer_gt">5.16.4. RailsFrameworkSpawnerIdleTime &lt;integer&gt;</h4>
2274
2806
  <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
2275
2807
  Phusion Passenger do. That is, it will automatically shutdown if it hasn&#8217;t done
2276
2808
  anything for a given period.</p></div>
@@ -2280,7 +2812,7 @@ seconds. A value of <em>0</em> means that it should never idle timeout.</p></div
2280
2812
  longer, which may slightly increase memory usage. But as long as the
2281
2813
  FrameworkSpawner server is running, the time to spawn a Ruby on Rails backend
2282
2814
  process only takes about 40% of the time that is normally needed, assuming that
2283
- you&#8217;re using the <em>smart</em> <a href="#RailsSpawnMethod">spawning method</a>. So if your
2815
+ you&#8217;re using the <em>smart</em> <a href="#PassengerSpawnMethod">spawning method</a>. So if your
2284
2816
  system has enough memory, is it recommended that you set this option to a high
2285
2817
  value or to <em>0</em>.</p></div>
2286
2818
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
@@ -2297,7 +2829,9 @@ In a virtual host configuration block.
2297
2829
  </li>
2298
2830
  </ul></div>
2299
2831
  <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>
2300
- <h4 id="_railsappspawneridletime_lt_integer_gt">5.14.6. RailsAppSpawnerIdleTime &lt;integer&gt;</h4>
2832
+ </div>
2833
+ <div class="sect3">
2834
+ <h4 id="_railsappspawneridletime_lt_integer_gt">5.16.5. RailsAppSpawnerIdleTime &lt;integer&gt;</h4>
2301
2835
  <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
2302
2836
  Phusion Passenger do. That is, it will automatically shutdown if it hasn&#8217;t done
2303
2837
  anything for a given period.</p></div>
@@ -2307,7 +2841,7 @@ seconds. A value of <em>0</em> means that it should never idle timeout.</p></div
2307
2841
  longer, which may slightly increase memory usage. But as long as the
2308
2842
  ApplicationSpawner server is running, the time to spawn a Ruby on Rails backend
2309
2843
  process only takes about 10% of the time that is normally needed, assuming that
2310
- you&#8217;re using the <em>smart</em> or <em>smart-lv2</em> <a href="#RailsSpawnMethod">spawning method</a>. So if your
2844
+ you&#8217;re using the <em>smart</em> or <em>smart-lv2</em> <a href="#PassengerSpawnMethod">spawning method</a>. So if your
2311
2845
  system has enough memory, is it recommended that you set this option to a high
2312
2846
  value or to <em>0</em>.</p></div>
2313
2847
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
@@ -2324,8 +2858,12 @@ In a virtual host configuration block.
2324
2858
  </li>
2325
2859
  </ul></div>
2326
2860
  <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>
2327
- <h3 id="_rack_specific_options">5.15. Rack-specific options</h3><div style="clear:left"></div>
2328
- <h4 id="_rackautodetect_lt_on_off_gt">5.15.1. RackAutoDetect &lt;on|off&gt;</h4>
2861
+ </div>
2862
+ </div>
2863
+ <div class="sect2">
2864
+ <h3 id="_rack_specific_options">5.17. Rack-specific options</h3>
2865
+ <div class="sect3">
2866
+ <h4 id="_rackautodetect_lt_on_off_gt">5.17.1. RackAutoDetect &lt;on|off&gt;</h4>
2329
2867
  <div class="paragraph"><p>Whether Phusion Passenger should automatically detect whether a virtual host&#8217;s
2330
2868
  document root is a Rack application. The default is <em>on</em>.</p></div>
2331
2869
  <div class="paragraph"><p>This option may occur in the global server configuration or in a virtual host
@@ -2353,7 +2891,9 @@ application by using the <a href="#RackBaseURI">RackBaseURI</a> configuration op
2353
2891
  RackBaseURI / # This line was added
2354
2892
  &lt;/VirtualHost&gt;</tt></pre>
2355
2893
  </div></div>
2356
- <h4 id="RackBaseURI">5.15.2. RackBaseURI &lt;uri&gt;</h4>
2894
+ </div>
2895
+ <div class="sect3">
2896
+ <h4 id="RackBaseURI">5.17.2. RackBaseURI &lt;uri&gt;</h4>
2357
2897
  <div class="paragraph"><p>Used to specify that the given URI is a Rack application. See
2358
2898
  <a href="#deploying_rack_to_sub_uri">Deploying Rack to a sub URI</a> for an example.</p></div>
2359
2899
  <div class="paragraph"><p>It is allowed to specify this option multiple times. Do this to deploy multiple
@@ -2381,7 +2921,9 @@ In <em>.htaccess</em>, if <tt>AllowOverride Options</tt> is on.
2381
2921
  </p>
2382
2922
  </li>
2383
2923
  </ul></div>
2384
- <h4 id="rack_env">5.15.3. RackEnv &lt;string&gt;</h4>
2924
+ </div>
2925
+ <div class="sect3">
2926
+ <h4 id="rack_env">5.17.3. RackEnv &lt;string&gt;</h4>
2385
2927
  <div class="paragraph"><p>The given value will be accessible in Rack applications in the <tt>RACK_ENV</tt>
2386
2928
  environment variable. This allows one to define the environment in which
2387
2929
  Rack applications are run, very similar to <tt>RAILS_ENV</tt>.</p></div>
@@ -2409,25 +2951,45 @@ In <em>.htaccess</em>, if <tt>AllowOverride Options</tt> is on.
2409
2951
  </li>
2410
2952
  </ul></div>
2411
2953
  <div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>production</em>.</p></div>
2412
- <h3 id="_deprecated_options">5.16. Deprecated options</h3><div style="clear:left"></div>
2954
+ </div>
2955
+ </div>
2956
+ <div class="sect2">
2957
+ <h3 id="_deprecated_options">5.18. Deprecated options</h3>
2413
2958
  <div class="paragraph"><p>The following options have been deprecated, but are still supported for backwards
2414
2959
  compatibility reasons.</p></div>
2415
- <h4 id="_railsruby">5.16.1. RailsRuby</h4>
2960
+ <div class="sect3">
2961
+ <h4 id="_railsruby">5.18.1. RailsRuby</h4>
2416
2962
  <div class="paragraph"><p>Deprecated in favor of <a href="#PassengerRuby">PassengerRuby</a>.</p></div>
2417
- <h4 id="_railsuserswitching">5.16.2. RailsUserSwitching</h4>
2963
+ </div>
2964
+ <div class="sect3">
2965
+ <h4 id="_railsuserswitching">5.18.2. RailsUserSwitching</h4>
2418
2966
  <div class="paragraph"><p>Deprecated in favor of <a href="#PassengerUserSwitching">PassengerUserSwitching</a>.</p></div>
2419
- <h4 id="_railsdefaultuser">5.16.3. RailsDefaultUser</h4>
2967
+ </div>
2968
+ <div class="sect3">
2969
+ <h4 id="_railsdefaultuser">5.18.3. RailsDefaultUser</h4>
2420
2970
  <div class="paragraph"><p>Deprecated in favor of <a href="#PassengerDefaultUser">PassengerDefaultUser</a>.</p></div>
2421
- <h4 id="_railsallowmodrewrite">5.16.4. RailsAllowModRewrite</h4>
2971
+ </div>
2972
+ <div class="sect3">
2973
+ <h4 id="_railsallowmodrewrite">5.18.4. RailsAllowModRewrite</h4>
2422
2974
  <div class="paragraph"><p>This option doesn&#8217;t do anything anymore in recent versions of Phusion Passenger.</p></div>
2423
2975
  </div>
2976
+ <div class="sect3">
2977
+ <h4 id="_railsspawnmethod">5.18.5. RailsSpawnMethod</h4>
2978
+ <div class="paragraph"><p>Deprecated in favor of <a href="#PassengerSpawnMethod">PassengerSpawnMethod</a>.</p></div>
2979
+ </div>
2980
+ </div>
2981
+ </div>
2982
+ </div>
2983
+ <div class="sect1">
2424
2984
  <h2 id="_troubleshooting">6. Troubleshooting</h2>
2425
2985
  <div class="sectionbody">
2426
- <h3 id="_operating_system_specific_problems">6.1. Operating system-specific problems</h3><div style="clear:left"></div>
2986
+ <div class="sect2">
2987
+ <h3 id="_operating_system_specific_problems">6.1. Operating system-specific problems</h3>
2988
+ <div class="sect3">
2427
2989
  <h4 id="_macos_x_the_installer_cannot_locate_mamp_8217_s_apache">6.1.1. MacOS X: The installer cannot locate MAMP&#8217;s Apache</h4>
2428
2990
  <div class="sidebarblock">
2429
- <div class="sidebar-content">
2430
- <div class="sidebar-title">Symptoms</div>
2991
+ <div class="content">
2992
+ <div class="title">Symptoms</div>
2431
2993
  <div class="paragraph"><p>The installer finds Apache 2 development headers at <tt>/Applications/MAMP/Library/bin/apxs</tt>.
2432
2994
  However, Apache cannot be found. The installer also outputs the following error:</p></div>
2433
2995
  <div class="listingblock">
@@ -2440,11 +3002,15 @@ No such file or directory at /Applications/MAMP/Library/bin/apxs line 218.</tt><
2440
3002
  Please read <a href="http://forum.mamp.info/viewtopic.php?t=1866">this forum topic</a> to learn how
2441
3003
  to fix this problem.</p></div>
2442
3004
  <div class="paragraph"><p>See also <a href="http://code.google.com/p/phusion-passenger/issues/detail?id=12">this bug report</a>.</p></div>
2443
- <h3 id="_problems_during_installation">6.2. Problems during installation</h3><div style="clear:left"></div>
3005
+ </div>
3006
+ </div>
3007
+ <div class="sect2">
3008
+ <h3 id="_problems_during_installation">6.2. Problems during installation</h3>
3009
+ <div class="sect3">
2444
3010
  <h4 id="installing_ruby_dev">6.2.1. Ruby development headers aren&#8217;t installed</h4>
2445
3011
  <div class="sidebarblock">
2446
- <div class="sidebar-content">
2447
- <div class="sidebar-title">Symptoms</div>
3012
+ <div class="content">
3013
+ <div class="title">Symptoms</div>
2448
3014
  <div class="paragraph"><p>Installing Phusion Passenger fails because of one of the following errors:</p></div>
2449
3015
  <div class="ulist"><ul>
2450
3016
  <li>
@@ -2534,10 +3100,12 @@ which Ruby installation you want to use. Please read
2534
3100
  <a href="#specifying_ruby_installation">Specifying the correct Ruby installation</a>.</td>
2535
3101
  </tr></table>
2536
3102
  </div>
3103
+ </div>
3104
+ <div class="sect3">
2537
3105
  <h4 id="_apache_development_headers_aren_8217_t_installed">6.2.2. Apache development headers aren&#8217;t installed</h4>
2538
3106
  <div class="sidebarblock">
2539
- <div class="sidebar-content">
2540
- <div class="sidebar-title">Symptoms</div>
3107
+ <div class="content">
3108
+ <div class="title">Symptoms</div>
2541
3109
  <div class="paragraph"><p>Installing Phusion Passenger fails because of one of the following errors:</p></div>
2542
3110
  <div class="ulist"><ul>
2543
3111
  <li>
@@ -2619,10 +3187,12 @@ Other operating systems
2619
3187
  </p>
2620
3188
  </dd>
2621
3189
  </dl></div>
3190
+ </div>
3191
+ <div class="sect3">
2622
3192
  <h4 id="_apr_development_headers_aren_8217_t_installed">6.2.3. APR development headers aren&#8217;t installed</h4>
2623
3193
  <div class="sidebarblock">
2624
- <div class="sidebar-content">
2625
- <div class="sidebar-title">Symptoms</div>
3194
+ <div class="content">
3195
+ <div class="title">Symptoms</div>
2626
3196
  <div class="paragraph"><p>Installing Phusion Passenger fails because one of the following errors:</p></div>
2627
3197
  <div class="ulist"><ul>
2628
3198
  <li>
@@ -2699,11 +3269,18 @@ Other operating systems
2699
3269
  </p>
2700
3270
  </dd>
2701
3271
  </dl></div>
3272
+ </div>
3273
+ <div class="sect3">
2702
3274
  <h4 id="_phusion_passenger_is_using_the_wrong_apache_during_installation">6.2.4. Phusion Passenger is using the wrong Apache during installation</h4>
2703
3275
  <div class="paragraph"><p>Please <a href="#specifying_correct_apache_install">Specifying the correct Apache installation</a>, and re-run the Phusion Passenger installer.</p></div>
3276
+ </div>
3277
+ <div class="sect3">
2704
3278
  <h4 id="_phusion_passenger_is_using_the_wrong_ruby_during_installation">6.2.5. Phusion Passenger is using the wrong Ruby during installation</h4>
2705
3279
  <div class="paragraph"><p>Please <a href="#specifying_ruby_installation">Specifying the correct Ruby installation</a>, and re-run the Phusion Passenger installer.</p></div>
2706
- <h3 id="_problems_after_installation">6.3. Problems after installation</h3><div style="clear:left"></div>
3280
+ </div>
3281
+ </div>
3282
+ <div class="sect2">
3283
+ <h3 id="_problems_after_installation">6.3. Problems after installation</h3>
2707
3284
  <div class="admonitionblock">
2708
3285
  <table><tr>
2709
3286
  <td class="icon">
@@ -2717,20 +3294,27 @@ inside the Apache error logs. It will tell you what exactly went wrong.</p></div
2717
3294
  </td>
2718
3295
  </tr></table>
2719
3296
  </div>
3297
+ <div class="sect3">
2720
3298
  <h4 id="_my_rails_application_works_on_mongrel_but_not_on_phusion_passenger">6.3.1. My Rails application works on Mongrel, but not on Phusion Passenger</h4>
2721
- <div class="paragraph"><p>Please try setting <a href="#RailsSpawnMethod">RailsSpawnMethod</a> to <em>conservative</em>.</p></div>
3299
+ <div class="paragraph"><p>Please try setting <a href="#PassengerSpawnMethod">PassengerSpawnMethod</a> to <em>conservative</em>.</p></div>
3300
+ </div>
3301
+ <div class="sect3">
2722
3302
  <h4 id="_phusion_passenger_has_been_compiled_against_the_wrong_apache_installation">6.3.2. Phusion Passenger has been compiled against the wrong Apache installation</h4>
2723
3303
  <div class="sidebarblock">
2724
- <div class="sidebar-content">
2725
- <div class="sidebar-title">Symptoms</div>
3304
+ <div class="content">
3305
+ <div class="title">Symptoms</div>
2726
3306
  <div class="paragraph"><p>Apache crashes during startup (after being daemonized). The Apache error log
2727
3307
  says &#8220;'seg fault or similar nasty error detected in the parent process&#8221;'.</p></div>
2728
3308
  </div></div>
2729
3309
  <div class="paragraph"><p>This problem is most likely to occur on MacOS X. Most OS X users have multiple
2730
3310
  Apache installations on their system.</p></div>
2731
3311
  <div class="paragraph"><p>To solve this problem, please <a href="#specifying_correct_apache_install">specify the correct Apache installation</a>, and <a href="#install_passenger">reinstall Phusion Passenger</a>.</p></div>
3312
+ </div>
3313
+ <div class="sect3">
2732
3314
  <h4 id="_i_get_a_304_forbidden_error">6.3.3. I get a "304 Forbidden" error</h4>
2733
3315
  <div class="paragraph"><p>See next subsection.</p></div>
3316
+ </div>
3317
+ <div class="sect3">
2734
3318
  <h4 id="_static_assets_such_as_images_and_stylesheets_aren_8217_t_being_displayed">6.3.4. Static assets such as images and stylesheets aren&#8217;t being displayed</h4>
2735
3319
  <div class="paragraph"><p>Static assets are accelerated, i.e. they are served directly by Apache and do not
2736
3320
  go through the Rails stack. There are two reasons why Apache doesn&#8217;t serve static
@@ -2761,6 +3345,8 @@ The Apache process doesn&#8217;t have permission to access your Rails applicatio
2761
3345
  </p>
2762
3346
  </li>
2763
3347
  </ol></div>
3348
+ </div>
3349
+ <div class="sect3">
2764
3350
  <h4 id="_the_apache_error_log_says_that_the_spawn_manager_script_does_not_exist_or_that_it_does_not_have_permission_to_execute_it">6.3.5. The Apache error log says that the spawn manager script does not exist, or that it does not have permission to execute it</h4>
2765
3351
  <div class="paragraph"><p>If you are sure that the <em>PassengerRoot</em> configuration option is set correctly,
2766
3352
  then this problem is most likely caused by the fact that you&#8217;re running Apache
@@ -2798,6 +3384,8 @@ If you&#8217;ve installed Phusion Passenger via the source tarball, then run the
2798
3384
  </li>
2799
3385
  </ul></div>
2800
3386
  <div class="paragraph"><p>Once the permissions are fixed, restart Apache.</p></div>
3387
+ </div>
3388
+ <div class="sect3">
2801
3389
  <h4 id="_the_rails_application_reports_that_it_8217_s_unable_to_start_because_of_a_permission_error">6.3.6. The Rails application reports that it&#8217;s unable to start because of a permission error</h4>
2802
3390
  <div class="paragraph"><p>Please check whether your Rails application&#8217;s folder has the correct
2803
3391
  permissions. By default, Rails applications are started as the owner of the
@@ -2806,6 +3394,8 @@ file is owned by root, then the Rails application will be started as <em>nobody<
2806
3394
  (or as the user specify by <a href="#RailsDefaultUser">RailsDefaultUser</a>, if that&#8217;s
2807
3395
  specified).</p></div>
2808
3396
  <div class="paragraph"><p>Please read <a href="#user_switching">User switching (security)</a> for details.</p></div>
3397
+ </div>
3398
+ <div class="sect3">
2809
3399
  <h4 id="_my_rails_application_8217_s_log_file_is_not_being_written_to">6.3.7. My Rails application&#8217;s log file is not being written to</h4>
2810
3400
  <div class="paragraph"><p>There are a couple things that you should be aware of:</p></div>
2811
3401
  <div class="ulist"><ul>
@@ -2834,20 +3424,33 @@ following command to give your Rails application folder that context:</p></div>
2834
3424
  <div class="content">
2835
3425
  <pre><tt>chcon -R -h -t httpd_sys_content_t /path/to/your/rails/app</tt></pre>
2836
3426
  </div></div>
2837
- <h3 id="conflicting_apache_modules">6.4. Conflicting Apache modules</h3><div style="clear:left"></div>
3427
+ </div>
3428
+ </div>
3429
+ <div class="sect2">
3430
+ <h3 id="conflicting_apache_modules">6.4. Conflicting Apache modules</h3>
3431
+ <div class="sect3">
2838
3432
  <h4 id="_mod_userdir">6.4.1. mod_userdir</h4>
2839
3433
  <div class="paragraph"><p><em>mod_userdir</em> is not compatible with Phusion Passenger at the moment.</p></div>
3434
+ </div>
3435
+ <div class="sect3">
2840
3436
  <h4 id="_multiviews_mod_negotiation">6.4.2. MultiViews (mod_negotiation)</h4>
2841
3437
  <div class="paragraph"><p>MultiViews is not compatible with Phusion Passenger. You should disable MultiViews
2842
3438
  for all Phusion Passenger hosts.</p></div>
3439
+ </div>
3440
+ <div class="sect3">
2843
3441
  <h4 id="_virtualdocumentroot">6.4.3. VirtualDocumentRoot</h4>
2844
3442
  <div class="paragraph"><p>VirtualDocumentRoot is not compatible with Phusion Passenger at the moment.</p></div>
2845
3443
  </div>
2846
- <h2 id="_analysis_and_system_maintenance_tools">7. Analysis and system maintenance tools</h2>
3444
+ </div>
3445
+ </div>
3446
+ </div>
3447
+ <div class="sect1">
3448
+ <h2 id="_analysis_and_system_maintenance">7. Analysis and system maintenance</h2>
2847
3449
  <div class="sectionbody">
2848
3450
  <div class="paragraph"><p>Phusion Passenger provides a set of tools, which are useful for system analysis,
2849
3451
  maintenance and troubleshooting.</p></div>
2850
- <h3 id="_inspecting_memory_usage">7.1. Inspecting memory usage</h3><div style="clear:left"></div>
3452
+ <div class="sect2">
3453
+ <h3 id="_inspecting_memory_usage">7.1. Inspecting memory usage</h3>
2851
3454
  <div class="paragraph"><p>Process inspection tools such as <tt>ps</tt> and <tt>top</tt> are useful, but they
2852
3455
  <a href="http://groups.google.com/group/phusion-passenger/msg/1fd1c233456d3180">rarely show the correct memory usage</a>.
2853
3456
  The real memory usage is usually lower than what <tt>ps</tt> and <tt>top</tt> report.</p></div>
@@ -2897,7 +3500,9 @@ don&#8217;t provide facilities for determining processes' private dirty RSS. On
2897
3500
  the Resident Set Size is reported instead.</td>
2898
3501
  </tr></table>
2899
3502
  </div>
2900
- <h3 id="_inspecting_phusion_passenger_8217_s_internal_status">7.2. Inspecting Phusion Passenger&#8217;s internal status</h3><div style="clear:left"></div>
3503
+ </div>
3504
+ <div class="sect2">
3505
+ <h3 id="_inspecting_phusion_passenger_8217_s_internal_status">7.2. Inspecting Phusion Passenger&#8217;s internal status</h3>
2901
3506
  <div class="paragraph"><p>One can inspect Phusion Passenger&#8217;s internal status with the tool <tt>passenger-status</tt>.
2902
3507
  This tool must typically be run as root. For example:</p></div>
2903
3508
  <div class="listingblock">
@@ -3024,7 +3629,9 @@ Your application is frozen, i.e. has stopped responding. See
3024
3629
  </p>
3025
3630
  </li>
3026
3631
  </ol></div>
3027
- <h3 id="debugging_frozen">7.3. Debugging frozen applications</h3><div style="clear:left"></div>
3632
+ </div>
3633
+ <div class="sect2">
3634
+ <h3 id="debugging_frozen">7.3. Debugging frozen applications</h3>
3028
3635
  <div class="paragraph"><p>If one of your application instances is frozen (stopped responding), then you
3029
3636
  can figure out where it is frozen by killing it with <em>SIGABRT</em>. This will cause the
3030
3637
  application to raise an exception, with a backtrace.</p></div>
@@ -3045,9 +3652,77 @@ will restart killed application instances, as if nothing bad happened.</td>
3045
3652
  </tr></table>
3046
3653
  </div>
3047
3654
  </div>
3655
+ <div class="sect2">
3656
+ <h3 id="_accessing_individual_application_processes">7.4. Accessing individual application processes</h3>
3657
+ <div class="paragraph"><p>When a request is sent to the web server, Phusion Passenger will automatically forward
3658
+ the request to the most suitable application process, but sometimes it is desirable to
3659
+ be able to directly access the individual application processes. Use cases include, but
3660
+ are not limited to:</p></div>
3661
+ <div class="ulist"><ul>
3662
+ <li>
3663
+ <p>
3664
+ One wants to debug a memory leak or memory bloat problem that only seems to appear on
3665
+ certain URIs. One can send a request to a specific process to see whether that request
3666
+ causes the process&#8217;s memory usage to rise.
3667
+ </p>
3668
+ </li>
3669
+ <li>
3670
+ <p>
3671
+ The application caches data in local memory, and one wants to tell a specific
3672
+ application process to clear that local data.
3673
+ </p>
3674
+ </li>
3675
+ <li>
3676
+ <p>
3677
+ Other debugging use cases.
3678
+ </p>
3679
+ </li>
3680
+ </ul></div>
3681
+ <div class="paragraph"><p>All individual application processes are accessible via HTTP, so you can use standard
3682
+ HTTP tools like <em>curl</em>. The exact addresses can be obtained with the command
3683
+ <tt>passenger-status --verbose</tt>. These sockets are all bound to 127.0.0.1, but the port
3684
+ number is dynamically assigned. As a security measure, the sockets are also protected
3685
+ with a process-specific random password, which you can see in the
3686
+ <tt>passenger-status --verbose</tt> output. This password must be sent through the
3687
+ &#8220;X-Passenger-Connect-Password&#8221; HTTP header.</p></div>
3688
+ <div class="paragraph"><p>Example:</p></div>
3689
+ <div class="listingblock">
3690
+ <div class="content">
3691
+ <pre><tt>bash# passenger-status --verbose
3692
+ ----------- General information -----------
3693
+ max = 6
3694
+ count = 2
3695
+ active = 0
3696
+ inactive = 2
3697
+ Waiting on global queue: 0
3698
+
3699
+ ----------- Application groups -----------
3700
+ /Users/hongli/Sites/rack.test:
3701
+ App root: /Users/hongli/Sites/rack.test
3702
+ * PID: 24235 Sessions: 0 Processed: 7 Uptime: 17s
3703
+ URL : http://127.0.0.1:58122
3704
+ Password: nFfVOX1F8LjZ90HJh28Sd_htJOsgRsNne2QXKf8NIXw
3705
+ * PID: 24250 Sessions: 0 Processed: 4 Uptime: 1s
3706
+ URL : http://127.0.0.1:57933
3707
+ Password: _RGXlQ9EGDGJKLevQ_qflUtF1KmxEo2UiRzMwIE1sBY</tt></pre>
3708
+ </div></div>
3709
+ <div class="paragraph"><p>Here we see that the web application <em>rack.test</em> has two processes.
3710
+ Process 24235 is accessible via <a href="http://127.0.0.1:58122">http://127.0.0.1:58122</a>, and
3711
+ process 24250 is accessible via <a href="http://127.0.0.1:57933">http://127.0.0.1:57933</a>.</p></div>
3712
+ <div class="paragraph"><p>To access 24235 we must send its password, <em>nFfVOX1F8LjZ90HJh28Sd_htJOsgRsNne2QXKf8NIXw</em>,
3713
+ through the <em>X-Passenger-Connect-Password</em> HTTP header, like this:</p></div>
3714
+ <div class="listingblock">
3715
+ <div class="content">
3716
+ <pre><tt>bash# curl -H "X-Passenger-Connect-Password: nFfVOX1F8LjZ90HJh28Sd_htJOsgRsNne2QXKf8NIXw" http://127.0.0.1:58122/</tt></pre>
3717
+ </div></div>
3718
+ </div>
3719
+ </div>
3720
+ </div>
3721
+ <div class="sect1">
3048
3722
  <h2 id="_tips">8. Tips</h2>
3049
3723
  <div class="sectionbody">
3050
- <h3 id="user_switching">8.1. User switching (security)</h3><div style="clear:left"></div>
3724
+ <div class="sect2">
3725
+ <h3 id="user_switching">8.1. User switching (security)</h3>
3051
3726
  <div class="paragraph"><p>There is a problem that plagues most PHP web hosts, namely the fact that all PHP
3052
3727
  applications are run in the same user context as the web server. So for
3053
3728
  example, Joe&#8217;s PHP application will be able to read Jane&#8217;s PHP application&#8217;s
@@ -3062,10 +3737,8 @@ there are things that you should keep in mind:</p></div>
3062
3737
  <div class="ulist"><ul>
3063
3738
  <li>
3064
3739
  <p>
3065
- The owner of <em>environment.rb</em> must have read access to the Rails application&#8217;s
3066
- folder, and read/write access to the Rails application&#8217;s <em>logs</em> folder.
3067
- Likewise, the owner of <em>config.ru</em> must have read access to the Rack application&#8217;s
3068
- folder.
3740
+ The owner of <em>environment.rb</em>/<em>config.ru</em> must have read access to the application&#8217;s
3741
+ root directory, and read/write access to the application&#8217;s <em>logs</em> directory.
3069
3742
  </p>
3070
3743
  </li>
3071
3744
  <li>
@@ -3079,19 +3752,24 @@ This feature is only available if Apache is started by <em>root</em>. This is th
3079
3752
  Under no circumstances will applications be run as <em>root</em>. If
3080
3753
  <em>environment.rb</em>/<em>config.ru</em> is owned as root or by an unknown user, then the
3081
3754
  Rails/Rack application will run as the user specified by
3082
- <a href="#PassengerDefaultUser">PassengerDefaultUser (Apache)</a>/<a href="#PassengerDefaultUser">passenger_default_user (Nginx)</a>.
3755
+ <a href="#PassengerDefaultUser">PassengerDefaultUser</a> and
3756
+ <a href="#PassengerDefaultGroup">PassengerDefaultGroup</a>.
3083
3757
  </p>
3084
3758
  </li>
3085
3759
  </ul></div>
3086
3760
  <div class="paragraph"><p>User switching can be disabled with the
3087
- <a href="#PassengerUserSwitching">PassengerUserSwitching (Apache)</a>/<a href="#PassengerUserSwitching">passenger_user_switching (Nginx)</a>
3761
+ <a href="#PassengerUserSwitching">PassengerUserSwitching</a>
3088
3762
  option.</p></div>
3089
- <h3 id="reducing_memory_usage">8.2. Reducing memory consumption of Ruby on Rails applications by 33%</h3><div style="clear:left"></div>
3763
+ </div>
3764
+ <div class="sect2">
3765
+ <h3 id="reducing_memory_usage">8.2. Reducing memory consumption of Ruby on Rails applications by 33%</h3>
3090
3766
  <div class="paragraph"><p>Is it possible to reduce memory consumption of your Rails applications by 33% on average,
3091
3767
  by using <a href="http://www.rubyenterpriseedition.com/">Ruby Enterprise Edition</a>.
3092
3768
  Please visit the website for details.</p></div>
3093
3769
  <div class="paragraph"><p>Note that this feature does not apply to Rack applications.</p></div>
3094
- <h3 id="capistrano">8.3. Capistrano recipe</h3><div style="clear:left"></div>
3770
+ </div>
3771
+ <div class="sect2">
3772
+ <h3 id="capistrano">8.3. Capistrano recipe</h3>
3095
3773
  <div class="paragraph"><p>Phusion Passenger can be combined with <a href="http://capify.org/">Capistrano</a>.
3096
3774
  The following Capistrano recipe demonstrates Phusion Passenger support.
3097
3775
  It assumes that you&#8217;re using Git as version control system.</p></div>
@@ -3123,7 +3801,9 @@ namespace :deploy do
3123
3801
  end
3124
3802
  end</tt></pre>
3125
3803
  </div></div>
3126
- <h3 id="bundler_support">8.4. Bundler support</h3><div style="clear:left"></div>
3804
+ </div>
3805
+ <div class="sect2">
3806
+ <h3 id="bundler_support">8.4. Bundler support</h3>
3127
3807
  <div class="paragraph"><p>Phusion Passenger has automatic support for <a href="http://gembundler.com/git.html">Bundler</a>.
3128
3808
  It works as follows:</p></div>
3129
3809
  <div class="ulist"><ul>
@@ -3154,7 +3834,9 @@ you can override Phusion Passenger&#8217;s Bundler support code by creating a fi
3154
3834
  <em>config/setup_load_paths.rb</em>. If this file exists then it will be required before loading
3155
3835
  the application startup file. In this file you can do whatever you need to setup Bundler
3156
3836
  or a similar system.</p></div>
3157
- <h3 id="moving_phusion_passenger">8.5. Moving Phusion Passenger to a different directory</h3><div style="clear:left"></div>
3837
+ </div>
3838
+ <div class="sect2">
3839
+ <h3 id="moving_phusion_passenger">8.5. Moving Phusion Passenger to a different directory</h3>
3158
3840
  <div class="paragraph"><p>It is possible to relocate the Phusion Passenger files to a different directory. It
3159
3841
  involves two steps:</p></div>
3160
3842
  <div class="olist arabic"><ol class="arabic">
@@ -3191,7 +3873,9 @@ Edit your Apache configuration file, and set:
3191
3873
  </div></div>
3192
3874
  </li>
3193
3875
  </ol></div>
3194
- <h3 id="_installing_multiple_ruby_on_rails_versions">8.6. Installing multiple Ruby on Rails versions</h3><div style="clear:left"></div>
3876
+ </div>
3877
+ <div class="sect2">
3878
+ <h3 id="_installing_multiple_ruby_on_rails_versions">8.6. Installing multiple Ruby on Rails versions</h3>
3195
3879
  <div class="paragraph"><p>Each Ruby on Rails applications that are going to be deployed may require a
3196
3880
  specific Ruby on Rails version. You can install a specific version with
3197
3881
  this command:</p></div>
@@ -3202,7 +3886,9 @@ this command:</p></div>
3202
3886
  <div class="paragraph"><p>where <em>X.X.X</em> is the version number of Ruby on Rails.</p></div>
3203
3887
  <div class="paragraph"><p>All of these versions will exist in parallel, and will not conflict with each
3204
3888
  other. Phusion Passenger will automatically make use of the correct version.</p></div>
3205
- <h3 id="_making_the_application_restart_after_each_request">8.7. Making the application restart after each request</h3><div style="clear:left"></div>
3889
+ </div>
3890
+ <div class="sect2">
3891
+ <h3 id="_making_the_application_restart_after_each_request">8.7. Making the application restart after each request</h3>
3206
3892
  <div class="paragraph"><p>In some situations it might be desirable to restart the web application after
3207
3893
  each request, for example when developing a non-Rails application that doesn&#8217;t
3208
3894
  support code reloading, or when developing a web framework.</p></div>
@@ -3223,7 +3909,9 @@ or when you&#8217;re not developing a Rails application and your web framework
3223
3909
  does not support code reloading.</td>
3224
3910
  </tr></table>
3225
3911
  </div>
3226
- <h3 id="sub_uri_deployment_uri_fix">8.8. How to fix broken images/CSS/JavaScript URIs in sub-URI deployments</h3><div style="clear:left"></div>
3912
+ </div>
3913
+ <div class="sect2">
3914
+ <h3 id="sub_uri_deployment_uri_fix">8.8. How to fix broken images/CSS/JavaScript URIs in sub-URI deployments</h3>
3227
3915
  <div class="paragraph"><p>Some people experience broken images and other broken static assets when they
3228
3916
  deploy their application to a sub-URI (i.e. <em>http://mysite.com/railsapp/</em>).
3229
3917
  The reason for this usually is that you used a
@@ -3258,20 +3946,28 @@ so that your images will always work no matter what sub-URI you&#8217;ve deploye
3258
3946
  append a timestamp to the URI to better facilitate HTTP caching. For more information,
3259
3947
  please refer to
3260
3948
  <a href="http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html">the Rails API docs</a>.</p></div>
3261
- <h3 id="_x_sendfile_support">8.9. X-Sendfile support</h3><div style="clear:left"></div>
3949
+ </div>
3950
+ <div class="sect2">
3951
+ <h3 id="_x_sendfile_support">8.9. X-Sendfile support</h3>
3262
3952
  <div class="paragraph"><p>Phusion Passenger does not provide X-Sendfile support by itself. Please install
3263
3953
  <a href="http://tn123.ath.cx/mod_xsendfile/">mod_xsendfile</a> for X-Sendfile support.</p></div>
3264
- <h3 id="_upload_progress">8.10. Upload progress</h3><div style="clear:left"></div>
3954
+ </div>
3955
+ <div class="sect2">
3956
+ <h3 id="_upload_progress">8.10. Upload progress</h3>
3265
3957
  <div class="paragraph"><p>Phusion Passenger does not provide upload progress support by itself. Please
3266
3958
  try drogus&#8217;s <a href="http://github.com/drogus/apache-upload-progress-module/tree/master">
3267
3959
  Apache upload progress module</a> instead.</p></div>
3268
3960
  </div>
3961
+ </div>
3962
+ </div>
3963
+ <div class="sect1">
3269
3964
  <h2 id="_under_the_hood">9. Under the hood</h2>
3270
3965
  <div class="sectionbody">
3271
3966
  <div class="paragraph"><p>Phusion Passenger hides a lot of complexity for the end user (i.e. the web server
3272
3967
  system administrator), but sometimes it is desirable to know what is going on.
3273
3968
  This section describes a few things that Phusion Passenger does under the hood.</p></div>
3274
- <h3 id="_static_assets_serving">9.1. Static assets serving</h3><div style="clear:left"></div>
3969
+ <div class="sect2">
3970
+ <h3 id="_static_assets_serving">9.1. Static assets serving</h3>
3275
3971
  <div class="paragraph"><p>Phusion Passenger accelerates serving of static files. This means that, if an URI
3276
3972
  maps to a file that exists, then Phusion Passenger will let Apache serve that file
3277
3973
  directly, without hitting the web application.</p></div>
@@ -3288,7 +3984,9 @@ RewriteRule ^(.*)$ balancer://mongrel%{REQUEST_URI} [P,QSA,L]</tt></pre>
3288
3984
  </div></div>
3289
3985
  <div class="paragraph"><p>These kind of mod_rewrite rules are no longer required, and you can safely remove
3290
3986
  them.</p></div>
3291
- <h3 id="_page_caching_support">9.2. Page caching support</h3><div style="clear:left"></div>
3987
+ </div>
3988
+ <div class="sect2">
3989
+ <h3 id="_page_caching_support">9.2. Page caching support</h3>
3292
3990
  <div class="paragraph"><p>For each HTTP request, Phusion Passenger will automatically look for a corresponding
3293
3991
  page cache file, and serve that if it exists. It does this by appending ".html" to
3294
3992
  the filename that the URI normally maps to, and checking whether that file exists.
@@ -3322,7 +4020,9 @@ If <em>foo/bar.html</em> doesn&#8217;t exist either, then Phusion Passenger will
3322
4020
  application uses a non-standard page cache directory, i.e. if it doesn&#8217;t cache to
3323
4021
  the <em>public</em> directory. In that case you&#8217;ll need to use mod_rewrite to serve such
3324
4022
  page cache files.</p></div>
3325
- <h3 id="application_detection">9.3. How Phusion Passenger detects whether a virtual host is a web application</h3><div style="clear:left"></div>
4023
+ </div>
4024
+ <div class="sect2">
4025
+ <h3 id="application_detection">9.3. How Phusion Passenger detects whether a virtual host is a web application</h3>
3326
4026
  <div class="paragraph"><p>After you&#8217;ve read the deployment instructions you might wonder how Phusion Passenger
3327
4027
  knows that the DocumentRoot points to a web application that Phusion Passenger is
3328
4028
  able to serve, and how it knows what kind of web application it is (e.g. Rails or Rack).</p></div>
@@ -3367,6 +4067,9 @@ directive.</p></div>
3367
4067
  <div class="paragraph"><p>Autodetection of Rack applications happens through the same mechanism, exception that
3368
4068
  Phusion Passenger will look for <em>config.ru</em> instead of <em>config/environment.rb</em>.</p></div>
3369
4069
  </div>
4070
+ </div>
4071
+ </div>
4072
+ <div class="sect1">
3370
4073
  <h2 id="_appendix_a_about_this_document">10. Appendix A: About this document</h2>
3371
4074
  <div class="sectionbody">
3372
4075
  <div class="paragraph"><p>The text of this document is licensed under the
@@ -3385,9 +4088,12 @@ Attribution-Share Alike 3.0 Unported License</a>.</p></div>
3385
4088
  </span></p></div>
3386
4089
  <div class="paragraph"><p>Phusion Passenger is a trademark of Hongli Lai &amp; Ninh Bui.</p></div>
3387
4090
  </div>
4091
+ </div>
4092
+ <div class="sect1">
3388
4093
  <h2 id="_appendix_b_terminology">11. Appendix B: Terminology</h2>
3389
4094
  <div class="sectionbody">
3390
- <h3 id="application_root">11.1. Application root</h3><div style="clear:left"></div>
4095
+ <div class="sect2">
4096
+ <h3 id="application_root">11.1. Application root</h3>
3391
4097
  <div class="paragraph"><p>The root directory of an application that&#8217;s served by Phusion Passenger.</p></div>
3392
4098
  <div class="paragraph"><p>In case of Ruby on Rails applications, this is the directory that contains
3393
4099
  <em>Rakefile</em>, <em>app/</em>, <em>config/</em>, <em>public/</em>, etc. In other words, the directory
@@ -3445,6 +4151,9 @@ For example, take the following directory structure:</p></div>
3445
4151
  +- ...</tt></pre>
3446
4152
  </div></div>
3447
4153
  </div>
4154
+ </div>
4155
+ </div>
4156
+ <div class="sect1">
3448
4157
  <h2 id="spawning_methods_explained">12. Appendix C: Spawning methods explained</h2>
3449
4158
  <div class="sectionbody">
3450
4159
  <div class="paragraph"><p>At its core, Phusion Passenger is an HTTP proxy and process manager. It spawns
@@ -3454,7 +4163,8 @@ processes.</p></div>
3454
4163
  <div class="paragraph"><p>While this may sound simple, there&#8217;s not just one way to spawn worker processes.
3455
4164
  Let&#8217;s go over the different spawning methods. For simplicity&#8217;s sake, let&#8217;s
3456
4165
  assume that we&#8217;re only talking about Ruby on Rails applications.</p></div>
3457
- <h3 id="_the_most_straightforward_and_traditional_way_conservative_spawning">12.1. The most straightforward and traditional way: conservative spawning</h3><div style="clear:left"></div>
4166
+ <div class="sect2">
4167
+ <h3 id="_the_most_straightforward_and_traditional_way_conservative_spawning">12.1. The most straightforward and traditional way: conservative spawning</h3>
3458
4168
  <div class="paragraph"><p>Phusion Passenger could create a new Ruby process, which will then load the
3459
4169
  Rails application along with the entire Rails framework. This process will then
3460
4170
  enter an request handling main loop.</p></div>
@@ -3469,14 +4179,15 @@ programmers jargon, mongrel_cluster creates new Ruby processes by forking the
3469
4179
  current process and exec()-ing a new Ruby interpreter. Phusion Passenger on the
3470
4180
  other hand creates processes that reuse the already loaded Ruby interpreter. In
3471
4181
  programmers jargon, Phusion Passenger calls fork(), but not exec().</p></div>
3472
- <h3 id="_the_smart_spawning_method">12.2. The smart spawning method</h3><div style="clear:left"></div>
4182
+ </div>
4183
+ <div class="sect2">
4184
+ <h3 id="_the_smart_spawning_method">12.2. The smart spawning method</h3>
3473
4185
  <div class="admonitionblock">
3474
4186
  <table><tr>
3475
4187
  <td class="icon">
3476
4188
  <img src="./images/icons/note.png" alt="Note" />
3477
4189
  </td>
3478
- <td class="content">Smart spawning is only available for Ruby on Rails applications, not for
3479
- Rack applications or WSGI applications.</td>
4190
+ <td class="content">Smart spawning is supported for all Ruby applications but not for WSGI applications.</td>
3480
4191
  </tr></table>
3481
4192
  </div>
3482
4193
  <div class="paragraph"><p>While conservative spawning works well, it&#8217;s not as efficient as it could be
@@ -3492,6 +4203,7 @@ by application and Rails framework code, by utilizing so-called
3492
4203
  copy-on-write semantics of the virtual memory system on modern operating
3493
4204
  systems. As a side effect, the startup time is also reduced. This is technique
3494
4205
  is exploited by Phusion Passenger&#8217;s <em>smart</em> and <em>smart-lv2</em> spawn methods.</p></div>
4206
+ <div class="sect3">
3495
4207
  <h4 id="_how_it_works">12.2.1. How it works</h4>
3496
4208
  <div class="paragraph"><p>When the <em>smart-lv2</em> spawn method is being used, Phusion Passenger will first
3497
4209
  create a so-called <em>ApplicationSpawner server</em> process. This process loads the
@@ -3542,6 +4254,8 @@ ApplicationSpawner and FrameworkSpawner servers have an idle timeout just
3542
4254
  </p>
3543
4255
  </li>
3544
4256
  </ul></div>
4257
+ </div>
4258
+ <div class="sect3">
3545
4259
  <h4 id="_summary_of_benefits">12.2.2. Summary of benefits</h4>
3546
4260
  <div class="paragraph"><p>Suppose that Phusion Passenger needs a new worker process for an application
3547
4261
  that uses Rails 2.2.1.</p></div>
@@ -3576,7 +4290,10 @@ process).</p></div>
3576
4290
  assuming that your Ruby interpreter is <a href="#reducing_memory_usage">copy-on-write friendly</a>.</p></div>
3577
4291
  <div class="paragraph"><p>Of course, smart spawning is not without gotchas. But if you understand the
3578
4292
  gotchas you can easily reap the benefits of smart spawning.</p></div>
3579
- <h3 id="_smart_spawning_gotcha_1_unintential_file_descriptor_sharing">12.3. Smart spawning gotcha #1: unintential file descriptor sharing</h3><div style="clear:left"></div>
4293
+ </div>
4294
+ </div>
4295
+ <div class="sect2">
4296
+ <h3 id="_smart_spawning_gotcha_1_unintential_file_descriptor_sharing">12.3. Smart spawning gotcha #1: unintential file descriptor sharing</h3>
3580
4297
  <div class="paragraph"><p>Because worker processes are created by forking from an ApplicationSpawner
3581
4298
  server, it will share all file descriptors that are opened by the
3582
4299
  ApplicationSpawner server. (This is part of the semantics of the Unix
@@ -3608,6 +4325,7 @@ http://www.gnu.org/software/src-highlite -->
3608
4325
  <div class="paragraph"><p>Note that Phusion Passenger automatically reestablishes the connection to the
3609
4326
  database upon creating a new worker process, which is why you normally do not
3610
4327
  encounter any database issues when using smart spawning mode.</p></div>
4328
+ <div class="sect3">
3611
4329
  <h4 id="_example_1_memcached_connection_sharing_harmful">12.3.1. Example 1: Memcached connection sharing (harmful)</h4>
3612
4330
  <div class="paragraph"><p>Suppose we have a Rails application that connects to a Memcached server in
3613
4331
  <em>environment.rb</em>. This causes the ApplicationSpawner to have a socket connection
@@ -3698,6 +4416,8 @@ http://www.gnu.org/software/src-highlite -->
3698
4416
  <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
3699
4417
  <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
3700
4418
  <span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
4419
+ </div>
4420
+ <div class="sect3">
3701
4421
  <h4 id="_example_2_log_file_sharing_not_harmful">12.3.2. Example 2: Log file sharing (not harmful)</h4>
3702
4422
  <div class="paragraph"><p>There are also cases in which unintential file descriptor sharing is not harmful.
3703
4423
  One such case is log file file descriptor sharing. Even if two processes write
@@ -3707,7 +4427,10 @@ data in the log file is interleaved.</p></div>
3707
4427
  must synchronize write access via an inter-process synchronization mechanism,
3708
4428
  such as file locks. Reopening the log file, like you would have done in the
3709
4429
  Memcached example, doesn&#8217;t help.</p></div>
3710
- <h3 id="_smart_spawning_gotcha_2_the_need_to_revive_threads">12.4. Smart spawning gotcha #2: the need to revive threads</h3><div style="clear:left"></div>
4430
+ </div>
4431
+ </div>
4432
+ <div class="sect2">
4433
+ <h3 id="_smart_spawning_gotcha_2_the_need_to_revive_threads">12.4. Smart spawning gotcha #2: the need to revive threads</h3>
3711
4434
  <div class="paragraph"><p>Another part of the <em>fork()</em> system call&#8217;s semantics is the fact that threads
3712
4435
  disappear after a fork call. So if you&#8217;ve created any threads in environment.rb,
3713
4436
  then those threads will no longer be running in newly created worker process.
@@ -3728,7 +4451,9 @@ http://www.gnu.org/software/src-highlite -->
3728
4451
  <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
3729
4452
  <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
3730
4453
  <span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
3731
- <h3 id="_smart_spawning_gotcha_3_code_load_order">12.5. Smart spawning gotcha #3: code load order</h3><div style="clear:left"></div>
4454
+ </div>
4455
+ <div class="sect2">
4456
+ <h3 id="_smart_spawning_gotcha_3_code_load_order">12.5. Smart spawning gotcha #3: code load order</h3>
3732
4457
  <div class="paragraph"><p>This gotcha is only applicable to the <em>smart</em> spawn method, not the <em>smart-lv2</em>
3733
4458
  spawn method.</p></div>
3734
4459
  <div class="paragraph"><p>If your application expects the Rails framework to be not loaded during the
@@ -3746,10 +4471,12 @@ because it was already loaded, so a subsequent <tt>require "active_record/base"<
3746
4471
  has no effect.</p></div>
3747
4472
  </div>
3748
4473
  </div>
4474
+ </div>
4475
+ </div>
3749
4476
  <div id="footnotes"><hr /></div>
3750
4477
  <div id="footer">
3751
4478
  <div id="footer-text">
3752
- Last updated 2010-06-24 13:53:02 CEST
4479
+ Last updated 2010-09-14 15:23:30 CEST
3753
4480
  </div>
3754
4481
  </div>
3755
4482
  </body>