passenger 2.2.2 → 2.2.3

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 (254) hide show
  1. data/DEVELOPERS.TXT +13 -3
  2. data/Rakefile +42 -33
  3. data/bin/passenger-install-apache2-module +1 -2
  4. data/bin/passenger-install-nginx-module +7 -19
  5. data/bin/passenger-status +64 -15
  6. data/bin/passenger-stress-test +2 -2
  7. data/doc/ApplicationPool algorithm.txt +26 -22
  8. data/doc/Users guide Apache.html +374 -149
  9. data/doc/Users guide Apache.txt +318 -51
  10. data/doc/Users guide Nginx.html +13 -13
  11. data/doc/Users guide Nginx.txt +7 -2
  12. data/doc/cxxapi/Bucket_8h-source.html +62 -25
  13. data/doc/cxxapi/Configuration_8h-source.html +343 -326
  14. data/doc/cxxapi/DirectoryMapper_8h-source.html +12 -12
  15. data/doc/cxxapi/Hooks_8h-source.html +1 -1
  16. data/doc/cxxapi/annotated.html +1 -1
  17. data/doc/cxxapi/classHooks-members.html +1 -1
  18. data/doc/cxxapi/classHooks.html +1 -1
  19. data/doc/cxxapi/classPassenger_1_1DirectoryMapper-members.html +2 -2
  20. data/doc/cxxapi/classPassenger_1_1DirectoryMapper.html +9 -9
  21. data/doc/cxxapi/classes.html +1 -1
  22. data/doc/cxxapi/definitions_8h-source.html +1 -1
  23. data/doc/cxxapi/files.html +1 -1
  24. data/doc/cxxapi/functions.html +2 -2
  25. data/doc/cxxapi/functions_func.html +2 -2
  26. data/doc/cxxapi/graph_legend.html +1 -1
  27. data/doc/cxxapi/group__Configuration.html +1 -1
  28. data/doc/cxxapi/group__Core.html +1 -1
  29. data/doc/cxxapi/group__Hooks.html +1 -1
  30. data/doc/cxxapi/group__Support.html +1 -1
  31. data/doc/cxxapi/main.html +1 -1
  32. data/doc/cxxapi/modules.html +1 -1
  33. data/doc/rdoc/classes/ConditionVariable.html +194 -0
  34. data/doc/rdoc/classes/Exception.html +120 -0
  35. data/doc/rdoc/classes/GC.html +113 -0
  36. data/doc/rdoc/classes/IO.html +169 -0
  37. data/doc/rdoc/classes/PhusionPassenger.html +238 -0
  38. data/doc/rdoc/classes/PhusionPassenger/AbstractInstaller.html +153 -0
  39. data/doc/rdoc/classes/PhusionPassenger/AbstractRequestHandler.html +517 -0
  40. data/doc/rdoc/classes/PhusionPassenger/AbstractServer.html +719 -0
  41. data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerAlreadyStarted.html +97 -0
  42. data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerError.html +96 -0
  43. data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerNotStarted.html +97 -0
  44. data/doc/rdoc/classes/PhusionPassenger/AbstractServer/UnknownMessage.html +96 -0
  45. data/doc/rdoc/classes/PhusionPassenger/AbstractServerCollection.html +598 -0
  46. data/doc/rdoc/classes/PhusionPassenger/AdminTools.html +140 -0
  47. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ControlProcess.html +317 -0
  48. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ControlProcess/Instance.html +138 -0
  49. data/doc/rdoc/classes/PhusionPassenger/AppInitError.html +154 -0
  50. data/doc/rdoc/classes/PhusionPassenger/Application.html +283 -0
  51. data/doc/rdoc/classes/PhusionPassenger/ConsoleTextTemplate.html +172 -0
  52. data/doc/rdoc/classes/PhusionPassenger/FrameworkInitError.html +145 -0
  53. data/doc/rdoc/classes/PhusionPassenger/HTMLTemplate.html +175 -0
  54. data/doc/rdoc/classes/PhusionPassenger/InitializationError.html +141 -0
  55. data/doc/rdoc/classes/PhusionPassenger/InvalidPath.html +92 -0
  56. data/doc/rdoc/classes/PhusionPassenger/MessageChannel.html +489 -0
  57. data/doc/rdoc/classes/PhusionPassenger/NativeSupport.html +350 -0
  58. data/doc/rdoc/classes/PhusionPassenger/Rack.html +91 -0
  59. data/doc/rdoc/classes/PhusionPassenger/Rack/ApplicationSpawner.html +188 -0
  60. data/doc/rdoc/classes/PhusionPassenger/Rack/RequestHandler.html +194 -0
  61. data/doc/rdoc/classes/PhusionPassenger/Railz.html +95 -0
  62. data/doc/rdoc/classes/PhusionPassenger/Railz/ApplicationSpawner.html +442 -0
  63. data/doc/rdoc/classes/PhusionPassenger/Railz/ApplicationSpawner/Error.html +98 -0
  64. data/doc/rdoc/classes/PhusionPassenger/Railz/CGIFixed.html +200 -0
  65. data/doc/rdoc/classes/PhusionPassenger/Railz/FrameworkSpawner.html +436 -0
  66. data/doc/rdoc/classes/PhusionPassenger/Railz/FrameworkSpawner/Error.html +98 -0
  67. data/doc/rdoc/classes/PhusionPassenger/Railz/RequestHandler.html +155 -0
  68. data/doc/rdoc/classes/PhusionPassenger/SpawnManager.html +402 -0
  69. data/doc/rdoc/classes/PhusionPassenger/UnknownError.html +125 -0
  70. data/doc/rdoc/classes/PhusionPassenger/Utils.html +805 -0
  71. data/doc/rdoc/classes/PhusionPassenger/VersionNotFound.html +140 -0
  72. data/doc/rdoc/classes/PhusionPassenger/WSGI.html +89 -0
  73. data/doc/rdoc/classes/PhusionPassenger/WSGI/ApplicationSpawner.html +188 -0
  74. data/doc/rdoc/classes/PlatformInfo.html +831 -0
  75. data/doc/rdoc/classes/RakeExtensions.html +197 -0
  76. data/doc/rdoc/classes/Signal.html +131 -0
  77. data/doc/rdoc/created.rid +1 -0
  78. data/doc/rdoc/files/DEVELOPERS_TXT.html +255 -0
  79. data/doc/rdoc/files/README.html +157 -0
  80. data/doc/rdoc/files/ext/phusion_passenger/native_support_c.html +92 -0
  81. data/doc/rdoc/files/lib/phusion_passenger/abstract_installer_rb.html +129 -0
  82. data/doc/rdoc/files/lib/phusion_passenger/abstract_request_handler_rb.html +131 -0
  83. data/doc/rdoc/files/lib/phusion_passenger/abstract_server_collection_rb.html +126 -0
  84. data/doc/rdoc/files/lib/phusion_passenger/abstract_server_rb.html +130 -0
  85. data/doc/rdoc/files/lib/phusion_passenger/admin_tools/control_process_rb.html +130 -0
  86. data/doc/rdoc/files/lib/phusion_passenger/admin_tools_rb.html +122 -0
  87. data/doc/rdoc/files/lib/phusion_passenger/application_rb.html +127 -0
  88. data/doc/rdoc/files/lib/phusion_passenger/console_text_template_rb.html +126 -0
  89. data/doc/rdoc/files/lib/phusion_passenger/constants_rb.html +122 -0
  90. data/doc/rdoc/files/lib/phusion_passenger/dependencies_rb.html +134 -0
  91. data/doc/rdoc/files/lib/phusion_passenger/events_rb.html +122 -0
  92. data/doc/rdoc/files/lib/phusion_passenger/exceptions_rb.html +122 -0
  93. data/doc/rdoc/files/lib/phusion_passenger/html_template_rb.html +126 -0
  94. data/doc/rdoc/files/lib/phusion_passenger/message_channel_rb.html +122 -0
  95. data/doc/rdoc/files/lib/phusion_passenger/packaging_rb.html +122 -0
  96. data/doc/rdoc/files/lib/phusion_passenger/platform_info_rb.html +127 -0
  97. data/doc/rdoc/files/lib/phusion_passenger/rack/application_spawner_rb.html +133 -0
  98. data/doc/rdoc/files/lib/phusion_passenger/rack/request_handler_rb.html +127 -0
  99. data/doc/rdoc/files/lib/phusion_passenger/railz/application_spawner_rb.html +143 -0
  100. data/doc/rdoc/files/lib/phusion_passenger/railz/cgi_fixed_rb.html +126 -0
  101. data/doc/rdoc/files/lib/phusion_passenger/railz/framework_spawner_rb.html +145 -0
  102. data/doc/rdoc/files/lib/phusion_passenger/railz/request_handler_rb.html +127 -0
  103. data/doc/rdoc/files/lib/phusion_passenger/simple_benchmarking_rb.html +122 -0
  104. data/doc/rdoc/files/lib/phusion_passenger/spawn_manager_rb.html +161 -0
  105. data/doc/rdoc/files/lib/phusion_passenger/utils_rb.html +175 -0
  106. data/doc/rdoc/files/lib/phusion_passenger/wsgi/application_spawner_rb.html +129 -0
  107. data/doc/rdoc/files/misc/rake/extensions_rb.html +130 -0
  108. data/doc/rdoc/fr_class_index.html +90 -0
  109. data/doc/rdoc/fr_file_index.html +76 -0
  110. data/doc/rdoc/fr_method_index.html +200 -0
  111. data/doc/rdoc/index.html +26 -0
  112. data/doc/rdoc/rdoc-style.css +187 -0
  113. data/doc/users_guide_snippets/rackup_specifications.txt +2 -8
  114. data/ext/apache2/Bucket.cpp +71 -38
  115. data/ext/apache2/Bucket.h +53 -16
  116. data/ext/apache2/Configuration.cpp +15 -0
  117. data/ext/apache2/Configuration.h +19 -2
  118. data/ext/apache2/DirectoryMapper.h +10 -10
  119. data/ext/apache2/Hooks.cpp +334 -74
  120. data/ext/boost/mpl/apply.hpp +5 -1
  121. data/ext/boost/mpl/apply_wrap.hpp +5 -2
  122. data/ext/boost/mpl/aux_/full_lambda.hpp +5 -1
  123. data/ext/boost/mpl/bind.hpp +5 -1
  124. data/ext/common/Application.h +11 -31
  125. data/ext/common/ApplicationPool.h +2 -1
  126. data/ext/common/ApplicationPoolServer.h +61 -20
  127. data/ext/common/ApplicationPoolServerExecutable.cpp +132 -4
  128. data/ext/common/ApplicationPoolStatusReporter.h +189 -65
  129. data/ext/common/Base64.cpp +143 -0
  130. data/ext/common/Base64.h +57 -0
  131. data/ext/common/CachedFileStat.cpp +25 -82
  132. data/ext/common/CachedFileStat.h +11 -125
  133. data/ext/common/CachedFileStat.hpp +243 -0
  134. data/ext/common/Exceptions.h +13 -0
  135. data/ext/common/FileChangeChecker.h +209 -0
  136. data/ext/common/Logging.h +3 -2
  137. data/ext/common/MessageChannel.h +10 -10
  138. data/ext/common/PoolOptions.h +72 -5
  139. data/ext/common/SpawnManager.h +11 -8
  140. data/ext/common/StandardApplicationPool.h +38 -39
  141. data/ext/common/StaticString.h +1 -0
  142. data/ext/common/StringListCreator.h +83 -0
  143. data/ext/common/SystemTime.h +3 -2
  144. data/ext/common/Timer.h +88 -0
  145. data/ext/common/Utils.cpp +161 -42
  146. data/ext/common/Utils.h +62 -31
  147. data/ext/common/Version.h +1 -1
  148. data/ext/nginx/Configuration.c +0 -4
  149. data/ext/nginx/ContentHandler.c +8 -6
  150. data/ext/nginx/HelperServer.cpp +45 -55
  151. data/ext/nginx/HttpStatusExtractor.h +4 -0
  152. data/ext/nginx/StaticContentHandler.c +25 -5
  153. data/ext/nginx/config +3 -0
  154. data/ext/nginx/ngx_http_passenger_module.c +72 -17
  155. data/ext/nginx/ngx_http_passenger_module.h +2 -2
  156. data/lib/phusion_passenger/abstract_request_handler.rb +15 -7
  157. data/lib/phusion_passenger/abstract_server.rb +16 -2
  158. data/lib/phusion_passenger/admin_tools/control_process.rb +36 -25
  159. data/lib/phusion_passenger/constants.rb +1 -1
  160. data/lib/phusion_passenger/dependencies.rb +10 -0
  161. data/lib/phusion_passenger/platform_info.rb +1 -1
  162. data/lib/phusion_passenger/rack/application_spawner.rb +21 -2
  163. data/lib/phusion_passenger/rack/request_handler.rb +10 -0
  164. data/lib/phusion_passenger/railz/application_spawner.rb +38 -2
  165. data/lib/phusion_passenger/railz/framework_spawner.rb +26 -28
  166. data/lib/phusion_passenger/railz/request_handler.rb +5 -1
  167. data/lib/phusion_passenger/spawn_manager.rb +6 -2
  168. data/lib/phusion_passenger/utils.rb +79 -27
  169. data/misc/rake/cplusplus.rb +5 -5
  170. data/test/ApplicationPoolServerTest.cpp +42 -0
  171. data/test/ApplicationPoolTest.cpp +255 -267
  172. data/test/Base64Test.cpp +48 -0
  173. data/test/CachedFileStatTest.cpp +243 -103
  174. data/test/FileChangeCheckerTest.cpp +331 -0
  175. data/test/PoolOptionsTest.cpp +80 -0
  176. data/test/UtilsTest.cpp +5 -17
  177. data/test/integration_tests/apache2_tests.rb +15 -4
  178. data/test/integration_tests/mycook_spec.rb +3 -4
  179. data/test/oxt/syscall_interruption_test.cpp +2 -14
  180. data/test/ruby/abstract_server_collection_spec.rb +1 -1
  181. data/test/ruby/abstract_server_spec.rb +35 -1
  182. data/test/ruby/rack/application_spawner_spec.rb +23 -6
  183. data/test/ruby/rails/application_spawner_spec.rb +6 -6
  184. data/test/ruby/rails/framework_spawner_spec.rb +6 -5
  185. data/test/ruby/rails/minimal_spawner_spec.rb +19 -0
  186. data/test/ruby/rails/spawner_error_handling_spec.rb +62 -7
  187. data/test/ruby/spawn_manager_spec.rb +10 -7
  188. data/test/ruby/spawn_server_spec.rb +1 -1
  189. data/test/ruby/utils_spec.rb +193 -20
  190. data/test/ruby/wsgi/application_spawner_spec.rb +3 -1
  191. data/test/stub/apache2/httpd.conf.erb +3 -0
  192. data/test/stub/rack/config.ru +1 -1
  193. data/test/stub/rails_apps/mycook/app/controllers/welcome_controller.rb +8 -0
  194. data/test/support/Support.cpp +84 -0
  195. data/test/support/Support.h +66 -8
  196. data/test/support/config.rb +14 -2
  197. data/test/support/test_helper.rb +5 -0
  198. data/vendor/rack-1.0.0-git/lib/rack/auth/openid.rb +123 -116
  199. data/vendor/rack-1.0.0-git/lib/rack/cascade.rb +17 -12
  200. data/vendor/rack-1.0.0-git/lib/rack/commonlogger.rb +34 -43
  201. data/vendor/rack-1.0.0-git/lib/rack/handler/cgi.rb +1 -1
  202. data/vendor/rack-1.0.0-git/lib/rack/handler/fastcgi.rb +1 -1
  203. data/vendor/rack-1.0.0-git/lib/rack/handler/lsws.rb +1 -1
  204. data/vendor/rack-1.0.0-git/lib/rack/handler/mongrel.rb +1 -1
  205. data/vendor/rack-1.0.0-git/lib/rack/handler/scgi.rb +1 -1
  206. data/vendor/rack-1.0.0-git/lib/rack/handler/webrick.rb +1 -1
  207. data/vendor/rack-1.0.0-git/lib/rack/mock.rb +4 -17
  208. data/vendor/rack-1.0.0-git/lib/rack/request.rb +3 -9
  209. data/vendor/rack-1.0.0-git/lib/rack/rewindable_input.rb +2 -0
  210. data/vendor/rack-1.0.0-git/lib/rack/utils.rb +38 -12
  211. metadata +231 -186
  212. data/ext/common/FileChecker.h +0 -112
  213. data/test/FileCheckerTest.cpp +0 -79
  214. data/test/stub/minimal-railsapp/README +0 -3
  215. data/test/stub/minimal-railsapp/config/application.rb +0 -0
  216. data/test/stub/minimal-railsapp/config/environment.rb +0 -3
  217. data/test/stub/minimal-railsapp/vendor/rails/actionmailer/lib/action_mailer.rb +0 -0
  218. data/test/stub/minimal-railsapp/vendor/rails/actionpack/lib/action_controller.rb +0 -10
  219. data/test/stub/minimal-railsapp/vendor/rails/actionpack/lib/action_pack.rb +0 -0
  220. data/test/stub/minimal-railsapp/vendor/rails/actionpack/lib/action_view.rb +0 -0
  221. data/test/stub/minimal-railsapp/vendor/rails/activerecord/lib/active_record.rb +0 -7
  222. data/test/stub/minimal-railsapp/vendor/rails/activeresource/lib/active_resource.rb +0 -0
  223. data/test/stub/minimal-railsapp/vendor/rails/activesupport/lib/active_support.rb +0 -17
  224. data/test/stub/minimal-railsapp/vendor/rails/activesupport/lib/active_support/whiny_nil.rb +0 -0
  225. data/test/stub/minimal-railsapp/vendor/rails/railties/lib/dispatcher.rb +0 -0
  226. data/test/stub/minimal-railsapp/vendor/rails/railties/lib/initializer.rb +0 -8
  227. data/test/stub/minimal-railsapp/vendor/rails/railties/lib/ruby_version_check.rb +0 -1
  228. data/test/stub/railsapp/app/controllers/application.rb +0 -12
  229. data/test/stub/railsapp/app/controllers/bar_controller.rb +0 -5
  230. data/test/stub/railsapp/app/controllers/bar_controller_1.txt +0 -5
  231. data/test/stub/railsapp/app/controllers/bar_controller_2.txt +0 -5
  232. data/test/stub/railsapp/app/controllers/foo_controller.rb +0 -9
  233. data/test/stub/railsapp/app/helpers/application_helper.rb +0 -3
  234. data/test/stub/railsapp/config/boot.rb +0 -108
  235. data/test/stub/railsapp/config/database.yml +0 -19
  236. data/test/stub/railsapp/config/environment.rb +0 -59
  237. data/test/stub/railsapp/config/environments/development.rb +0 -18
  238. data/test/stub/railsapp/config/environments/production.rb +0 -19
  239. data/test/stub/railsapp/config/initializers/inflections.rb +0 -10
  240. data/test/stub/railsapp/config/initializers/mime_types.rb +0 -5
  241. data/test/stub/railsapp/config/routes.rb +0 -35
  242. data/test/stub/railsapp/public/useless.txt +0 -1
  243. data/test/stub/railsapp2/app/controllers/application.rb +0 -12
  244. data/test/stub/railsapp2/app/controllers/foo_controller.rb +0 -5
  245. data/test/stub/railsapp2/app/helpers/application_helper.rb +0 -3
  246. data/test/stub/railsapp2/config/boot.rb +0 -108
  247. data/test/stub/railsapp2/config/database.yml +0 -19
  248. data/test/stub/railsapp2/config/environment.rb +0 -59
  249. data/test/stub/railsapp2/config/environments/development.rb +0 -18
  250. data/test/stub/railsapp2/config/environments/production.rb +0 -19
  251. data/test/stub/railsapp2/config/initializers/inflections.rb +0 -10
  252. data/test/stub/railsapp2/config/initializers/mime_types.rb +0 -5
  253. data/test/stub/railsapp2/config/routes.rb +0 -35
  254. data/test/stub/railsapp2/public/useless.txt +0 -1
@@ -24,35 +24,26 @@ using the commandline.
24
24
  Phusion Passenger works on any POSIX-compliant operating system. In other
25
25
  words: practically any operating system on earth, except Microsoft Windows.
26
26
 
27
- Phusion Passenger has been tested on:
28
-
29
- - Ubuntu Linux 6.06 (x86)
30
- - Ubuntu Linux 7.10 (x86)
31
- - Ubuntu Linux 8.04 (x86)
32
- - Debian Sarge (x86)
33
- - Debian Etch (x86)
34
- - Debian Lenny/Sid (x86)
35
- - CentOS 5 (x86)
36
- - Red Hat Enterprise Linux 5 (x86)
37
- - Gentoo, March 14 2008 (AMD64)
38
- - FreeBSD 6.1-RELEASE (x86)
39
- - MacOS X Tiger (x86)
40
- - MacOS X Leopard (x86)
41
-
42
- Other operating systems have not been tested, but Phusion Passenger will probably
43
- work fine on them. Please
27
+ Phusion Passenger is confirmed on a large number of operating systems and Linux
28
+ distributions, including, but not limited to, Ubuntu, Debian, CentOS/Fedora/RHEL,
29
+ Gentoo, Mac OS X, FreeBSD and Solaris. Both 32-bit and 64-bit platforms are supported.
30
+
31
+ The only POSIX-compliant operating system on which Phusion Passenger for Apache is
32
+ known not to work at this time, is OpenBSD. Please use Phusion Passenger for Nginx
33
+ instead.
34
+
35
+ If Phusion Passenger does not work on your platform then please
44
36
  link:http://code.google.com/p/phusion-passenger/issues/list[report a bug]
45
37
  or
46
- link:http://groups.google.com/group/phusion-passenger[join our discussion list]
47
- if it doesn't.
38
+ link:http://groups.google.com/group/phusion-passenger[join our discussion list].
48
39
 
49
40
 
50
- == Installing Phusion Passenger ==
41
+ == Installing, upgrading and uninstalling Phusion Passenger ==
51
42
 
52
43
  === Generic installation instructions ===
53
44
 
54
45
  [[install_passenger]]
55
- ==== Overview of download and installation methods ====
46
+ ==== Overview of installation methods ====
56
47
 
57
48
  There are three ways to install Phusion Passenger:
58
49
 
@@ -61,39 +52,73 @@ There are three ways to install Phusion Passenger:
61
52
  Passenger website].
62
53
  2. By downloading the source tarball from the Phusion Passenger website
63
54
  ('passenger-x.x.x.tar.gz').
64
- 3. By downloading a native Linux package (e.g. Debian package) from the
65
- Phusion Passenger website.
66
-
67
- In our opinion, installing the gem or the native package is easiest.
55
+ 3. By installing a native Linux package (e.g. Debian package).
68
56
 
69
- Phusion Passenger provides an easy-to-use installer for installing the Phusion
70
- Passenger Apache module, in case you choose to install via the gem or the
71
- source tarball.
57
+ The following sections will explain each installation method. Please read the
58
+ section for the installation method that you prefer. In our opinion, installing
59
+ the gem or the native package is easiest. For these two installation methods,
60
+ Phusion Passenger provides an easy-to-use installer.
72
61
 
73
- TIP: You might have to run the installation commands in the following sections
74
- as 'root'. If the installer fails because of permission errors, it will tell
75
- you.
76
-
77
- ==== Preparation
62
+ ==== Preparation (gem and source tarball only)
78
63
  If you want to install Phusion Passenger via the gem or the source tarball,
79
- then some preparation might be required. You can skip this subsection if
64
+ then some preparations might be required. You can skip this subsection if
80
65
  you're installing Phusion Passenger via a native Linux package, because no
81
66
  compilation is necessary.
82
67
 
68
+ ===== Switching to a root command prompt =====
69
+
70
+ Before installing, you will probably need to switch to the `root` user first.
71
+ When you install Phusion Passenger via a gem or a source tarball, some Phusion
72
+ Passenger files have to be compiled, which requires write access to the
73
+ directory in which the Phusion Passenger files are located. On Unix systems,
74
+ the root user is the user who has write access to the entire system. So unless
75
+ you know that your normal user account has write access to the Phusion Passenger
76
+ directory, you should switch to root before installing Phusion Passenger.
77
+
78
+ You can switch to root by typing the following command:
79
+
80
+ -------------------------
81
+ sudo -s
82
+ -------------------------
83
+
84
+ This will open a command prompt as the root user, from which you can proceed
85
+ with installing Phusion Passenger.
86
+
87
+ If your system does not have 'sudo' installed, please type the following command instead, which should do the same thing:
88
+
89
+ -------------------------
90
+ su
91
+ -------------------------
92
+
83
93
  [[specifying_correct_apache_install]]
84
94
  ===== Specifying the correct Apache installation =====
85
95
 
86
- If your system has multiple Apache installations (this is likely the case on
87
- MacOS X), then you will need to tell the Phusion Passenger installer which one
88
- to use. If you only have one Apache installation (the case on most Linux
89
- systems), then you can skip this section because Phusion Passenger will
90
- automatically detect it.
91
-
92
- Every Apache installation has its own `apxs` program. You will need to tell
93
- Phusion Passenger the location of this program, by specifying the `APXS2`
94
- environment variable. Suppose that you want to use the Apache installation in
95
- '/opt/apache2'. Then, assuming that the corresponding `apxs` program is located
96
- '/opt/apache2/bin/apxs', type:
96
+ The Phusion Passenger installer will attempt to automatically detect Apache,
97
+ and compile Phusion Passenger against that Apache version. It does this by
98
+ looking for the `apxs` or `apxs2` command in the PATH environment variable.
99
+ Apxs is an integral part of any Apache installation.
100
+
101
+ However, some systems have multiple Apache installations. This is likely
102
+ the case on MacOS X: the OS ships with Apache, but users tend to install
103
+ another Apache version seperately, e.g. via MacPorts. If your system has
104
+ multiple Apache installations, then you will need to tell the Phusion Passenger
105
+ installer which one to use. It is very important that you specify the
106
+ correct Apache installation, because if you load Phusion Passenger in an
107
+ Apache installation that it wasn't compiled against, then it will likely
108
+ crash.
109
+
110
+ On yet other systems, Apache is installed in a non-standard location,
111
+ preventing the Phusion Passenger installer from detecting Apache. This
112
+ is most likely the case on systems on which Apache was installed by hand
113
+ from source, i.e. as opposed to installed through the system's native
114
+ package manager. If this is the case, then you will also have to tell
115
+ the installer where it can find Apache.
116
+
117
+ To do so, set the `APXS2` environment variable to the full path of the
118
+ correct `apxs` or `apxs2` command. Suppose that you want to use the Apache
119
+ installation in '/opt/apache2'. Then, assuming that the corresponding
120
+ `apxs` program's path is '/opt/apache2/bin/apxs', type:
121
+
97
122
  ----------------------------------
98
123
  export APXS2=/opt/apache2/bin/apxs
99
124
  ----------------------------------
@@ -101,6 +126,14 @@ export APXS2=/opt/apache2/bin/apxs
101
126
  NOTE: On some systems, the `apxs` program might be called `apxs2`, and it might
102
127
  be located in the `sbin` folder instead of the `bin` folder.
103
128
 
129
+ .Environment variables and 'sudo'
130
+ NOTE: By default, the 'sudo' command will erase any environment variables that it
131
+ doesn't recognize, prior to executing the given command. So if you set APXS2 as a
132
+ normal user, then run `sudo passenger-install-apache2-module` (which is the command
133
+ for the Phusion Passenger installer), then the installer will not receive the
134
+ environment variable value that you set. To solve this problem, please become root
135
+ prior to setting any environment variables, as described in the previous subsection.
136
+
104
137
  [[specifying_ruby_installation]]
105
138
  ===== Specifying the correct Ruby installation =====
106
139
 
@@ -169,6 +202,17 @@ sudo apt-get update
169
202
  sudo apt-get install libapache2-mod-passenger
170
203
  ------------------------------------------------------
171
204
 
205
+ ==== What does the installer do? ====
206
+
207
+ Although we call it an ``installer'', it doesn't actually install anything.
208
+ The installer checks whether all required dependencies are installed,
209
+ compiles Phusion Passenger for you, and tells you how to modify the Apache
210
+ configuration file, but it doesn't copy any files around.
211
+
212
+ `passenger-install-apache2-module` is actually just a user-friendly frontend
213
+ around the command `rake apache2`, which performs the actual compilation of
214
+ Phusion Passenger.
215
+
172
216
 
173
217
  === Operating system-specific instructions and information ===
174
218
 
@@ -188,6 +232,105 @@ J Aaron Farr has written a link:http://cubiclemuses.com/cm/articles/2009/04/09/r
188
232
  about setting up Ruby on Rails and Phusion Passenger on OpenSolaris and EC2.
189
233
 
190
234
 
235
+ === Upgrading or downgrading Phusion Passenger ===
236
+
237
+ ==== Via a gem or a source tarball ====
238
+
239
+ To ugrade or downgrade Phusion Passenger via the gem or the source tarball, install the newer
240
+ or older version as you normally would; that is, install the gem or unpack the tarball, and
241
+ run `passenger-install-apache2-module`. Eventually `passenger-install-apache2-module` will tell
242
+ you to copy & paste some settings into the Apache configuration file; something that looks along
243
+ the lines of:
244
+
245
+ -----------------------------------
246
+ LoadModule passenger_module ...
247
+ PassengerRoot ...
248
+ PassengerRuby ...
249
+ -----------------------------------
250
+
251
+ Because you already have Phusion Passenger installed, you already have the same settings
252
+ in your Apache configuration file, just with different values. Replace the old settings with
253
+ the new ones that the installer outputs.
254
+
255
+ When you're done, restart Apache.
256
+
257
+ ==== Via a native Linux package
258
+
259
+ There are no special instructions required to upgrade or downgrade Phusion Passenger
260
+ via a native Linux package.
261
+
262
+ === Unloading (disabling) Phusion Passenger from Apache without uninstalling it ===
263
+
264
+ You can temporarily unload (disable) Phusion Passenger from Apache, without
265
+ uninstalling the Phusion Passenger files, so that Apache behaves as if Phusion
266
+ Passenger was never installed in the first place. This might be useful to you if,
267
+ for example, you seem to be experiencing a problem caused by Phusion Passenger,
268
+ but you want to make sure whether that's actually the case, without having
269
+ to through the hassle of uninstalling Phusion Passenger completely.
270
+
271
+ To unload Phusion Passenger from Apache, edit your Apache configuration file(s)
272
+ and comment out:
273
+
274
+ - all Phusion Passenger configuration directives.
275
+ - the 'LoadModule passenger_module' directive.
276
+
277
+ For example, if your configuration file looks like this...
278
+
279
+ -----------------------------------
280
+ Listen *:80
281
+ NameVirtualHosts *:80
282
+ ....
283
+
284
+ LoadModule passenger_module /somewhere/passenger-x.x.x/ext/apache2/mod_passenger.so
285
+
286
+ PassengerRuby /usr/bin/ruby
287
+ PassengerRoot /somewhere/passenger/x.x.x
288
+ PassengerMaxPoolSize 10
289
+
290
+ <VirtualHost *:80>
291
+ ServerName www.foo.com
292
+ DocumentRoot /webapps/foo/public
293
+ RailsBaseURI /rails
294
+ </VirtualHost>
295
+ -----------------------------------
296
+
297
+ ...then comment out the relevant directives, so that it looks like this:
298
+
299
+ -----------------------------------
300
+ Listen *:80
301
+ NameVirtualHosts *:80
302
+ ....
303
+
304
+ # LoadModule passenger_module /somewhere/passenger-x.x.x/ext/apache2/mod_passenger.so
305
+
306
+ # PassengerRuby /usr/bin/ruby
307
+ # PassengerRoot /somewhere/passenger/x.x.x
308
+ # PassengerMaxPoolSize 10
309
+
310
+ <VirtualHost *:80>
311
+ ServerName www.foo.com
312
+ DocumentRoot /webapps/foo/public
313
+ # RailsBaseURI /rails
314
+ </VirtualHost>
315
+ -----------------------------------
316
+
317
+ After you've done this, save the file and restart Apache.
318
+
319
+ === Uninstalling Phusion Passenger ===
320
+
321
+ To uninstall Phusion Passenger, please first remove all Phusion Passenger
322
+ configuration directives from your Apache configuration file(s). After you've
323
+ done this, you need to remove the Phusion Passenger files.
324
+
325
+ - If you installed Phusion Passenger via a gem, then type `gem uninstall passenger`.
326
+ You might have to run this as root.
327
+ - If you installed Phusion Passenger via a source tarball, then remove the directory
328
+ in which you placed the extracted Phusion Passenger files. This directory is the
329
+ same as the one pointed to the by 'PassengerRoot' configuration directive.
330
+ - If you installed Phusion Passenger via a Debian package, then remove type
331
+ `sudo apt-get remove libapache2-mod-passenger`.
332
+
333
+
191
334
  == Deploying a Ruby on Rails application ==
192
335
 
193
336
  Suppose you have a Ruby on Rails application in '/webapps/mycook', and you own
@@ -274,7 +417,7 @@ There are two ways to restart the application:
274
417
  1. By restarting Apache.
275
418
  2. By creating or modifying the file 'tmp/restart.txt' in the Rails
276
419
  application's <<application_root,root folder>>. Phusion Passenger will
277
- automatically restart the application.
420
+ automatically restart the application during the next request.
278
421
 
279
422
  For example, to restart our example MyCook application, we type this in the
280
423
  command line:
@@ -282,6 +425,11 @@ command line:
282
425
  touch /webapps/mycook/tmp/restart.txt
283
426
  -------------------------------------------
284
427
 
428
+ Please note that, unlike earlier versions of Phusion Passenger, 'restart.txt'
429
+ is not automatically deleted. Phusion Passenger checks whether the timestamp
430
+ of this file has changed in order to determine whether the application should
431
+ be restarted.
432
+
285
433
  === Migrations ===
286
434
 
287
435
  Phusion Passenger is not related to Ruby on Rails migrations in any way. To
@@ -347,7 +495,7 @@ $ some_awesome_editor config.ru
347
495
  ...type in some source code...
348
496
  $ cat config.ru
349
497
  app = proc do |env|
350
- return [200, { "Content-Type" => "text/html" }, "hello <b>world</b>"]
498
+ [200, { "Content-Type" => "text/html" }, ["hello <b>world</b>"]]
351
499
  end
352
500
  run app
353
501
  -------------------------------------------
@@ -631,10 +779,10 @@ follows:
631
779
  <VirtualHost *:80>
632
780
  ServerName www.foo.com
633
781
  DocumentRoot /apps/foo/public
634
- <Location /wordpress>
782
+ <Directory /apps/foo/public/wordpress>
635
783
  PassengerEnabled off
636
784
  AllowOverride all # <-- Makes Wordpress's .htaccess file work.
637
- </Location>
785
+ </Directory>
638
786
  </VirtualHost>
639
787
  ------------------------------------
640
788
 
@@ -649,10 +797,11 @@ This way, Phusion Passenger will not interfere with Wordpress.
649
797
 
650
798
  In each place, it may be specified at most once. The default value is 'on'.
651
799
 
800
+ [[PassengerTempDir]]
652
801
  === PassengerTempDir <directory> ===
653
802
  Specifies the directory that Phusion Passenger should use for storing temporary
654
- files. This includes things such as Unix socket files, buffered file uploads,
655
- etc.
803
+ files. This includes things such as Unix socket files, buffered file uploads
804
+ (see also <<PassengerUploadBufferDir,PassengerUploadBufferDir>>), etc.
656
805
 
657
806
  This option may be specified once, in the global server configuration. The
658
807
  default temp directory that Phusion Passenger uses is '/tmp'.
@@ -678,6 +827,36 @@ sudo -E passenger-status
678
827
  # The -E option tells 'sudo' to preserve environment variables.
679
828
  ----------------------------------------------------------
680
829
 
830
+ [[PassengerUploadBufferDir]]
831
+ === PassengerUploadBufferDir <directory> ===
832
+ Phusion Passenger buffers large file uploads to disk in order prevent slow file
833
+ uploads from blocking web applications. By default, a subdirectory in the
834
+ system's temporary files directory (or a subdirectory in the directory specified
835
+ in <<PassengerTempDir,PassengerTempDir>>, if set) is automatically created for
836
+ storing these buffered file uploads.
837
+
838
+ This configuration directive allows you to specify a different directory for storing
839
+ buffered file uploads. If you've specified such a directory (as opposed to using
840
+ Phusion Passenger's default) then you *must* ensure that this directory exists.
841
+
842
+ This configuration directive is also useful if you're using apache2-mpm-itk.
843
+ The buffered file upload directory that Phusion Passenger creates by default has
844
+ very strict permissions: it can only be accessed by the Apache worker processes.
845
+ However, Phusion Passenger assumes that all Apache worker processes are running
846
+ as the same user. apache2-mpm-itk breaks this assumption by running multiple
847
+ Apache worker processes as different users. So if you're using apace2-mpm-itk,
848
+ you should set this option to a directory that is writable by all Apache worker
849
+ processes, such as '/tmp'.
850
+
851
+ You may specify 'PassengerUploadBufferDir' in the following places:
852
+
853
+ * In the global server configuration.
854
+ * In a virtual host configuration block.
855
+ * In a `<Directory>` or `<Location>` block.
856
+ * In '.htaccess', if `AllowOverrides Options` is enabled.
857
+
858
+ In each place, it may be specified at most once.
859
+
681
860
  === PassengerRestartDir <directory> ===
682
861
  As described in the deployment chapters of this document, Phusion Passenger
683
862
  checks the file 'tmp/restart.txt' in the applications'
@@ -1419,6 +1598,94 @@ try drogus's link:http://github.com/drogus/apache-upload-progress-module/tree/ma
1419
1598
  Apache upload progress module] instead.
1420
1599
 
1421
1600
 
1601
+ == Under the hood ==
1602
+ Phusion Passenger hides a lot of complexity for the end user (i.e. the web server
1603
+ system administrator), but sometimes it is desirable to know what is going on.
1604
+ This section describes a few things that Phusion Passenger does under the hood.
1605
+
1606
+ === Static assets serving ===
1607
+ Phusion Passenger accelerates serving of static files. This means that, if an URI
1608
+ maps to a file that exists, then Phusion Passenger will let Apache serve that file
1609
+ directly, without hitting the web application.
1610
+
1611
+ Phusion Passenger does all this without the need for any mod_rewrite rules. People
1612
+ who are switching from an old Mongrel-based setup might have mod_rewrite rules such
1613
+ as these:
1614
+
1615
+ ------------------------------------------------------------
1616
+ # Check whether this request has a corresponding file; if that
1617
+ # exists, let Apache serve it, otherwise forward the request to
1618
+ # Mongrel.
1619
+ RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
1620
+ RewriteRule ^(.*)$ balancer://mongrel%{REQUEST_URI} [P,QSA,L]
1621
+ ------------------------------------------------------------
1622
+
1623
+ These kind of mod_rewrite rules are no longer required, and you can safely remove
1624
+ them.
1625
+
1626
+ === Page caching support ===
1627
+ For each HTTP request, Phusion Passenger will automatically look for a corresponding
1628
+ page cache file, and serve that if it exists. It does this by appending ".html" to
1629
+ the filename that the URI normally maps to, and checking whether that file exists.
1630
+ This check occurs after checking whether the original mapped filename exists (as part
1631
+ of static asset serving). All this is done without the need for special mod_rewrite
1632
+ rules.
1633
+
1634
+ For example, suppose that the browser requests '/foo/bar'.
1635
+
1636
+ 1. Phusion Passenger will first check whether this URI maps to a static file, i.e.
1637
+ whether the file 'foo/bar' exists in the web application's 'public' directory.
1638
+ If it does then Phusion Passenger will serve this file through Apache immediately.
1639
+ 2. If that doesn't exist, then Phusion Passenger will check whether the file
1640
+ 'foo/bar.html' exists. If it does then Phusion Passenger will serve this file
1641
+ through Apache immediately.
1642
+ 3. If 'foo/bar.html' doesn't exist either, then Phusion Passenger will forward the
1643
+ request to the underlying web application.
1644
+
1645
+ Note that Phusion Passenger's page caching support doesn't work if your web
1646
+ application uses a non-standard page cache directory, i.e. if it doesn't cache to
1647
+ the 'public' directory. In that case you'll need to use mod_rewrite to serve such
1648
+ page cache files.
1649
+
1650
+ === How Phusion Passenger detects whether a virtual host is a web application ===
1651
+ After you've read the deployment instructions you might wonder how Phusion Passenger
1652
+ knows that the DocumentRoot points to a web application that Phusion Passenger is
1653
+ able to serve, and how it knows what kind of web application it is (e.g. Rails or Rack).
1654
+
1655
+ Phusion Passenger checks whether the virtual host is a Rails application by checking
1656
+ whether the following file exists:
1657
+
1658
+ ------------------------------------------------
1659
+ dirname(DocumentRoot) + "/config/environment.rb"
1660
+ ------------------------------------------------
1661
+
1662
+ If you're not a programmer and don't understand the above pseudo-code snippet, it means
1663
+ that Phusion Passenger will:
1664
+
1665
+ 1. Extract the parent directory filename from the value of the DocumentRoot directory.
1666
+ 2. Append the text "/config/environment.rb" to the result, and check whether the resulting
1667
+ filename exists.
1668
+
1669
+ So suppose that your document root is '/webapps/foo/public'. Phusion Passenger will check
1670
+ whether the file '/webapps/foo/config/environment.rb' exists.
1671
+
1672
+ Note that Phusion Passenger does *not* resolve any symlinks in the document root path since
1673
+ version 2.2.0 -- in contrast to versions earlier than 2.2.0, which does resolve symlinks.
1674
+ So for example, suppose that your DocumentRoot points to '/home/www/example.com', which in
1675
+ turn is a symlink to '/webapps/example.com/public'. In versions earlier than 2.2.0, Phusion
1676
+ Passenger will check whether '/webapps/example.com/config/environment.rb' exists because it
1677
+ resolves all symlinks. Phusion Passenger 2.2.0 and later however will check for
1678
+ '/home/www/config/environment.rb'. This file of course doesn't exist, and as a result Phusion
1679
+ Passenger will not activate itself for this virtual host, and you'll most likely see an Apache
1680
+ mod_dirindex directory listing.
1681
+
1682
+ If you're running into this problem, you can explicitly tell Phusion Passenger what the
1683
+ correct application root is through the <<PassengerAppRoot,PassengerAppRoot>> configuration directive.
1684
+
1685
+ Autodetection of Rack applications happens through the same mechanism, exception that
1686
+ Phusion Passenger will look for 'config.ru' instead of 'config/environment.rb'.
1687
+
1688
+
1422
1689
  include::users_guide_snippets/appendix_a_about.txt[]
1423
1690
 
1424
1691
  include::users_guide_snippets/appendix_b_terminology.txt[]