passenger 2.1.3 → 2.2.0

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 (398) hide show
  1. data/DEVELOPERS.TXT +2 -0
  2. data/INSTALL +3 -1
  3. data/LICENSE +19 -355
  4. data/NEWS +3 -0
  5. data/README +11 -4
  6. data/Rakefile +435 -236
  7. data/bin/passenger-config +20 -14
  8. data/bin/passenger-install-apache2-module +67 -201
  9. data/bin/passenger-install-nginx-module +477 -0
  10. data/bin/passenger-make-enterprisey +17 -12
  11. data/bin/passenger-memory-stats +33 -23
  12. data/bin/passenger-spawn-server +17 -12
  13. data/bin/passenger-status +18 -13
  14. data/bin/passenger-stress-test +17 -12
  15. data/doc/{Users guide.html → Users guide Apache.html } +79 -61
  16. data/doc/{Users guide.txt → Users guide Apache.txt } +43 -939
  17. data/doc/Users guide Nginx.html +2276 -0
  18. data/doc/Users guide Nginx.txt +776 -0
  19. data/doc/cxxapi/ApplicationPoolServer_8h-source.html +9 -4
  20. data/doc/cxxapi/ApplicationPool_8h-source.html +9 -4
  21. data/doc/cxxapi/Application_8h-source.html +26 -21
  22. data/doc/cxxapi/Bucket_8h-source.html +54 -44
  23. data/doc/cxxapi/CachedFileStat_8h-source.html +9 -4
  24. data/doc/cxxapi/Configuration_8h-source.html +357 -339
  25. data/doc/cxxapi/DirectoryMapper_8h-source.html +294 -280
  26. data/doc/cxxapi/DummySpawnManager_8h-source.html +9 -4
  27. data/doc/cxxapi/Exceptions_8h-source.html +9 -4
  28. data/doc/cxxapi/FileChecker_8h-source.html +9 -4
  29. data/doc/cxxapi/Hooks_8h-source.html +50 -40
  30. data/doc/cxxapi/Logging_8h-source.html +9 -4
  31. data/doc/cxxapi/MessageChannel_8h-source.html +20 -15
  32. data/doc/cxxapi/PoolOptions_8h-source.html +10 -5
  33. data/doc/cxxapi/SpawnManager_8h-source.html +9 -4
  34. data/doc/cxxapi/StandardApplicationPool_8h-source.html +10 -5
  35. data/doc/cxxapi/SystemTime_8h-source.html +9 -4
  36. data/doc/cxxapi/Utils_8h-source.html +242 -214
  37. data/doc/cxxapi/annotated.html +4 -28
  38. data/doc/cxxapi/classClient-members.html +4 -4
  39. data/doc/cxxapi/classClient.html +14 -11
  40. data/doc/cxxapi/classHooks-members.html +4 -5
  41. data/doc/cxxapi/classHooks.html +26 -24
  42. data/doc/cxxapi/classPassenger_1_1Application-members.html +4 -4
  43. data/doc/cxxapi/classPassenger_1_1Application.html +40 -37
  44. data/doc/cxxapi/classPassenger_1_1ApplicationPool-members.html +4 -4
  45. data/doc/cxxapi/classPassenger_1_1ApplicationPool.html +95 -92
  46. data/doc/cxxapi/classPassenger_1_1ApplicationPoolServer-members.html +4 -4
  47. data/doc/cxxapi/classPassenger_1_1ApplicationPoolServer.html +26 -23
  48. data/doc/cxxapi/classPassenger_1_1ApplicationPool__inherit__graph.map +1 -1
  49. data/doc/cxxapi/classPassenger_1_1ApplicationPool__inherit__graph.md5 +1 -1
  50. data/doc/cxxapi/classPassenger_1_1ApplicationPool__inherit__graph.png +0 -0
  51. data/doc/cxxapi/classPassenger_1_1Application_1_1Session-members.html +17 -17
  52. data/doc/cxxapi/classPassenger_1_1Application_1_1Session.html +139 -136
  53. data/doc/cxxapi/classPassenger_1_1BufferedUpload-members.html +4 -4
  54. data/doc/cxxapi/classPassenger_1_1BufferedUpload.html +13 -10
  55. data/doc/cxxapi/classPassenger_1_1BusyException-members.html +4 -4
  56. data/doc/cxxapi/classPassenger_1_1BusyException.html +11 -8
  57. data/doc/cxxapi/classPassenger_1_1ConfigurationException-members.html +4 -4
  58. data/doc/cxxapi/classPassenger_1_1ConfigurationException.html +11 -8
  59. data/doc/cxxapi/classPassenger_1_1DirectoryMapper-members.html +4 -5
  60. data/doc/cxxapi/classPassenger_1_1DirectoryMapper.html +45 -43
  61. data/doc/cxxapi/classPassenger_1_1DummySpawnManager-members.html +4 -4
  62. data/doc/cxxapi/classPassenger_1_1DummySpawnManager.html +13 -10
  63. data/doc/cxxapi/classPassenger_1_1FileChecker-members.html +4 -4
  64. data/doc/cxxapi/classPassenger_1_1FileChecker.html +22 -19
  65. data/doc/cxxapi/classPassenger_1_1FileNotFoundException-members.html +4 -4
  66. data/doc/cxxapi/classPassenger_1_1FileNotFoundException.html +12 -9
  67. data/doc/cxxapi/classPassenger_1_1FileNotFoundException__inherit__graph.map +1 -1
  68. data/doc/cxxapi/classPassenger_1_1FileNotFoundException__inherit__graph.md5 +1 -1
  69. data/doc/cxxapi/classPassenger_1_1FileNotFoundException__inherit__graph.png +0 -0
  70. data/doc/cxxapi/classPassenger_1_1FileSystemException-members.html +4 -4
  71. data/doc/cxxapi/classPassenger_1_1FileSystemException.html +14 -11
  72. data/doc/cxxapi/classPassenger_1_1FileSystemException__inherit__graph.map +1 -1
  73. data/doc/cxxapi/classPassenger_1_1FileSystemException__inherit__graph.md5 +1 -1
  74. data/doc/cxxapi/classPassenger_1_1FileSystemException__inherit__graph.png +0 -0
  75. data/doc/cxxapi/classPassenger_1_1IOException-members.html +4 -4
  76. data/doc/cxxapi/classPassenger_1_1IOException.html +12 -9
  77. data/doc/cxxapi/classPassenger_1_1IOException__inherit__graph.map +1 -1
  78. data/doc/cxxapi/classPassenger_1_1IOException__inherit__graph.md5 +1 -1
  79. data/doc/cxxapi/classPassenger_1_1IOException__inherit__graph.png +0 -0
  80. data/doc/cxxapi/classPassenger_1_1MessageChannel-members.html +4 -4
  81. data/doc/cxxapi/classPassenger_1_1MessageChannel.html +228 -225
  82. data/doc/cxxapi/classPassenger_1_1RuntimeException-members.html +4 -4
  83. data/doc/cxxapi/classPassenger_1_1RuntimeException.html +11 -8
  84. data/doc/cxxapi/classPassenger_1_1SpawnException-members.html +4 -4
  85. data/doc/cxxapi/classPassenger_1_1SpawnException.html +14 -11
  86. data/doc/cxxapi/classPassenger_1_1SpawnManager-members.html +4 -4
  87. data/doc/cxxapi/classPassenger_1_1SpawnManager.html +50 -47
  88. data/doc/cxxapi/classPassenger_1_1StandardApplicationPool-members.html +4 -4
  89. data/doc/cxxapi/classPassenger_1_1StandardApplicationPool.html +73 -70
  90. data/doc/cxxapi/classPassenger_1_1StandardApplicationPool__inherit__graph.map +1 -1
  91. data/doc/cxxapi/classPassenger_1_1StandardApplicationPool__inherit__graph.md5 +1 -1
  92. data/doc/cxxapi/classPassenger_1_1StandardApplicationPool__inherit__graph.png +0 -0
  93. data/doc/cxxapi/classPassenger_1_1SystemException-members.html +4 -4
  94. data/doc/cxxapi/classPassenger_1_1SystemException.html +17 -14
  95. data/doc/cxxapi/classPassenger_1_1SystemException__inherit__graph.map +1 -1
  96. data/doc/cxxapi/classPassenger_1_1SystemException__inherit__graph.md5 +1 -1
  97. data/doc/cxxapi/classPassenger_1_1SystemException__inherit__graph.png +0 -0
  98. data/doc/cxxapi/classPassenger_1_1SystemTime-members.html +4 -4
  99. data/doc/cxxapi/classPassenger_1_1SystemTime.html +14 -11
  100. data/doc/cxxapi/classes.html +35 -0
  101. data/doc/cxxapi/definitions_8h-source.html +9 -4
  102. data/doc/cxxapi/doxygen.css +311 -303
  103. data/doc/cxxapi/files.html +9 -18
  104. data/doc/cxxapi/functions.html +5 -224
  105. data/doc/cxxapi/functions_func.html +5 -185
  106. data/doc/cxxapi/functions_type.html +4 -4
  107. data/doc/cxxapi/functions_vars.html +4 -4
  108. data/doc/cxxapi/graph_legend.dot +19 -19
  109. data/doc/cxxapi/graph_legend.html +5 -5
  110. data/doc/cxxapi/graph_legend.png +0 -0
  111. data/doc/cxxapi/group__Configuration.html +11 -13
  112. data/doc/cxxapi/group__Configuration.png +0 -0
  113. data/doc/cxxapi/group__Core.html +10 -12
  114. data/doc/cxxapi/group__Core.png +0 -0
  115. data/doc/cxxapi/group__Exceptions.html +5 -7
  116. data/doc/cxxapi/group__Hooks.html +5 -7
  117. data/doc/cxxapi/group__Hooks.png +0 -0
  118. data/doc/cxxapi/group__Support.html +5 -624
  119. data/doc/cxxapi/hierarchy.html +6 -6
  120. data/doc/cxxapi/inherit__graph__0.map +1 -1
  121. data/doc/cxxapi/inherit__graph__0.md5 +1 -1
  122. data/doc/cxxapi/inherit__graph__0.png +0 -0
  123. data/doc/cxxapi/inherit__graph__1.map +1 -1
  124. data/doc/cxxapi/inherit__graph__1.md5 +1 -1
  125. data/doc/cxxapi/inherit__graph__1.png +0 -0
  126. data/doc/cxxapi/inherit__graph__10.map +1 -1
  127. data/doc/cxxapi/inherit__graph__10.md5 +1 -1
  128. data/doc/cxxapi/inherit__graph__10.png +0 -0
  129. data/doc/cxxapi/inherit__graph__11.map +1 -1
  130. data/doc/cxxapi/inherit__graph__11.md5 +1 -1
  131. data/doc/cxxapi/inherit__graph__11.png +0 -0
  132. data/doc/cxxapi/inherit__graph__12.map +1 -1
  133. data/doc/cxxapi/inherit__graph__12.md5 +1 -1
  134. data/doc/cxxapi/inherit__graph__12.png +0 -0
  135. data/doc/cxxapi/inherit__graph__13.map +1 -2
  136. data/doc/cxxapi/inherit__graph__13.md5 +1 -1
  137. data/doc/cxxapi/inherit__graph__13.png +0 -0
  138. data/doc/cxxapi/inherit__graph__14.map +2 -1
  139. data/doc/cxxapi/inherit__graph__14.md5 +1 -1
  140. data/doc/cxxapi/inherit__graph__14.png +0 -0
  141. data/doc/cxxapi/inherit__graph__15.map +1 -1
  142. data/doc/cxxapi/inherit__graph__15.md5 +1 -1
  143. data/doc/cxxapi/inherit__graph__15.png +0 -0
  144. data/doc/cxxapi/inherit__graph__16.map +1 -1
  145. data/doc/cxxapi/inherit__graph__16.md5 +1 -1
  146. data/doc/cxxapi/inherit__graph__16.png +0 -0
  147. data/doc/cxxapi/inherit__graph__17.map +1 -1
  148. data/doc/cxxapi/inherit__graph__17.md5 +1 -1
  149. data/doc/cxxapi/inherit__graph__17.png +0 -0
  150. data/doc/cxxapi/inherit__graph__18.map +1 -1
  151. data/doc/cxxapi/inherit__graph__18.md5 +1 -1
  152. data/doc/cxxapi/inherit__graph__18.png +0 -0
  153. data/doc/cxxapi/inherit__graph__19.map +1 -1
  154. data/doc/cxxapi/inherit__graph__19.md5 +1 -1
  155. data/doc/cxxapi/inherit__graph__19.png +0 -0
  156. data/doc/cxxapi/inherit__graph__2.map +1 -1
  157. data/doc/cxxapi/inherit__graph__2.md5 +1 -1
  158. data/doc/cxxapi/inherit__graph__2.png +0 -0
  159. data/doc/cxxapi/inherit__graph__20.map +2 -2
  160. data/doc/cxxapi/inherit__graph__20.md5 +1 -1
  161. data/doc/cxxapi/inherit__graph__20.png +0 -0
  162. data/doc/cxxapi/inherit__graph__21.map +1 -1
  163. data/doc/cxxapi/inherit__graph__21.md5 +1 -1
  164. data/doc/cxxapi/inherit__graph__21.png +0 -0
  165. data/doc/cxxapi/inherit__graph__3.map +1 -1
  166. data/doc/cxxapi/inherit__graph__3.md5 +1 -1
  167. data/doc/cxxapi/inherit__graph__3.png +0 -0
  168. data/doc/cxxapi/inherit__graph__4.map +1 -1
  169. data/doc/cxxapi/inherit__graph__4.md5 +1 -1
  170. data/doc/cxxapi/inherit__graph__4.png +0 -0
  171. data/doc/cxxapi/inherit__graph__5.map +1 -2
  172. data/doc/cxxapi/inherit__graph__5.md5 +1 -1
  173. data/doc/cxxapi/inherit__graph__5.png +0 -0
  174. data/doc/cxxapi/inherit__graph__6.map +2 -1
  175. data/doc/cxxapi/inherit__graph__6.md5 +1 -1
  176. data/doc/cxxapi/inherit__graph__6.png +0 -0
  177. data/doc/cxxapi/inherit__graph__7.map +1 -1
  178. data/doc/cxxapi/inherit__graph__7.md5 +1 -1
  179. data/doc/cxxapi/inherit__graph__7.png +0 -0
  180. data/doc/cxxapi/inherit__graph__8.map +1 -1
  181. data/doc/cxxapi/inherit__graph__8.md5 +1 -1
  182. data/doc/cxxapi/inherit__graph__8.png +0 -0
  183. data/doc/cxxapi/inherit__graph__9.map +1 -1
  184. data/doc/cxxapi/inherit__graph__9.md5 +1 -1
  185. data/doc/cxxapi/inherit__graph__9.png +0 -0
  186. data/doc/cxxapi/inherits.html +41 -41
  187. data/doc/cxxapi/main.html +4 -4
  188. data/doc/cxxapi/modules.html +4 -5
  189. data/doc/cxxapi/structPassenger_1_1AnythingToString-members.html +4 -4
  190. data/doc/cxxapi/structPassenger_1_1AnythingToString.html +13 -10
  191. data/doc/cxxapi/structPassenger_1_1AnythingToString_3_01vector_3_01string_01_4_01_4-members.html +5 -5
  192. data/doc/cxxapi/structPassenger_1_1AnythingToString_3_01vector_3_01string_01_4_01_4.html +16 -13
  193. data/doc/cxxapi/structPassenger_1_1PoolOptions-members.html +4 -4
  194. data/doc/cxxapi/structPassenger_1_1PoolOptions.html +63 -60
  195. data/doc/cxxapi/tabs.css +5 -2
  196. data/doc/cxxapi/tree.html +7 -81
  197. data/doc/rdoc/classes/ConditionVariable.html +59 -59
  198. data/doc/rdoc/classes/Exception.html +11 -11
  199. data/doc/rdoc/classes/GC.html +4 -4
  200. data/doc/rdoc/classes/IO.html +14 -14
  201. data/doc/rdoc/classes/PhusionPassenger.html +75 -20
  202. data/doc/rdoc/classes/PhusionPassenger/AbstractInstaller.html +153 -0
  203. data/doc/rdoc/classes/PhusionPassenger/AbstractRequestHandler.html +125 -130
  204. data/doc/rdoc/classes/PhusionPassenger/AbstractServer.html +236 -236
  205. data/doc/rdoc/classes/PhusionPassenger/AbstractServerCollection.html +213 -213
  206. data/doc/rdoc/classes/PhusionPassenger/AdminTools.html +28 -28
  207. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ControlProcess.html +91 -75
  208. data/doc/rdoc/classes/PhusionPassenger/AppInitError.html +10 -10
  209. data/doc/rdoc/classes/PhusionPassenger/Application.html +64 -64
  210. data/doc/rdoc/classes/PhusionPassenger/ConsoleTextTemplate.html +34 -34
  211. data/doc/rdoc/classes/PhusionPassenger/FrameworkInitError.html +13 -13
  212. data/doc/rdoc/classes/PhusionPassenger/HTMLTemplate.html +30 -30
  213. data/doc/rdoc/classes/PhusionPassenger/InitializationError.html +10 -10
  214. data/doc/rdoc/classes/PhusionPassenger/MessageChannel.html +136 -136
  215. data/doc/rdoc/classes/PhusionPassenger/NativeSupport.html +24 -24
  216. data/doc/rdoc/classes/PhusionPassenger/Rack/ApplicationSpawner.html +42 -42
  217. data/doc/rdoc/classes/PhusionPassenger/Rack/RequestHandler.html +55 -53
  218. data/doc/rdoc/classes/PhusionPassenger/Railz.html +1 -1
  219. data/doc/rdoc/classes/PhusionPassenger/Railz/ApplicationSpawner.html +25 -30
  220. data/doc/rdoc/classes/PhusionPassenger/Railz/CGIFixed.html +23 -23
  221. data/doc/rdoc/classes/PhusionPassenger/Railz/FrameworkSpawner.html +116 -117
  222. data/doc/rdoc/classes/PhusionPassenger/Railz/RequestHandler.html +22 -22
  223. data/doc/rdoc/classes/PhusionPassenger/SpawnManager.html +118 -124
  224. data/doc/rdoc/classes/PhusionPassenger/UnknownError.html +10 -10
  225. data/doc/rdoc/classes/PhusionPassenger/Utils.html +354 -354
  226. data/doc/rdoc/classes/PhusionPassenger/VersionNotFound.html +9 -9
  227. data/doc/rdoc/classes/PhusionPassenger/WSGI/ApplicationSpawner.html +37 -37
  228. data/doc/rdoc/classes/PlatformInfo.html +282 -261
  229. data/doc/rdoc/classes/RakeExtensions.html +7 -7
  230. data/doc/rdoc/classes/Signal.html +26 -26
  231. data/doc/rdoc/created.rid +1 -1
  232. data/doc/rdoc/files/DEVELOPERS_TXT.html +6 -1
  233. data/doc/rdoc/files/README.html +15 -6
  234. data/doc/rdoc/files/ext/phusion_passenger/native_support_c.html +1 -1
  235. data/doc/rdoc/files/lib/phusion_passenger/abstract_installer_rb.html +129 -0
  236. data/doc/rdoc/files/lib/phusion_passenger/abstract_request_handler_rb.html +20 -13
  237. data/doc/rdoc/files/lib/phusion_passenger/abstract_server_collection_rb.html +19 -13
  238. data/doc/rdoc/files/lib/phusion_passenger/abstract_server_rb.html +19 -13
  239. data/doc/rdoc/files/lib/phusion_passenger/admin_tools/control_process_rb.html +31 -1
  240. data/doc/rdoc/files/lib/phusion_passenger/admin_tools_rb.html +31 -1
  241. data/doc/rdoc/files/lib/phusion_passenger/application_rb.html +19 -13
  242. data/doc/rdoc/files/lib/phusion_passenger/console_text_template_rb.html +19 -13
  243. data/doc/rdoc/files/lib/phusion_passenger/constants_rb.html +21 -12
  244. data/doc/rdoc/files/lib/phusion_passenger/dependencies_rb.html +19 -13
  245. data/doc/rdoc/files/lib/phusion_passenger/events_rb.html +19 -13
  246. data/doc/rdoc/files/lib/phusion_passenger/exceptions_rb.html +19 -13
  247. data/doc/rdoc/files/lib/phusion_passenger/html_template_rb.html +19 -13
  248. data/doc/rdoc/files/lib/phusion_passenger/message_channel_rb.html +19 -13
  249. data/doc/rdoc/files/lib/phusion_passenger/packaging_rb.html +122 -0
  250. data/doc/rdoc/files/lib/phusion_passenger/platform_info_rb.html +19 -13
  251. data/doc/rdoc/files/lib/phusion_passenger/rack/application_spawner_rb.html +22 -12
  252. data/doc/rdoc/files/lib/phusion_passenger/rack/request_handler_rb.html +21 -12
  253. data/doc/rdoc/files/lib/phusion_passenger/railz/application_spawner_rb.html +19 -13
  254. data/doc/rdoc/files/lib/phusion_passenger/railz/cgi_fixed_rb.html +1 -1
  255. data/doc/rdoc/files/lib/phusion_passenger/railz/framework_spawner_rb.html +19 -13
  256. data/doc/rdoc/files/lib/phusion_passenger/railz/request_handler_rb.html +21 -12
  257. data/doc/rdoc/files/lib/phusion_passenger/simple_benchmarking_rb.html +19 -13
  258. data/doc/rdoc/files/lib/phusion_passenger/spawn_manager_rb.html +19 -13
  259. data/doc/rdoc/files/lib/phusion_passenger/utils_rb.html +27 -21
  260. data/doc/rdoc/files/lib/phusion_passenger/wsgi/application_spawner_rb.html +21 -12
  261. data/doc/rdoc/files/misc/rake/extensions_rb.html +21 -12
  262. data/doc/rdoc/fr_class_index.html +1 -0
  263. data/doc/rdoc/fr_file_index.html +2 -0
  264. data/doc/rdoc/fr_method_index.html +116 -112
  265. data/doc/users_guide_snippets/analysis_and_system_maintenance_tools.txt +144 -0
  266. data/doc/users_guide_snippets/appendix_a_about.txt +13 -0
  267. data/doc/users_guide_snippets/appendix_b_terminology.txt +63 -0
  268. data/doc/users_guide_snippets/appendix_c_spawning_methods.txt +304 -0
  269. data/doc/users_guide_snippets/global_queueing_explained.txt +78 -0
  270. data/doc/users_guide_snippets/rackup_specifications.txt +75 -0
  271. data/doc/users_guide_snippets/rails_spawn_method.txt +48 -0
  272. data/doc/users_guide_snippets/tips.txt +173 -0
  273. data/ext/apache2/Bucket.cpp +17 -12
  274. data/ext/apache2/Bucket.h +17 -12
  275. data/ext/apache2/Configuration.cpp +17 -12
  276. data/ext/apache2/Configuration.h +27 -14
  277. data/ext/apache2/DirectoryMapper.h +21 -12
  278. data/ext/apache2/Hooks.cpp +67 -21
  279. data/ext/apache2/Hooks.h +17 -12
  280. data/ext/apache2/mod_passenger.c +17 -12
  281. data/ext/{apache2 → common}/Application.h +19 -14
  282. data/ext/{apache2 → common}/ApplicationPool.h +17 -12
  283. data/ext/{apache2 → common}/ApplicationPoolServer.h +18 -72
  284. data/ext/{apache2 → common}/ApplicationPoolServerExecutable.cpp +45 -104
  285. data/ext/common/ApplicationPoolStatusReporter.h +212 -0
  286. data/ext/{apache2 → common}/CachedFileStat.cpp +17 -12
  287. data/ext/{apache2 → common}/CachedFileStat.h +17 -12
  288. data/ext/{apache2 → common}/DummySpawnManager.h +17 -12
  289. data/ext/{apache2 → common}/Exceptions.h +17 -12
  290. data/ext/{apache2 → common}/FileChecker.h +17 -12
  291. data/ext/common/Logging.cpp +65 -0
  292. data/ext/{apache2 → common}/Logging.h +17 -12
  293. data/ext/{apache2 → common}/MessageChannel.h +17 -12
  294. data/ext/{apache2 → common}/PoolOptions.h +17 -12
  295. data/ext/{apache2 → common}/SpawnManager.h +17 -12
  296. data/ext/{apache2 → common}/StandardApplicationPool.h +17 -12
  297. data/ext/common/StaticString.h +147 -0
  298. data/ext/common/SystemTime.cpp +33 -0
  299. data/ext/{apache2 → common}/SystemTime.h +17 -12
  300. data/ext/{apache2 → common}/Utils.cpp +69 -12
  301. data/ext/{apache2 → common}/Utils.h +41 -12
  302. data/ext/nginx/Configuration.c +1091 -0
  303. data/ext/nginx/Configuration.h +71 -0
  304. data/ext/nginx/ContentHandler.c +1154 -0
  305. data/ext/nginx/ContentHandler.h +64 -0
  306. data/ext/nginx/HelperServer.cpp +857 -0
  307. data/ext/nginx/HttpStatusExtractor.h +161 -0
  308. data/ext/nginx/ScgiRequestParser.h +317 -0
  309. data/ext/nginx/StaticContentHandler.c +222 -0
  310. data/ext/nginx/StaticContentHandler.h +37 -0
  311. data/ext/nginx/config +41 -0
  312. data/ext/nginx/ngx_http_passenger_module.c +572 -0
  313. data/ext/nginx/ngx_http_passenger_module.h +72 -0
  314. data/ext/oxt/backtrace.cpp +8 -1
  315. data/ext/oxt/system_calls.cpp +40 -0
  316. data/ext/oxt/system_calls.hpp +14 -7
  317. data/ext/phusion_passenger/extconf.rb +17 -12
  318. data/ext/phusion_passenger/native_support.c +19 -12
  319. data/lib/phusion_passenger/abstract_installer.rb +196 -0
  320. data/lib/phusion_passenger/abstract_request_handler.rb +19 -24
  321. data/lib/phusion_passenger/abstract_server.rb +17 -12
  322. data/lib/phusion_passenger/abstract_server_collection.rb +17 -12
  323. data/lib/phusion_passenger/admin_tools.rb +23 -0
  324. data/lib/phusion_passenger/admin_tools/control_process.rb +39 -13
  325. data/lib/phusion_passenger/application.rb +17 -12
  326. data/lib/phusion_passenger/console_text_template.rb +17 -12
  327. data/lib/phusion_passenger/constants.rb +22 -11
  328. data/lib/phusion_passenger/dependencies.rb +47 -12
  329. data/lib/phusion_passenger/events.rb +17 -12
  330. data/lib/phusion_passenger/exceptions.rb +17 -12
  331. data/lib/phusion_passenger/html_template.rb +17 -12
  332. data/lib/phusion_passenger/message_channel.rb +17 -12
  333. data/lib/phusion_passenger/packaging.rb +39 -0
  334. data/lib/phusion_passenger/platform_info.rb +48 -22
  335. data/lib/phusion_passenger/rack/application_spawner.rb +22 -11
  336. data/lib/phusion_passenger/rack/request_handler.rb +21 -12
  337. data/lib/phusion_passenger/railz/application_spawner.rb +23 -23
  338. data/lib/phusion_passenger/railz/framework_spawner.rb +18 -14
  339. data/lib/phusion_passenger/railz/request_handler.rb +18 -11
  340. data/lib/phusion_passenger/simple_benchmarking.rb +17 -12
  341. data/lib/phusion_passenger/spawn_manager.rb +17 -20
  342. data/lib/phusion_passenger/templates/{apache_must_be_compiled_with_compatible_mpm.txt.erb → apache2/apache_must_be_compiled_with_compatible_mpm.txt.erb} +0 -0
  343. data/lib/phusion_passenger/templates/{apache2_config_snippets.txt.erb → apache2/config_snippets.txt.erb} +0 -0
  344. data/lib/phusion_passenger/templates/{deployment_example.txt.erb → apache2/deployment_example.txt.erb} +0 -0
  345. data/lib/phusion_passenger/templates/{no_write_permission_to_passenger_root.txt.erb → apache2/no_write_permission_to_passenger_root.txt.erb} +0 -0
  346. data/lib/phusion_passenger/templates/{possible_solutions_for_compilation_and_installation_problems.txt.erb → apache2/possible_solutions_for_compilation_and_installation_problems.txt.erb} +0 -0
  347. data/lib/phusion_passenger/templates/{run_installer_as_root.txt.erb → apache2/run_installer_as_root.txt.erb} +0 -0
  348. data/lib/phusion_passenger/templates/{welcome.txt.erb → apache2/welcome.txt.erb} +0 -0
  349. data/lib/phusion_passenger/templates/nginx/ask_for_extra_configure_flags.txt.erb +8 -0
  350. data/lib/phusion_passenger/templates/nginx/cannot_write_to_dir.txt.erb +11 -0
  351. data/lib/phusion_passenger/templates/nginx/config_snippets.txt.erb +17 -0
  352. data/lib/phusion_passenger/templates/nginx/config_snippets_inserted.txt.erb +20 -0
  353. data/lib/phusion_passenger/templates/nginx/confirm_extra_configure_flags.txt.erb +5 -0
  354. data/lib/phusion_passenger/templates/nginx/deployment_example.txt.erb +22 -0
  355. data/lib/phusion_passenger/templates/nginx/pcre_could_not_be_downloaded.txt.erb +11 -0
  356. data/lib/phusion_passenger/templates/nginx/pcre_could_not_be_extracted.txt.erb +11 -0
  357. data/lib/phusion_passenger/templates/nginx/possible_solutions_for_compilation_and_installation_problems.txt.erb +11 -0
  358. data/lib/phusion_passenger/templates/nginx/possible_solutions_for_download_and_extraction_problems.txt.erb +20 -0
  359. data/lib/phusion_passenger/templates/nginx/query_download_and_install.txt.erb +21 -0
  360. data/lib/phusion_passenger/templates/nginx/run_installer_as_root.txt.erb +8 -0
  361. data/lib/phusion_passenger/templates/nginx/welcome.txt.erb +15 -0
  362. data/lib/phusion_passenger/utils.rb +20 -15
  363. data/lib/phusion_passenger/wsgi/application_spawner.rb +18 -11
  364. data/lib/phusion_passenger/wsgi/request_handler.py +23 -0
  365. data/misc/copy_boost_headers.rb +23 -0
  366. data/misc/find_owner_pipe_leaks.rb +18 -11
  367. data/misc/rake/cplusplus.rb +18 -11
  368. data/misc/rake/extensions.rb +21 -14
  369. data/misc/render_error_pages.rb +18 -11
  370. data/test/ApplicationPoolServerTest.cpp +1 -3
  371. data/test/ApplicationPoolServer_ApplicationPoolTest.cpp +1 -1
  372. data/test/CxxTestMain.cpp +19 -3
  373. data/test/HttpStatusExtractorTest.cpp +181 -0
  374. data/test/ScgiRequestParserTest.cpp +337 -0
  375. data/test/StaticStringTest.cpp +51 -0
  376. data/test/UtilsTest.cpp +32 -0
  377. data/test/config.yml.example +5 -0
  378. data/test/{integration_tests.rb → integration_tests/apache2_tests.rb} +7 -299
  379. data/test/integration_tests/hello_world_rack_spec.rb +36 -0
  380. data/test/integration_tests/hello_world_wsgi_spec.rb +41 -0
  381. data/test/integration_tests/mycook_spec.rb +192 -0
  382. data/test/integration_tests/nginx_tests.rb +98 -0
  383. data/test/ruby/rack/application_spawner_spec.rb +40 -0
  384. data/test/stub/nginx/koi-utf +109 -0
  385. data/test/stub/nginx/koi-win +103 -0
  386. data/test/stub/nginx/mime.types +70 -0
  387. data/test/stub/nginx/nginx.conf.erb +57 -0
  388. data/test/stub/nginx/win-utf +126 -0
  389. data/test/stub/rails_apps/mycook/app/controllers/uploads_controller.rb +4 -0
  390. data/test/stub/rails_apps/mycook/config/routes.rb +1 -1
  391. data/test/stub/wsgi/passenger_wsgi.pyc +0 -0
  392. data/test/support/Support.h +40 -0
  393. data/test/support/nginx_controller.rb +98 -0
  394. data/test/support/test_helper.rb +79 -0
  395. metadata +1091 -1028
  396. data/benchmark/DummyRequestHandler.cpp +0 -101
  397. data/ext/apache2/Logging.cpp +0 -60
  398. data/ext/apache2/SystemTime.cpp +0 -28
@@ -0,0 +1,776 @@
1
+ = Phusion Passenger users guide, Nginx version =
2
+
3
+ image:images/phusion_banner.png[link="http://www.phusion.nl/"]
4
+
5
+ Phusion Passenger is an Nginx module, which makes deploying Ruby and Ruby on
6
+ Rails applications on Nginx a breeze. It follows the usual Ruby on Rails
7
+ conventions, such as "Don't-Repeat-Yourself" and ease of setup, while at the
8
+ same time providing enough flexibility.
9
+
10
+ This users guide will teach you:
11
+
12
+ - How to install Nginx with Phusion Passenger support.
13
+ - How to configure Phusion Passenger.
14
+ - How to deploy a Ruby on Rails application.
15
+ - How to deploy a link:http://rack.rubyforge.org/[Rack]-based Ruby application.
16
+ - How to solve common problems.
17
+
18
+ This guide assumes that the reader is somewhat familiar with Nginx and with
19
+ using the commandline.
20
+
21
+
22
+ == Supported operating systems ==
23
+
24
+ Phusion Passenger works on any POSIX-compliant operating system. In other
25
+ words: practically any operating system on earth, except Microsoft Windows.
26
+
27
+ Phusion Passenger for Nginx has been tested on:
28
+
29
+ - Ubuntu Linux 8.04 (x86)
30
+ - Gentoo Linux (AMD64)
31
+ - MacOS X Leopard (x86)
32
+
33
+ Other operating systems have not been tested, but Phusion Passenger will probably
34
+ work fine on them. Please
35
+ link:http://code.google.com/p/phusion-passenger/issues/list[report a bug]
36
+ or
37
+ link:http://groups.google.com/group/phusion-passenger[join our discussion list]
38
+ if it doesn't.
39
+
40
+
41
+ [[install_passenger]]
42
+ == Installing Phusion Passenger ==
43
+
44
+ === Overview ===
45
+
46
+ As you might already know, Nginx does not support loadable modules, in contrast
47
+ to most other web servers (e.g. Apache). Therefore, to install Phusion Passenger
48
+ for Nginx, one must recompile and reinstall Nginx with Phusion Passenger support.
49
+ There are two ways to do this:
50
+
51
+ 1. By running the Phusion Passenger installer for Nginx. This installer will
52
+ guide you through the entire installation process, including downloading,
53
+ compiling and installing Nginx. You should be able to get Nginx with Phusion
54
+ Passenger support up-and-running in a matter of minutes. This is the
55
+ recommended installation method.
56
+ 2. By manually configuring and compiling Nginx with Phusion Passenger support,
57
+ through Nginx's `--add-module` configure option. Generally, using our
58
+ installer is easier, so you should only use this method if you're already
59
+ familiar with compiling Nginx.
60
+
61
+ TIP: You might have to run the installation commands in the following sections
62
+ as 'root'. If the installer fails because of permission errors, it will tell
63
+ you.
64
+
65
+ [[specifying_ruby_installation]]
66
+ === Specifying the correct Ruby installation ===
67
+
68
+ If your system has multiple Ruby installations -- which is likely the case on
69
+ MacOS X, or if you've also installed
70
+ link:http://www.rubyenterpriseedition.com[Ruby Enterprise Edition] -- then you
71
+ will need to tell the operating system which Ruby installation to use, prior to
72
+ running the Phusion Passenger installer. If you only have one Ruby installation
73
+ (the case on most Linux systems), then you can skip this section because Phusion
74
+ Passenger will automatically detect it.
75
+
76
+ To specify a Ruby installation, prepend your Ruby installation's `bin`
77
+ directory to the `PATH` environment variable. For example, if you have the
78
+ following Ruby installations:
79
+
80
+ - /usr/bin/ruby
81
+ - /opt/myruby/bin/ruby
82
+
83
+ and you want to use the latter, then type:
84
+
85
+ ----------------------------------
86
+ export PATH=/opt/myruby/bin:$PATH
87
+ ----------------------------------
88
+
89
+ === Installing Phusion Passenger for Nginx through the installer ===
90
+
91
+ ==== Obtaining the Phusion Passenger files and running the installer ====
92
+
93
+ You must obtain the Phusion Passenger files in order to run the installer.
94
+ This can be done either by installing the Phusion Passenger gem, or by
95
+ downloading the source tarball.
96
+
97
+ ===== Gem =====
98
+
99
+ First, install the Phusion Passenger gem by running:
100
+
101
+ ---------------------------------
102
+ gem install passenger
103
+ ---------------------------------
104
+
105
+ Next, run the Phusion Passenger installer for Nginx:
106
+
107
+ ---------------------------------
108
+ passenger-install-nginx-module
109
+ ---------------------------------
110
+
111
+ Please follow the instructions given by the installer.
112
+
113
+ ===== Source tarball =====
114
+
115
+ The source tarball can be download from the
116
+ link:http://www.modrails.com/[Phusion Passenger website]. Extract the tarball to
117
+ whatever location you prefer. *The Phusion Passenger files are to reside in that
118
+ location permanently.* For example, if you would like Phusion Passenger to
119
+ reside in `/opt/passenger-x.x.x`, then type:
120
+
121
+ --------------------------------------------------------------
122
+ cd /opt
123
+ tar xzvf ~/YourDownloadsFolder/passenger-x.x.x.tar.gz
124
+ --------------------------------------------------------------
125
+
126
+ Next, run the Phusion Passenger installer for Nginx:
127
+
128
+ --------------------------------------------------------------
129
+ /opt/passenger-x.x.x/bin/passenger-install-nginx-module
130
+ --------------------------------------------------------------
131
+
132
+ Please follow the instructions given by the installer.
133
+
134
+ IMPORTANT: Please do not remove the passenger-x.x.x folder after installation.
135
+ Furthermore, the passenger-x.x.x folder must be accessible by Nginx.
136
+
137
+ ==== Non-interactive/automatic installation ====
138
+
139
+ By default, the installer is interactive. If you want to automate installation,
140
+ then you can do so by passing various answers to the installer through command
141
+ line options.
142
+
143
+ Please run the installer with `--help` for a list of available command line
144
+ options.
145
+
146
+ === Installing Phusion Passenger for Nginx manually ===
147
+
148
+ You can also install Phusion Passenger the way you install any other Nginx module.
149
+ To do this, run Nginx's configure script with `--add-module=/path-to-passenger-root/ext/nginx`.
150
+
151
+ If you installed Phusion Passenger via the gem, then 'path-to-passenger-root'
152
+ can be obtained with the command:
153
+
154
+ --------------------------
155
+ passenger-config --root
156
+ --------------------------
157
+
158
+ This will probably output something along the lines of '/usr/lib/ruby/gems/1.8/gems/passenger-x.x.x',
159
+ so you'll probably have to specify something like `--add-module=/usr/lib/ruby/gems/1.8/gems/passenger-x.x.x/ext/nginx`.
160
+
161
+ If you installed Phusion Passenger via a source tarball, then 'path-to-passenger-root'
162
+ is the directory which contains the Phusion Passenger source code. So if you
163
+ extracted the Phusion Passenger source code to '/opt/passenger-x.x.x', then you'll
164
+ have to specify `--add-module=/opt/passenger-x.x.x/ext/nginx`.
165
+
166
+
167
+ [[deploying_a_ror_app]]
168
+ == Deploying a Ruby on Rails application ==
169
+
170
+ Suppose you have a Ruby on Rails application in '/webapps/mycook', and you own
171
+ the domain 'www.mycook.com'. You can either deploy your application to the
172
+ virtual host's root (i.e. the application will be accessible from the root URL,
173
+ 'http://www.mycook.com/'), or in a sub URI (i.e. the application will be
174
+ accessible from a sub URL, such as 'http://www.mycook.com/railsapplication').
175
+
176
+ NOTE: The default `RAILS_ENV` environment in which deployed Rails applications
177
+ are run, is ``production''. You can change this by changing the
178
+ <<RailsEnv,rails_env>> configuration option.
179
+
180
+ === Deploying to a virtual host's root ===
181
+
182
+ Add a 'server' virtual host entry to your Nginx configuration file. The virtual
183
+ host's root must point to your Ruby on Rails application's 'public' folder.
184
+
185
+ Inside the 'server' block, set 'passenger_enabled on'.
186
+
187
+ For example:
188
+ -------------------------------------------
189
+ http {
190
+ ...
191
+
192
+ server {
193
+ listen 80;
194
+ server_name www.mycook.com;
195
+ root /webapps/mycook/public;
196
+ passenger_enabled on;
197
+ }
198
+
199
+ ...
200
+ }
201
+ -------------------------------------------
202
+ Then restart Nginx. The application has now been deployed.
203
+
204
+ [[deploying_rails_to_sub_uri]]
205
+ === Deploying to a sub URI ===
206
+
207
+ Suppose that you already have a 'server' virtual host entry:
208
+
209
+ -------------------------------------------
210
+ http {
211
+ ...
212
+
213
+ server {
214
+ listen 80;
215
+ server_name www.phusion.nl;
216
+ root /websites/phusion;
217
+ }
218
+
219
+ ...
220
+ }
221
+ -------------------------------------------
222
+
223
+ And you want your Ruby on Rails application to be accessible from the URL
224
+ 'http://www.phusion.nl/rails'.
225
+
226
+ To do this, make a symlink from your Ruby on Rails application's 'public'
227
+ folder to a directory in the document root. For example:
228
+ -------------------------------------------
229
+ ln -s /webapps/mycook/public /websites/phusion/rails
230
+ -------------------------------------------
231
+
232
+ Next, set 'passenger_enabled on' and add a <<PassengerBaseURI,passenger_base_uri>>
233
+ option to the 'server' block:
234
+ -------------------------------------------
235
+ http {
236
+ ...
237
+
238
+ server {
239
+ listen 80;
240
+ server_name www.phusion.nl;
241
+ root /websites/phusion;
242
+ passenger_enabled on; # <--- These lines have
243
+ passenger_base_uri /rails; # <--- been added.
244
+ }
245
+
246
+ ...
247
+ }
248
+ -------------------------------------------
249
+ Then restart Nginx. The application has now been deployed.
250
+
251
+ [TIP]
252
+ ======================================
253
+ You can deploy multiple Rails applications under a virtual host, by specifying
254
+ <<PassengerBaseURI,passenger_base_uri>> multiple times. For example:
255
+ ---------------------------------
256
+ server {
257
+ ...
258
+ passenger_base_uri /app1;
259
+ passenger_base_uri /app2;
260
+ passenger_base_uri /app3;
261
+ }
262
+ ---------------------------------
263
+ ======================================
264
+
265
+ === Redeploying (restarting the Ruby on Rails application) ===
266
+
267
+ Deploying a new version of a Ruby on Rails application is as simple as
268
+ re-uploading the application files, and restarting the application.
269
+
270
+ There are two ways to restart the application:
271
+
272
+ 1. By restarting Nginx.
273
+ 2. By creating or modifying the file 'tmp/restart.txt' in the Rails
274
+ application's <<application_root,root folder>>. Phusion Passenger will
275
+ automatically restart the application.
276
+
277
+ For example, to restart our example MyCook application, we type this in the
278
+ command line:
279
+ -------------------------------------------
280
+ touch /webapps/mycook/tmp/restart.txt
281
+ -------------------------------------------
282
+
283
+ === Migrations ===
284
+
285
+ Phusion Passenger is not related to Ruby on Rails migrations in any way. To
286
+ run migrations on your deployment server, please login to your deployment
287
+ server (e.g. with 'ssh') and type `rake db:migrate RAILS_ENV=production` in
288
+ a shell console, just like one would normally run migrations.
289
+
290
+ === Capistrano integration ===
291
+
292
+ See <<capistrano,Capistrano recipe>>.
293
+
294
+
295
+ [[deploying_a_rack_app]]
296
+ == Deploying a Rack-based Ruby application ==
297
+
298
+ Phusion Passenger supports arbitrary Ruby web applications that follow the
299
+ link:http://rack.rubyforge.org/[Rack] interface.
300
+
301
+ Phusion Passenger assumes that Rack application directories have a certain layout.
302
+ Suppose that you have a Rack application in '/webapps/rackapp'. Then that
303
+ folder must contain at least three entries:
304
+
305
+ - 'config.ru', a Rackup file for starting the Rack application. This file must contain
306
+ the complete logic for initializing the application.
307
+ - 'public/', a folder containing public static web assets, like images and stylesheets.
308
+ - 'tmp/', used for 'restart.txt' (our application restart mechanism). This will
309
+ be explained in a following subsection.
310
+
311
+ So '/webapps/rackapp' must, at minimum, look like this:
312
+ ----------------------
313
+ /webapps/rackapp
314
+ |
315
+ +-- config.ru
316
+ |
317
+ +-- public/
318
+ |
319
+ +-- tmp/
320
+ ----------------------
321
+
322
+ Suppose you own the domain 'www.rackapp.com'. You can either deploy your application
323
+ to the virtual host's root (i.e. the application will be accessible from the root URL,
324
+ 'http://www.rackapp.com/'), or in a sub URI (i.e. the application will be
325
+ accessible from a sub URL, such as 'http://www.rackapp.com/rackapp').
326
+
327
+ NOTE: The default `RACK_ENV` environment in which deployed Rack applications
328
+ are run, is ``production''. You can change this by changing the
329
+ <<RackEnv,rack_env>> configuration option.
330
+
331
+ === Tutorial/example: writing and deploying a Hello World Rack application ===
332
+
333
+ First we create a Phusion Passenger-compliant Rack directory structure:
334
+
335
+ -------------------------------------------
336
+ $ mkdir /webapps/rack_example
337
+ $ mkdir /webapps/rack_example/public
338
+ $ mkdir /webapps/rack_example/tmp
339
+ -------------------------------------------
340
+
341
+ Next, we write a minimal "hello world" Rack application:
342
+
343
+ -------------------------------------------
344
+ $ cd /webapps/rack_example
345
+ $ some_awesome_editor config.ru
346
+ ...type in some source code...
347
+ $ cat config.ru
348
+ app = proc do |env|
349
+ return [200, { "Content-Type" => "text/html" }, "hello <b>world</b>"]
350
+ end
351
+ run app
352
+ -------------------------------------------
353
+
354
+ Finally, we deploy it by adding the following configuration options to
355
+ the Apache configuration file:
356
+
357
+ -------------------------------------------
358
+ http {
359
+ ...
360
+ server {
361
+ listen 80;
362
+ server_name www.rackexample.com;
363
+ root /webapps/rack_example/public;
364
+ passenger_enabled on;
365
+ }
366
+ ...
367
+ }
368
+ -------------------------------------------
369
+
370
+ And we're done! After an Nginx restart, the above Rack application will be available
371
+ under the URL 'http://www.rackexample.com/'.
372
+
373
+ === Deploying to a virtual host's root ===
374
+
375
+ Add a 'server' virtual host entry to your Nginx configuration file. The virtual host's
376
+ root must point to your Rack application's 'public' folder. You must also set
377
+ 'passenger_enabled on' in the 'server' block.
378
+
379
+ For example:
380
+ -------------------------------------------
381
+ http {
382
+ ...
383
+ server {
384
+ listen 80;
385
+ server_name www.rackapp.com;
386
+ root /webapps/rackapp/public;
387
+ passenger_enabled on;
388
+ }
389
+ ...
390
+ }
391
+ -------------------------------------------
392
+ Then restart Nginx. The application has now been deployed.
393
+
394
+ [[deploying_rack_to_sub_uri]]
395
+ === Deploying to a sub URI ===
396
+
397
+ Suppose that you already have a virtual host:
398
+
399
+ -------------------------------------------
400
+ http {
401
+ ...
402
+
403
+ server {
404
+ listen 80;
405
+ server_name www.phusion.nl;
406
+ root /websites/phusion;
407
+ passenger_enabled on;
408
+ }
409
+
410
+ ...
411
+ }
412
+ -------------------------------------------
413
+
414
+ And you want your Rack application to be accessible from the URL
415
+ 'http://www.phusion.nl/rack'.
416
+
417
+ To do this, make a symlink from your Rack application's 'public'
418
+ folder to a directory in the document root. For example:
419
+ -------------------------------------------
420
+ ln -s /webapps/rackapp/public /websites/phusion/rack
421
+ -------------------------------------------
422
+
423
+ Next, set 'passenger_enabled on' and add a <<PassengerBaseURI,passenger_base_uri>>
424
+ option to the 'server' block:
425
+ -------------------------------------------
426
+ http {
427
+ ...
428
+
429
+ server {
430
+ listen 80;
431
+ server_name www.phusion.nl;
432
+ root /websites/phusion;
433
+ passenger_enabled on; # <--- These lines have
434
+ passenger_base_uri /rack; # <--- been added.
435
+ }
436
+
437
+ ...
438
+ }
439
+ -------------------------------------------
440
+ Then restart Apache. The application has now been deployed.
441
+
442
+ [TIP]
443
+ ======================================
444
+ You can deploy multiple Rack applications under a virtual host, by specifying
445
+ <<PassengerBaseURI,passenger_base_uri>> multiple times. For example:
446
+ ---------------------------------
447
+ server {
448
+ ...
449
+ passenger_base_uri /app1;
450
+ passenger_base_uri /app2;
451
+ passenger_base_uri /app3;
452
+ }
453
+ ---------------------------------
454
+ ======================================
455
+
456
+ === Redeploying (restarting the Rack application) ===
457
+
458
+ Deploying a new version of a Rack application is as simple as
459
+ re-uploading the application files, and restarting the application.
460
+
461
+ There are two ways to restart the application:
462
+
463
+ 1. By restarting Nginx.
464
+ 2. By creating or modifying the file 'tmp/restart.txt' in the Rack
465
+ application's <<application_root,root folder>>. Phusion Passenger will
466
+ automatically restart the application.
467
+
468
+ For example, to restart our example application, we type this in the
469
+ command line:
470
+ -------------------------------------------
471
+ touch /webapps/rackapp/tmp/restart.txt
472
+ -------------------------------------------
473
+
474
+ === Rackup specifications for various web frameworks ===
475
+ include::users_guide_snippets/rackup_specifications.txt[]
476
+
477
+
478
+ == Configuring Phusion Passenger ==
479
+
480
+ After installation, Phusion Passenger does not need any further configurations.
481
+ Nevertheless, the system administrator may be interested in changing
482
+ Phusion Passenger's behavior. Phusion Passenger supports the following configuration
483
+ options in the Nginx configuration file:
484
+
485
+ === passenger_root <directory> ===
486
+ The location to the Phusion Passenger root directory. This configuration option
487
+ is essential to Phusion Passenger, and allows Phusion Passenger to locate its own
488
+ data files. The correct value is given by the installer.
489
+
490
+ If you've moved Phusion Passenger to a different directory then you need to update
491
+ this option as well. Please read
492
+ <<moving_phusion_passenger,Moving Phusion Passenger to a different directory>> for more information.
493
+
494
+ This required option may only occur once, in the 'http' configuration block.
495
+
496
+ === passenger_log_level <integer> ===
497
+ This option allows one to specify how much information Phusion Passenger should
498
+ write to the Apache error log file. A higher log level value means that more
499
+ information will be logged.
500
+
501
+ Possible values are:
502
+
503
+ - '0': Show only errors and warnings.
504
+ - '1': Show the most important debugging information. This might be useful for
505
+ system administrators who are trying to figure out the cause of a
506
+ problem.
507
+ - '2': Show more debugging information. This is typically only useful for developers.
508
+ - '3': Show even more debugging information.
509
+
510
+ This option may only occur once, in the 'http' configuration block.
511
+ The default is '0'.
512
+
513
+ === passenger_ruby <filename> ===
514
+ This option allows one to specify the Ruby interpreter to use.
515
+
516
+ This option may only occur once, in the 'http' configuration block.
517
+ The default is 'ruby'.
518
+
519
+ [[PassengerUseGlobalQueue]]
520
+ === passenger_use_global_queue <on|off> ===
521
+ Turns the use of global queuing on or off.
522
+
523
+ This option may occur in the following places:
524
+
525
+ * In a 'server' configuration block.
526
+ * In a 'location' configuration block.
527
+ * In an 'if' configuration scope.
528
+
529
+ In each place, it may be specified at most once. The default value is 'off'.
530
+
531
+ 'This feature is sponsored by http://www.37signals.com/[37signals].'
532
+
533
+ include::users_guide_snippets/global_queueing_explained.txt[]
534
+
535
+ [[PassengerUserSwitching]]
536
+ === passenger_user_switching <on|off> ===
537
+ Whether to enable <<user_switching,user switching support>>.
538
+
539
+ This option may only occur once, in the 'http' configuration block.
540
+ The default value is 'on'.
541
+
542
+ [[PassengerDefaultUser]]
543
+ === passenger_default_user <username> ===
544
+ Phusion Passenger enables <<user_switching,user switching support>> by default.
545
+ This configuration option allows one to specify which user Rails/Rack
546
+ applications must run as, if user switching fails or is disabled.
547
+
548
+ This option may only occur once, in the 'http' configuration block.
549
+ The default value is 'nobody'.
550
+
551
+ === Important deployment options
552
+ ==== passenger_enabled <on|off> ====
553
+ This option may be specified in a 'server' configuration block, a
554
+ 'location' configuration block or an 'if' configuration scope, to
555
+ enable or disable Phusion Passenger for that server or that location.
556
+
557
+ Phusion Passenger is disabled by default, so you must explicitly enable
558
+ it for server blocks that you wish to serve through Phusion Passenger.
559
+ Please see <<deploying_a_ror_app,Deploying a Ruby on Rails application>>
560
+ and <<deploying_a_rack_app,Deploying a Rack-based Ruby application>>
561
+ for examples.
562
+
563
+ [[PassengerBaseURI]]
564
+ ==== passenger_base_uri <uri> ====
565
+ Used to specify that the given URI is an distinct application that should
566
+ be served by Phusion Passenger. This option can be used for both Rails and
567
+ Rack applications. See <<deploying_rails_to_sub_uri,Deploying Rails to a sub URI>>
568
+ for an example.
569
+
570
+ It is allowed to specify this option multiple times. Do this to deploy multiple
571
+ applications in different sub-URIs under the same virtual host.
572
+
573
+ This option may occur in the following places:
574
+
575
+ * In a 'server' configuration block.
576
+ * In a 'location' configuration block.
577
+ * In an 'if' configuration scope.
578
+
579
+ === Resource control and optimization options ===
580
+ [[PassengerMaxPoolSize]]
581
+ ==== passenger_max_pool_size <integer> ====
582
+ The maximum number of Ruby on Rails or Rack application instances that may
583
+ be simultaneously active. A larger number results in higher memory usage,
584
+ but improved ability to handle concurrent HTTP clients.
585
+
586
+ The optimal value depends on your system's hardware and the server's average
587
+ load. You should experiment with different values. But generally speaking,
588
+ the value should be at least equal to the number of CPUs (or CPU cores) that
589
+ you have. If your system has 2 GB of RAM, then we recommend a value of '30'.
590
+ If your system is a Virtual Private Server (VPS) and has about 256 MB RAM, and
591
+ is also running other services such as MySQL, then we recommend a value of '2'.
592
+
593
+ If you find that your server is unable to handle the load on your Rails/Rack websites
594
+ (i.e. running out of memory) then you should lower this value. (Though if your
595
+ sites are really that popular, then you should strongly consider upgrading your
596
+ hardware or getting more servers.)
597
+
598
+ This option may only occur once, in the 'http' configuration bock.
599
+ The default value is '6'.
600
+
601
+ TIP: We strongly recommend you to <<reducing_memory_usage,use Ruby Enterprise
602
+ Edition>>. This allows you to reduce the memory usage of your Ruby on Rails applications
603
+ by about 33%. And it's not hard to install.
604
+
605
+ ==== passenger_max_instances_per_app <integer> ====
606
+ The maximum number of seconds that an application instance may be idle. That is,
607
+ if an application instance hasn't received any traffic after the given number of
608
+ seconds, then it will be shutdown in order to conserve memory.
609
+
610
+ Decreasing this value means that applications will have to be spawned
611
+ more often. Since spawning is a relatively slow operation, some visitors may
612
+ notice a small delay when they visit your Rails/Rack website. However, it will also
613
+ free up resources used by applications more quickly.
614
+
615
+ The optimal value depends on the average time that a visitor spends on a single
616
+ Rails/Rack web page. We recommend a value of `2 * x`, where `x` is the average
617
+ number of seconds that a visitor spends on a single Rails/Rack web page. But your
618
+ mileage may vary.
619
+
620
+ When this value is set to '0', application instances will not be shutdown unless
621
+ it's really necessary, i.e. when Phusion Passenger is out of worker processes
622
+ for a given application and one of the inactive application instances needs to
623
+ make place for another application instance. Setting the value to 0 is
624
+ recommended if you're on a non-shared host that's only running a few
625
+ applications, each which must be available at all times.
626
+
627
+ This option may only occur once, in the 'http' configuration block.
628
+ The default value is '300'.
629
+
630
+ [[PassengerPoolIdleTime]]
631
+ ==== passenger_pool_idle_time <integer> ====
632
+ The maximum number of seconds that an application instance may be idle. That is,
633
+ if an application instance hasn't received any traffic after the given number of
634
+ seconds, then it will be shutdown in order to conserve memory.
635
+
636
+ Decreasing this value means that applications will have to be spawned
637
+ more often. Since spawning is a relatively slow operation, some visitors may
638
+ notice a small delay when they visit your Rails/Rack website. However, it will also
639
+ free up resources used by applications more quickly.
640
+
641
+ The optimal value depends on the average time that a visitor spends on a single
642
+ Rails/Rack web page. We recommend a value of `2 * x`, where `x` is the average
643
+ number of seconds that a visitor spends on a single Rails/Rack web page. But your
644
+ mileage may vary.
645
+
646
+ When this value is set to '0', application instances will not be shutdown unless
647
+ it's really necessary, i.e. when Phusion Passenger is out of worker processes
648
+ for a given application and one of the inactive application instances needs to
649
+ make place for another application instance. Setting the value to 0 is
650
+ recommended if you're on a non-shared host that's only running a few
651
+ applications, each which must be available at all times.
652
+
653
+ This option may only occur once, in the 'http' configuration block.
654
+ The default value is '300'.
655
+
656
+ === Ruby on Rails-specific options ===
657
+ [[RailsEnv]]
658
+ ==== rails_env <string> ====
659
+ This option allows one to specify the default `RAILS_ENV` value.
660
+
661
+ This option may occur in the following places:
662
+
663
+ * In a 'server' configuration block.
664
+ * In a 'location' configuration block.
665
+ * In an 'if' configuration scope.
666
+
667
+ In each place, it may be specified at most once. The default value is 'production'.
668
+
669
+ ==== rails_spawn_method <string> ====
670
+ [TIP]
671
+ ."What spawn method should I use?"
672
+ =========================================================
673
+ This subsection attempts to describe spawn methods, but it's okay if you don't (want to)
674
+ understand it, as it's mostly a technical detail. You can basically follow this rule of thumb:
675
+
676
+ ************************************************
677
+ If your application works on Mongrel, but not on Phusion Passenger, then set
678
+ `rails_spawn_method` to 'conservative'. Otherwise, leave it at 'smart-lv2' (the default).
679
+ ************************************************
680
+
681
+ However, we do recommend you to try to understand it. The 'smart' and 'smart-lv2' spawn
682
+ methods bring many benefits.
683
+ =========================================================
684
+
685
+ include::users_guide_snippets/rails_spawn_method.txt[]
686
+
687
+ This option may occur in the following places:
688
+
689
+ * In the 'http' configuration block.
690
+ * In a 'server' configuration block.
691
+ * In a 'location' configuration block.
692
+ * In an 'if' configuration scope.
693
+
694
+ In each place, it may be specified at most once. The default value is 'smart-lv2'.
695
+
696
+ ==== rails_framework_spawner_idle_time <integer> ====
697
+ The FrameworkSpawner server (explained in <<spawning_methods_explained,Spawning
698
+ methods explained>>) has an idle timeout, just like the backend processes spawned by
699
+ Phusion Passenger do. That is, it will automatically shutdown if it hasn't done
700
+ anything for a given period.
701
+
702
+ This option allows you to set the FrameworkSpawner server's idle timeout, in
703
+ seconds. A value of '0' means that it should never idle timeout.
704
+
705
+ Setting a higher value will mean that the FrameworkSpawner server is kept around
706
+ longer, which may slightly increase memory usage. But as long as the
707
+ FrameworkSpawner server is running, the time to spawn a Ruby on Rails backend
708
+ process only takes about 40% of the time that is normally needed, assuming that
709
+ you're using the 'smart' <<RailsSpawnMethod,spawning method>>. So if your
710
+ system has enough memory, is it recommended that you set this option to a high
711
+ value or to '0'.
712
+
713
+ This option may occur in the following places:
714
+
715
+ * In the 'http' configuration block.
716
+ * In a 'server' configuration block.
717
+ * In a 'location' configuration block.
718
+ * In an 'if' configuration scope.
719
+
720
+ In each place, it may be specified at most once. The default value is '1800' (30 minutes).
721
+
722
+ ==== rails_app_spawner_idle_time <integer> ====
723
+ The ApplicationSpawner server (explained in <<spawning_methods_explained,Spawning
724
+ methods explained>>) has an idle timeout, just like the backend processes spawned by
725
+ Phusion Passenger do. That is, it will automatically shutdown if it hasn't done
726
+ anything for a given period.
727
+
728
+ This option allows you to set the ApplicationSpawner server's idle timeout, in
729
+ seconds. A value of '0' means that it should never idle timeout.
730
+
731
+ Setting a higher value will mean that the ApplicationSpawner server is kept around
732
+ longer, which may slightly increase memory usage. But as long as the
733
+ ApplicationSpawner server is running, the time to spawn a Ruby on Rails backend
734
+ process only takes about 10% of the time that is normally needed, assuming that
735
+ you're using the 'smart' or 'smart-lv2' <<RailsSpawnMethod,spawning method>>. So if your
736
+ system has enough memory, is it recommended that you set this option to a high
737
+ value or to '0'.
738
+
739
+ This option may occur in the following places:
740
+
741
+ * In the 'http' configuration block.
742
+ * In a 'server' configuration block.
743
+ * In a 'location' configuration block.
744
+ * In an 'if' configuration scope.
745
+
746
+ In each place, it may be specified at most once. The default value is '600' (10 minutes).
747
+
748
+ === Rack-specific options ===
749
+ [[RackEnv]]
750
+ ==== rack_env <string> ====
751
+ This option allows one to specify the default `RACK_ENV` value.
752
+
753
+ This option may occur in the following places:
754
+
755
+ * In a 'server' configuration block.
756
+ * In a 'location' configuration block.
757
+ * In an 'if' configuration scope.
758
+
759
+ In each place, it may be specified at most once. The default value is 'production'.
760
+
761
+
762
+ == Analysis and system maintenance tools ==
763
+
764
+ include::users_guide_snippets/analysis_and_system_maintenance_tools.txt[]
765
+
766
+
767
+ == Tips ==
768
+
769
+ include::users_guide_snippets/tips.txt[]
770
+
771
+
772
+ include::users_guide_snippets/appendix_a_about.txt[]
773
+
774
+ include::users_guide_snippets/appendix_b_terminology.txt[]
775
+
776
+ include::users_guide_snippets/appendix_c_spawning_methods.txt[]