passenger 5.0.14 → 5.0.15

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 (70) hide show
  1. checksums.yaml +8 -8
  2. checksums.yaml.gz.asc +7 -7
  3. data.tar.gz.asc +7 -7
  4. data/CHANGELOG +9 -0
  5. data/INSTALL.md +1 -1
  6. data/LICENSE +1 -1
  7. data/README.md +1 -1
  8. data/bin/passenger-install-apache2-module +6 -10
  9. data/bin/passenger-install-nginx-module +6 -9
  10. data/doc/CloudLicensingConfiguration.html +1 -216
  11. data/doc/CloudLicensingConfiguration.txt.md +1 -192
  12. data/doc/Design and Architecture.html +4 -4
  13. data/doc/Design and Architecture.txt +4 -4
  14. data/doc/ServerOptimizationGuide.html +1 -489
  15. data/doc/ServerOptimizationGuide.txt.md +1 -399
  16. data/doc/Users guide Apache.html +594 -6720
  17. data/doc/Users guide Apache.idmap.txt +15 -12
  18. data/doc/Users guide Apache.txt +113 -2047
  19. data/doc/Users guide Nginx.html +565 -6720
  20. data/doc/Users guide Nginx.idmap.txt +15 -12
  21. data/doc/Users guide Nginx.txt +94 -1862
  22. data/doc/Users guide Standalone.html +53 -2183
  23. data/doc/Users guide Standalone.idmap.txt +9 -6
  24. data/doc/Users guide Standalone.txt +16 -360
  25. data/doc/Users guide.html +3 -145
  26. data/doc/Users guide.txt +2 -54
  27. data/doc/users_guide_snippets/analysis_and_system_maintenance.txt +36 -175
  28. data/doc/users_guide_snippets/appendix_c_spawning_methods.txt +9 -215
  29. data/doc/users_guide_snippets/environment_variables.txt +11 -243
  30. data/doc/users_guide_snippets/installation.txt +66 -946
  31. data/doc/users_guide_snippets/rackup_specifications.txt +1 -75
  32. data/doc/users_guide_snippets/support_information.txt +1 -48
  33. data/doc/users_guide_snippets/tips.txt +103 -704
  34. data/doc/users_guide_snippets/troubleshooting/default.txt +16 -130
  35. data/doc/users_guide_snippets/troubleshooting/rails.txt +15 -12
  36. data/doc/users_guide_snippets/under_the_hood/relationship_with_ruby.txt +2 -113
  37. data/ext/apache2/Configuration.hpp +2 -2
  38. data/ext/apache2/Hooks.cpp +2 -2
  39. data/ext/common/AgentsStarter.h +18 -10
  40. data/ext/common/ApplicationPool2/ErrorRenderer.h +0 -3
  41. data/ext/common/ApplicationPool2/Options.h +8 -1
  42. data/ext/common/Constants.h +3 -9
  43. data/ext/common/agent/Core/RequestHandler/InitRequest.cpp +2 -0
  44. data/ext/common/agent/Watchdog/Main.cpp +1 -1
  45. data/ext/nginx/ContentHandler.c +2 -3
  46. data/ext/nginx/config +2 -2
  47. data/lib/phusion_passenger.rb +1 -22
  48. data/lib/phusion_passenger/abstract_installer.rb +10 -10
  49. data/lib/phusion_passenger/config/agent_compiler.rb +5 -5
  50. data/lib/phusion_passenger/config/nginx_engine_compiler.rb +4 -4
  51. data/lib/phusion_passenger/config/validate_install_command.rb +3 -3
  52. data/lib/phusion_passenger/constants.rb +1 -5
  53. data/lib/phusion_passenger/loader_shared_helpers.rb +16 -5
  54. data/lib/phusion_passenger/platform_info/apache_detector.rb +2 -2
  55. data/lib/phusion_passenger/public_api.rb +11 -2
  56. data/lib/phusion_passenger/request_handler/thread_handler.rb +2 -3
  57. data/lib/phusion_passenger/ruby_core_io_enhancements.rb +4 -1
  58. data/lib/phusion_passenger/standalone/start_command.rb +1 -1
  59. data/resources/oss-binaries.phusionpassenger.com.crt +124 -0
  60. data/resources/templates/apache2/deployment_example.txt.erb +5 -23
  61. data/resources/templates/apache2/installing_against_a_different_apache.txt.erb +3 -4
  62. data/resources/templates/apache2/possible_solutions_for_compilation_and_installation_problems.txt.erb +3 -3
  63. data/resources/templates/apache2/rpm_installation_recommended.txt.erb +1 -1
  64. data/resources/templates/installer_common/low_amount_of_memory_warning.txt.erb +4 -5
  65. data/resources/templates/nginx/deployment_example.txt.erb +5 -17
  66. data/resources/templates/nginx/possible_solutions_for_compilation_and_installation_problems.txt.erb +3 -3
  67. data/resources/templates/standalone/config.erb +1 -1
  68. data/resources/templates/undisclosed_error.html.template +4 -11
  69. metadata +2 -2
  70. metadata.gz.asc +7 -7
@@ -96,18 +96,6 @@
96
96
 
97
97
  3.5. Rackup specifications for various web frameworks => rackup-specifications-for-various-web-frameworks-1a2cs41
98
98
 
99
- 3.5.1. Camping => camping-16vz2yb
100
-
101
- 3.5.2. Halcyon => halcyon-1benlfl
102
-
103
- 3.5.3. Mack => mack-1ezijq6
104
-
105
- 3.5.4. Merb => merb-ddsh55
106
-
107
- 3.5.5. Ramaze => ramaze-1p2zod
108
-
109
- 3.5.6. Sinatra => sinatra-a7u9ag
110
-
111
99
  4. Deploying a WSGI (Python) application => deploying-a-wsgi-python-application-1or2efo
112
100
 
113
101
  4.1. Tutorial/example: writing and deploying a Hello World WSGI application => tutorial-example-writing-and-deploying-a-hello-world-wsgi-application-k5ron2
@@ -426,3 +414,18 @@
426
414
 
427
415
  15.4. Environment variables and sudo => environment-variables-and-sudo-10lphxn
428
416
 
417
+
418
+ ### These sections appear to have been removed. Please check.
419
+
420
+ 3.5.1. Camping => camping-16vz2yb
421
+
422
+ 3.5.2. Halcyon => halcyon-1benlfl
423
+
424
+ 3.5.3. Mack => mack-1ezijq6
425
+
426
+ 3.5.4. Merb => merb-ddsh55
427
+
428
+ 3.5.5. Ramaze => ramaze-1p2zod
429
+
430
+ 3.5.6. Sinatra => sinatra-a7u9ag
431
+
@@ -3,19 +3,7 @@ Phusion Passenger users guide, Nginx version
3
3
 
4
4
  image:images/phusion_banner.png[link="http://www.phusion.nl/"]
5
5
 
6
- Phusion Passenger is an application server which can directly integrate into Nginx. It is designed to be easy to use, fast, stable and reliable and is used by link:http://trends.builtwith.com/Web-Server/Phusion-Passenger[hundreds of thousands of websites] all over the world.
7
-
8
- Phusion Passenger is a so-called polyglot application server because it supports applications written in multiple programming languages. At this time, Ruby and Python are supported.
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 Ruby and Python applications.
15
- - How to solve common problems.
16
-
17
- This guide assumes that the reader is somewhat familiar with Nginx and with
18
- using the command line.
6
+ This is the old, deprecated Passenger Standalone documentation. Please visit https://www.phusionpassenger.com/library/ for the new documentation.
19
7
 
20
8
 
21
9
  == Support information
@@ -31,2101 +19,379 @@ include::users_guide_snippets/installation.txt[]
31
19
  [[deploying_a_rack_app]]
32
20
  == Deploying a Rack-based Ruby application ==
33
21
 
34
- Phusion Passenger supports arbitrary Ruby web applications that follow the
35
- link:http://rack.rubyforge.org/[Rack] interface.
36
-
37
- Phusion Passenger assumes that Rack application directories have a certain layout.
38
- Suppose that you have a Rack application in '/webapps/rackapp'. Then that
39
- folder must contain at least three entries:
40
-
41
- - 'config.ru', a Rackup file for starting the Rack application. This file must contain
42
- the complete logic for initializing the application.
43
- - 'public/', a folder containing public static web assets, like images and stylesheets.
44
- - 'tmp/', used for 'restart.txt' (our application restart mechanism). This will
45
- be explained in a following subsection.
46
-
47
- So '/webapps/rackapp' must, at minimum, look like this:
48
- ----------------------
49
- /webapps/rackapp
50
- |
51
- +-- config.ru
52
- |
53
- +-- public/
54
- |
55
- +-- tmp/
56
- ----------------------
57
-
58
- Suppose you own the domain 'www.rackapp.com'. You can either deploy your application
59
- to the virtual host's root (i.e. the application will be accessible from the root URL,
60
- 'http://www.rackapp.com/'), or in a sub URI (i.e. the application will be
61
- accessible from a sub URL, such as 'http://www.rackapp.com/rackapp').
62
-
63
- NOTE: The default `RACK_ENV` environment in which deployed Rack applications
64
- are run, is ``production''. You can change this by changing the
65
- <<RackEnv,rack_env>> configuration option.
22
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/
66
23
 
67
24
  === Tutorial/example: writing and deploying a Hello World Rack application ===
68
25
 
69
- First we create a Phusion Passenger-compliant Rack directory structure:
70
-
71
- -------------------------------------------
72
- $ mkdir /webapps/rack_example
73
- $ mkdir /webapps/rack_example/public
74
- $ mkdir /webapps/rack_example/tmp
75
- -------------------------------------------
76
-
77
- Next, we write a minimal "hello world" Rack application:
78
-
79
- -------------------------------------------
80
- $ cd /webapps/rack_example
81
- $ some_awesome_editor config.ru
82
- ...type in some source code...
83
- $ cat config.ru
84
- app = proc do |env|
85
- [200, { "Content-Type" => "text/html" }, ["hello <b>world</b>"]]
86
- end
87
- run app
88
- -------------------------------------------
89
-
90
- Finally, we deploy it by adding the following configuration options to
91
- the Nginx configuration file:
92
-
93
- -------------------------------------------
94
- http {
95
- ...
96
- server {
97
- listen 80;
98
- server_name www.rackexample.com;
99
- root /webapps/rack_example/public;
100
- passenger_enabled on;
101
- }
102
- ...
103
- }
104
- -------------------------------------------
105
-
106
- And we're done! After an Nginx restart, the above Rack application will be available
107
- under the URL 'http://www.rackexample.com/'.
26
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/
108
27
 
109
28
  === Deploying to a virtual host's root ===
110
29
 
111
- Add a 'server' virtual host entry to your Nginx configuration file. The virtual host's
112
- root must point to your Rack application's 'public' folder. You must also set
113
- 'passenger_enabled on' in the 'server' block.
114
-
115
- For example:
116
- -------------------------------------------
117
- http {
118
- ...
119
- server {
120
- listen 80;
121
- server_name www.rackapp.com;
122
- root /webapps/rackapp/public;
123
- passenger_enabled on;
124
- }
125
- ...
126
- }
127
- -------------------------------------------
128
- Then restart Nginx. The application has now been deployed.
30
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/
129
31
 
130
32
  [[deploying_rack_to_sub_uri]]
131
33
  === Deploying to a sub URI ===
132
34
 
133
- Suppose that you already have a virtual host for the application `/websites/phusion`:
134
-
135
- -------------------------------------------
136
- http {
137
- ...
138
-
139
- server {
140
- listen 80;
141
- server_name www.phusion.nl;
142
- root /websites/phusion;
143
- passenger_enabled on;
144
- }
145
-
146
- ...
147
- }
148
- -------------------------------------------
149
-
150
- And you want your Rack application, located in `/websites/rack`, to be accessible from the URL
151
- 'http://www.phusion.nl/subapp'.
152
-
153
- To do this, you need to perform the following:
154
-
155
- 1. Create a `location` with parameter `~ ^/<SUBURI>(/.*|$)`. This is a regular expression that says: "match everything that is exactly <SUBURI>, or starts with <SUBDURI>/".
156
- 2. Inside the location block, set `alias <PATH TO YOUR APPLICATION'S PUBLIC DIRECTORY>$1`.
157
- 3. Inside the location block, set `passenger_base_uri <SUBURI>`.
158
- 4. Inside the location block, set `passenger_app_root <PATH TO YOUR APPLICATION ROOT>`.
159
- 5. Inside the location block, set `passenger_document_root <PATH TO YOUR APPLICATION'S PUBLIC DIRECTORY>`.
160
- 6. Inside the location block, re-specify `passenger_enabled on`.
161
-
162
- Here is an example:
163
-
164
- -------------------------------------------
165
- http {
166
- ...
167
-
168
- server {
169
- listen 80;
170
- server_name www.phusion.nl;
171
- root /websites/phusion;
172
-
173
- # This block has been added.
174
- location ~ ^/subapp(/.*|$) {
175
- alias /websites/rack/public$1; # <-- be sure to point to 'public'!
176
- passenger_base_uri /subapp;
177
- passenger_app_root /websites/rack;
178
- passenger_document_root /websites/rack/public;
179
- passenger_enabled on;
180
- }
181
- }
182
-
183
- ...
184
- }
185
- -------------------------------------------
186
- Then restart Nginx. The application has now been deployed on the sub-URI.
35
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/
187
36
 
188
37
  === Redeploying (restarting the Rack application) ===
189
38
 
190
- Deploying a new version of a Rack application is as simple as
191
- re-uploading the application files, and restarting the application.
192
-
193
- There are two ways to restart the application:
194
-
195
- 1. By restarting Nginx.
196
- 2. By creating or modifying the file 'tmp/restart.txt' in the Rack
197
- application's <<application_root,root folder>>. Phusion Passenger will
198
- automatically restart the application.
199
-
200
- For example, to restart our example application, we type this in the
201
- command line:
202
- -------------------------------------------
203
- touch /webapps/rackapp/tmp/restart.txt
204
- -------------------------------------------
39
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/admin/nginx/restart_app.html
205
40
 
206
41
  === Rackup specifications for various web frameworks ===
207
- include::users_guide_snippets/rackup_specifications.txt[]
42
+
43
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/config_ru.html
208
44
 
209
45
 
210
46
  [[deploying_a_wsgi_app]]
211
47
  == Deploying a WSGI (Python) application
212
48
 
213
- Phusion Passenger supports all WSGI-compliant Python web applications. Suppose that you have a WSGI application in '/webapps/wsgiapp'. Then that folder must contain at least three entries:
214
-
215
- - 'passenger_wsgi.py', which Phusion Passenger will use as the main entry point for your application. This file must export a WSGI object called `application`.
216
- - 'public/', a folder containing public static web assets, like images and stylesheets.
217
- - 'tmp/', used for 'restart.txt' (our application restart mechanism). This will be explained in a following subsection.
218
-
219
- So '/webapps/wsgiapp' must, at minimum, look like this:
220
- ----------------------
221
- /webapps/wsgiapp
222
- |
223
- +-- passenger_wsgi.py
224
- |
225
- +-- public/
226
- |
227
- +-- tmp/
228
- ----------------------
49
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/
229
50
 
230
51
  === Tutorial/example: writing and deploying a Hello World WSGI application ===
231
52
 
232
- First we create a Phusion Passenger-compliant WSGI directory structure:
233
-
234
- -------------------------------------------
235
- $ mkdir /webapps/wsgi_example
236
- $ mkdir /webapps/wsgi_example/public
237
- $ mkdir /webapps/wsgi_example/tmp
238
- -------------------------------------------
239
-
240
- Next, we write a minimal "hello world" WSGI application:
241
-
242
- -------------------------------------------
243
- $ cd /webapps/wsgi_example
244
- $ some_awesome_editor passenger_wsgi.py
245
- ...type in some source code...
246
- $ cat passenger_wsgi.py
247
- def application(environ, start_response):
248
- start_response('200 OK', [('Content-Type', 'text/plain')])
249
- return [b"hello world!\n"]
250
- -------------------------------------------
251
-
252
- Finally, we deploy it by adding the following configuration options to
253
- the Nginx configuration file:
254
-
255
- -------------------------------------------
256
- http {
257
- ...
258
- server {
259
- listen 80;
260
- server_name www.wsgiexample.com;
261
- root /webapps/wsgi_example/public;
262
- passenger_enabled on;
263
- }
264
- ...
265
- }
266
- -------------------------------------------
267
-
268
- And we're done! After an Nginx restart, the above WSGI application will be available
269
- under the URL 'http://www.wsgiexample.com/'.
53
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/
270
54
 
271
55
  === Deploying to a virtual host's root ===
272
56
 
273
- Add a 'server' virtual host entry to your Nginx configuration file. The virtual host's
274
- root must point to your WSGI application's 'public' folder. You must also set
275
- 'passenger_enabled on' in the 'server' block.
276
-
277
- For example:
278
- -------------------------------------------
279
- http {
280
- ...
281
- server {
282
- listen 80;
283
- server_name www.wsgiapp.com;
284
- root /webapps/wsgiapp/public;
285
- passenger_enabled on;
286
- }
287
- ...
288
- }
289
- -------------------------------------------
290
- Then restart Nginx. The application has now been deployed.
57
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/
291
58
 
292
59
  [[deploying_wsgi_to_sub_uri]]
293
60
  === Deploying to a sub URI ===
294
61
 
295
- Suppose that you already have a virtual host for the application `/websites/phusion`:
296
-
297
- -------------------------------------------
298
- http {
299
- ...
300
-
301
- server {
302
- listen 80;
303
- server_name www.phusion.nl;
304
- root /websites/phusion;
305
- passenger_enabled on;
306
- }
307
-
308
- ...
309
- }
310
- -------------------------------------------
311
-
312
- And you want your WSGI application, located in `/websites/wsgi`, to be accessible from the URL
313
- 'http://www.phusion.nl/subapp'.
314
-
315
- To do this, you need to perform the following:
316
-
317
- 1. Create a `location` with parameter `~ ^/<SUBURI>(/.*|$)`. This is a regular expression that says: "match everything that is exactly <SUBURI>, or starts with <SUBDURI>/".
318
- 2. Inside the location block, set `alias <PATH TO YOUR APPLICATION'S PUBLIC DIRECTORY>$1`.
319
- 3. Inside the location block, set `passenger_base_uri <SUBURI>`.
320
- 4. Inside the location block, set `passenger_app_root <PATH TO YOUR APPLICATION ROOT>`.
321
- 5. Inside the location block, set `passenger_document_root <PATH TO YOUR APPLICATION'S PUBLIC DIRECTORY>`.
322
- 6. Inside the location block, re-specify `passenger_enabled on`.
323
-
324
- Here is an example:
325
-
326
- -------------------------------------------
327
- http {
328
- ...
329
-
330
- server {
331
- listen 80;
332
- server_name www.phusion.nl;
333
- root /websites/phusion;
334
-
335
- # This block has been added.
336
- location ~ ^/subapp(/.*|$) {
337
- alias /websites/wsgi/public$1; # <-- be sure to point to 'public'!
338
- passenger_base_uri /subapp;
339
- passenger_app_root /websites/wsgi;
340
- passenger_document_root /websites/wsgi/public;
341
- passenger_enabled on;
342
- }
343
- }
344
-
345
- ...
346
- }
347
- -------------------------------------------
348
-
349
- Then restart Nginx. The application has now been deployed on the sub-URI.
62
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/
350
63
 
351
64
  === Redeploying (restarting the WSGI application) ===
352
65
 
353
- Deploying a new version of a WSGI application is as simple as
354
- re-uploading the application files, and restarting the application.
355
-
356
- There are two ways to restart the application:
357
-
358
- 1. By restarting Nginx.
359
- 2. By creating or modifying the file 'tmp/restart.txt' in the WSGI
360
- application's <<application_root,root folder>>. Phusion Passenger will
361
- automatically restart the application.
362
-
363
- For example, to restart our example application, we type this in the
364
- command line:
365
- -------------------------------------------
366
- touch /webapps/wsgiapp/tmp/restart.txt
367
- -------------------------------------------
66
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/admin/nginx/restart_app.html
368
67
 
369
68
  === Sample `passenger_wsgi.py` for Django
370
69
 
371
- For Django applications, `passenger_wsgi.py` should look like this:
372
-
373
- [code,python]
374
- -------------------------------------------
375
- import myproject.wsgi
376
- application = myproject.wsgi.application
377
- -------------------------------------------
378
-
379
- Replace `myproject` with your project's module name.
70
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/wsgi_spec.html
380
71
 
381
72
 
382
73
  == Deploying a Node.js application
383
74
 
384
- Please refer to link:https://github.com/phusion/passenger/wiki/Phusion-Passenger%3A-Node.js-tutorial[the Node.js tutorial].
75
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/
385
76
 
386
77
 
387
78
  == Deploying a Meteor application
388
79
 
389
- Please refer to link:https://github.com/phusion/passenger/wiki/Phusion-Passenger:-Meteor-tutorial[the Meteor tutorial].
80
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/
390
81
 
391
82
 
392
83
  == Configuring Phusion Passenger ==
393
84
 
394
- After installation, Phusion Passenger does not need any further configurations.
395
- Nevertheless, the system administrator may be interested in changing
396
- Phusion Passenger's behavior. Phusion Passenger supports the following configuration
397
- options in the Nginx configuration file:
85
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/
398
86
 
399
87
  [[PassengerRoot]]
400
88
  === passenger_root <directory> ===
401
- The location to the Phusion Passenger root directory. This configuration option
402
- is essential to Phusion Passenger, and allows Phusion Passenger to locate its own
403
- data files. If you do not set this option, then Phusion Passenger will disable itself, and Nginx will behave as if Phusion Passenger was never installed. If you set this option to the wrong value, then Phusion Passenger will make Nginx abort with an error.
404
-
405
- While installing Phusion Passenger, you have been told to set this option in your Nginx configuration file, and you have been told what value to set it to. So under normal conditions, you don't have ask yourself what value to set for this option. But in case you lost the value (e.g. because you accidentally removed the Nginx configuration file, and you are trying to reconstruct it), or in case you didn't follow the installation instructions correctly, then here's how you can find out the correct value:
406
-
407
- * If you installed Phusion Passenger through <<install_on_debian_ubuntu,our APT repository>>, then follow the instructions in <<inserting_passenger_root_for_apt,Inserting `passenger_root` into nginx.conf>>.
408
- * If you installed Phusion Passenger through RubyGems, then the value can be obtained by running `passenger-config --root`.
409
- * If you installed Phusion Passenger through the source tarball, then the value is the path to the Phusion Passenger directory. For example, if you extracted the tarball's contents to `/opt/passenger/passenger-x.x.x`, then `passenger_root` must be `/opt/passenger/passenger-x.x.x`.
410
-
411
- If you've moved Phusion Passenger to a different directory then you need to update
412
- this option as well. Please read
413
- <<moving_phusion_passenger,Moving Phusion Passenger to a different directory>> for more information.
414
-
415
- This required option may only occur once, in the 'http' configuration block.
416
89
 
417
- NOTE: This option has no effect when you are using <<flying_passenger,Flying Passenger>>.
90
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_root
418
91
 
419
92
  === Deployment options
420
93
 
421
94
  ==== passenger_enabled <on|off>
422
- This option may be specified in the 'http' configuration block, a
423
- 'server' configuration block, a 'location' configuration block or
424
- an 'if' configuration scope, to enable or disable Phusion Passenger
425
- for that server or that location.
426
-
427
- Phusion Passenger is disabled by default, so you must explicitly enable
428
- it for server blocks that you wish to serve through Phusion Passenger.
429
- Please see <<deploying_a_rack_app,Deploying a Rack-based Ruby application>>
430
- and <<deploying_a_wsgi_app,Deploying a WSGI (Python) application>>
431
- for examples.
432
-
433
- ------------------------------
434
- server {
435
- listen 80;
436
- server_name www.example.com;
437
- root /webapps/example/public;
438
-
439
- # You must explicitly set 'passenger_enabled on', otherwise
440
- # Phusion Passenger won't serve this app.
441
- passenger_enabled on;
442
- }
443
- ------------------------------
95
+
96
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_enabled
444
97
 
445
98
  [[PassengerBaseURI]]
446
99
  ==== passenger_base_uri <uri>
447
- Used to specify that the given URI is an distinct application that should
448
- be served by Phusion Passenger. Please refer to the following sections for
449
- more information:
450
-
451
- * <<deploying_rack_to_sub_uri,Deploying Rack to a sub URI>>
452
- * <<deploying_wsgi_to_sub_uri,Deploying WSGI to a sub URI>>
453
- * <<deploying_rails_to_sub_uri,Deploying Rails 1 and Rails 2 to a sub URI>>
454
-
455
- It is allowed to specify this option multiple times. Do this to deploy multiple
456
- applications in different sub-URIs under the same virtual host.
457
-
458
- This option may occur in the following places:
459
100
 
460
- * In the 'http' configuration block.
461
- * In a 'server' configuration block.
462
- * In a 'location' configuration block.
463
- * In an 'if' configuration scope.
101
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_base_uri
464
102
 
465
103
  [[PassengerDocumentRoot]]
466
104
  ==== passenger_document_root <path>
467
- Used in sub-URI deployment scenarios to tell Phusion Passenger where it
468
- should look for static files. Please refer to the following sections for
469
- more information:
470
105
 
471
- * <<deploying_rack_to_sub_uri,Deploying Rack to a sub URI>>
472
- * <<deploying_wsgi_to_sub_uri,Deploying WSGI to a sub URI>>
473
- * <<deploying_rails_to_sub_uri,Deploying Rails 1 and Rails 2 to a sub URI>>
474
-
475
- This option may occur in the following places:
476
-
477
- * In the 'http' configuration block.
478
- * In a 'server' configuration block.
479
- * In a 'location' configuration block.
480
- * In an 'if' configuration scope.
481
-
482
- In each place, it may be specified at most once.
106
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_document_root
483
107
 
484
108
  === Application loading options
485
109
 
486
110
  [[PassengerRuby]]
487
111
  ==== passenger_ruby <filename>
488
- The `passenger_ruby` option allows one to specify the Ruby interpreter to use. Similarly, the `passenger_python` and `passenger_nodejs` options are for specifying the Python interpreter and Node.js commands, respectively.
489
-
490
- In versions prior to 4.0.0, only a single Ruby version was supported for the entire Nginx instance, so `passenger_ruby` may only occur in the global server configuration. Also, the `passenger_python`/`passenger_nodejs` options were not supported.
491
-
492
- Since version 4.0.0, Phusion Passenger supports multiple Ruby interpreters in the same Nginx instance. And so, since version 4.0.0, this option may occur in the following places:
493
-
494
- * In the 'http' configuration block.
495
- * In a 'server' configuration block.
496
- * In a 'location' configuration block.
497
- * In an 'if' configuration scope.
498
-
499
- The `passenger_ruby` in the `http` block - that is, the one that `passenger-install-nginx-module` outputs - is used for invoking certain Phusion Passenger tools that are written in Ruby, e.g. the internal helper script used by <<PassengerPreStart,passenger_pre_start>>. It is okay if the value refers to a different Ruby interpreter than the one you originally installed Phusion Passenger with. You can learn more about all this in <<relationship_with_ruby,Phusion Passenger and its relationship with Ruby>>.
500
-
501
- The `passenger_ruby` directive in the `http` block is also used as the default Ruby interpreter for Ruby web apps. You don't *have* to specify a `passenger_ruby` in the `http` block though, because the default is to use the first `ruby` command found in `$PATH`.
502
-
503
- The `passenger_python` and `passenger_nodejs` options work in a similar manner, but apply to Python and Node.js instead.
504
-
505
- You can also override `passenger_ruby` and other directives in specific contexts if you want to use a different interpreter for that web app. For example:
506
-
507
- ------------------------------
508
- http {
509
- passenger_root ...;
510
-
511
- # Use Ruby 1.8.7 by default.
512
- passenger_ruby /usr/bin/ruby1.8;
513
- # Use Python 2.6 by default.
514
- passenger_python /usr/bin/python2.6;
515
- # Use /usr/bin/node by default.
516
- passenger_nodejs /usr/bin/node;
517
-
518
- server {
519
- # This Rails web app will use Ruby 1.8.7
520
- listen 80;
521
- server_name www.foo.com;
522
- root /webapps/foo/public;
523
- }
524
-
525
- server {
526
- # This Rails web app will use Ruby 1.9.3, as installed by RVM
527
- passenger_ruby /usr/local/rvm/wrappers/ruby-1.9.3/ruby;
528
-
529
- listen 80;
530
- server_name www.bar.com;
531
- root /webapps/bar/public;
532
-
533
- # If you have a web app deployed in a sub-URI, customize
534
- # passenger_ruby/passenger_python inside a `location` block.
535
- # The web app under www.bar.com/blog will use JRuby 1.7.1
536
- location ~ ^/blog(/.*|$) {
537
- alias /websites/blog/public$1;
538
- passenger_base_uri /blog;
539
- passenger_app_root /websites/blog;
540
- passenger_document_root /websites/blog/public;
541
- passenger_enabled on;
542
- passenger_ruby /usr/local/rvm/wrappers/jruby-1.7.1/ruby;
543
- }
544
- }
545
-
546
- server {
547
- # This Flask web app will use Python 3.0
548
- passenger_python /usr/bin/python3.0;
549
-
550
- listen 80;
551
- server_name www.baz.com;
552
- root /webapps/baz/public;
553
- }
554
- }
555
- ------------------------------
556
-
557
- include::users_guide_snippets/rvm_helper_tool.txt[]
112
+
113
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_ruby
558
114
 
559
115
  ==== passenger_python <filename>
560
- :version: 4.0.0
561
- include::users_guide_snippets/since_version.txt[]
562
116
 
563
- This option allows one to specify the Python interpreter to use. See <<PassengerRuby,passenger_ruby>> for more information. The default value is 'python', meaning that the Python interpreter will be looked up according to the `PATH` environment variable.
117
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_python
564
118
 
565
119
  ==== passenger_nodejs <filename>
566
- :version: 4.0.24
567
- include::users_guide_snippets/since_version.txt[]
568
120
 
569
- This option allows one to specify the Node.js command to use. See <<PassengerRuby,passenger_ruby>> for more information. The default value is 'node', meaning that the Node.js command will be looked up according to the `PATH` environment variable.
121
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_nodejs
570
122
 
571
123
  ==== passenger_meteor_app_settings <filename>
572
- :version: 5.0.7
573
- include::users_guide_snippets/since_version.txt[]
574
124
 
575
- When using a Meteor application in non-bundled mode, use this option to specify a (JSON) file with settings for the application. Meteor will be started with the `--settings` parameter set to this option.
576
-
577
- N.B. For bundled mode, Meteor requires you to put applications settings in the `METEOR_SETTINGS` environment variable.
125
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_meteor_app_settings-filename
578
126
 
579
127
  [[PassengerAppEnv]]
580
128
  ==== passenger_app_env <string>
581
- This option sets the value of the following environment variables:
582
-
583
- * `RAILS_ENV`
584
- * `RACK_ENV`
585
- * `WSGI_ENV`
586
- * `NODE_ENV`
587
- * `PASSENGER_APP_ENV`
588
-
589
- Some web frameworks, for example Rails and Connect.js, adjust their behavior according to the value in one of these environment variables.
590
-
591
- Phusion Passenger for Nginx sets the default value to **production**. If you're developing an Rails application then you should set this to `development`.
592
-
593
- If you want to set other environment variables, please refer to <<env_vars_passenger_apps,Setting environment variables for Phusion Passenger-served apps>>.
594
-
595
- Setting this option also adds the application environment name to the default <<PassengerAppGroupName,application group name>>, so that you can run multiple versions of your application with different application environment names.
596
-
597
- This option may occur in the following places:
598
129
 
599
- * In the 'http' configuration block.
600
- * In a 'server' configuration block.
601
- * In a 'location' configuration block.
602
- * In an 'if' configuration scope.
603
-
604
- In each place, it may be specified at most once. The default value is 'production'.
130
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_app_env
605
131
 
606
132
  [[RailsEnv]]
607
133
  ==== rails_env <string>
608
- An alias for <<PassengerAppEnv,passenger_app_env>>.
134
+
135
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_app_env
609
136
 
610
137
  [[RackEnv]]
611
138
  ==== rack_env <string>
612
- An alias for <<PassengerAppEnv,passenger_app_env>>.
139
+
140
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_app_env
613
141
 
614
142
  [[PassengerAppRoot]]
615
143
  ==== passenger_app_root <path/to/root>
616
- :version: 4.0.0
617
- include::users_guide_snippets/since_version.txt[]
618
-
619
- By default, Phusion Passenger assumes that the application's root directory
620
- is the parent directory of the 'public' directory. This option allows one to
621
- specify the application's root independently from the Nginx 'root', which
622
- is useful if the 'public' directory lives in a non-standard place.
623
-
624
- This option may occur in the following places:
625
-
626
- * In the 'http' configuration block.
627
- * In a 'server' configuration block.
628
- * In a 'location' configuration block.
629
- * In an 'if' configuration scope.
630
-
631
- In each place, it may be specified at most once.
632
-
633
- Example:
634
144
 
635
- -----------------------------
636
- server {
637
- server_name test.host;
638
- root /var/rails/zena/sites/example.com/public;
639
- # normally Phusion Passenger would
640
- # have assumed that the application
641
- # root is "/var/rails/zena/sites/example.com"
642
- passenger_app_root /var/rails/zena;
643
- }
644
- -----------------------------
145
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_app_root
645
146
 
646
147
  [[PassengerAppGroupName]]
647
148
  ==== passenger_app_group_name <name>
648
- Sets the name of the application group that the current application should belong to. Its default value is the virtual host's root directory, plus (if it is set), the <<PassengerAppEnv,application environment name>>.
649
-
650
- Phusion Passenger stores and caches most application spawning settings -- such as environment variables, process limits, etc -- on a per-app-group-name basis. This means that if you want to start two versions of your application, with each version having different environment variables, then you must assign them under different application group names.
651
-
652
- For example, consider a situation in which you are running multiple versions of the same app, with each version intended for a different customer. You use the `CUSTOMER_NAME` environment variable to tell the app which customer that version should serve.
653
-
654
- ------------------------------------
655
- # WRONG example! Doesn't work!
656
-
657
- server {
658
- listen 80;
659
- server_name customer1.foo.com;
660
- root /webapps/foo/public;
661
- passenger_enabled on;
662
- passenger_env_var CUSTOMER_NAME customer1;
663
- }
664
-
665
- server {
666
- listen 80;
667
- server_name customer2.foo.com;
668
- root /webapps/foo/public;
669
- passenger_enabled on;
670
- passenger_env_var CUSTOMER_NAME customer2;
671
- }
672
- ------------------------------------
673
-
674
- This example doesn't work, because Phusion Passenger thinks that they are the same application. When a user visits customer1.foo.com, Phusion Passenger will start a process with `CUSTOMER_NAME=customer1`. When another user visits customer2.foo.com, Phusion Passenger will route the request to the application process that was started earlier. Because environment variables are only set during application process startup, the second user will be served the website for customer 1.
675
-
676
- To make this work, assign unique application group names:
677
-
678
- ------------------------------------
679
- server {
680
- listen 80;
681
- server_name customer1.foo.com;
682
- root /webapps/foo/public;
683
- passenger_enabled on;
684
- passenger_env_var CUSTOMER_NAME customer1;
685
- passenger_app_group_name foo_customer1;
686
- }
687
-
688
- server {
689
- listen 80;
690
- server_name customer2.foo.com;
691
- root /webapps/foo/public;
692
- passenger_enabled on;
693
- passenger_env_var CUSTOMER_NAME customer2;
694
- passenger_app_group_name foo_customer2;
695
- }
696
- ------------------------------------
697
-
698
- Note that it is not necessary to set `passenger_app_group_name` if you want to run two versions of your application under different <<PassengerAppEnv,application environment names>>, because the application environment name is included in the default application group name. For example, consider a situation in which you want to run a production and a staging version of your application. The following configuration will work fine:
699
-
700
- ------------------------------------
701
- server {
702
- listen 80;
703
- server_name bar.com;
704
- root /webapps/bar/public;
705
- passenger_enabled on;
706
- # Phusion Passenger implicitly sets:
707
- # passenger_app_group_name /webapps/bar/public;
708
- }
709
-
710
- server {
711
- listen 80;
712
- server_name staging.com;
713
- root /webapps/bar/public;
714
- passenger_enabled on;
715
- passenger_app_env staging;
716
- # Phusion Passenger implicitly sets:
717
- # passenger_app_group_name '/webapps/bar/public (staging)';
718
- }
719
- ------------------------------------
720
-
721
- This option may occur in the following places:
722
-
723
- * In the 'http' configuration block.
724
- * In a 'server' configuration block.
725
- * In a 'location' configuration block.
726
- * In an 'if' configuration scope.
727
-
728
- In each place, it may be specified at most once.
149
+
150
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_app_group_name
729
151
 
730
152
  [[PassengerAppType]]
731
153
  ==== passenger_app_type <name>
732
- :version: 4.0.25
733
- include::users_guide_snippets/since_version.txt[]
734
-
735
- By default, Phusion Passenger autodetects the type of the application, e.g. whether it's a Ruby, Python, Node.js or Meteor app. If it's unable to autodetect the type of the application (e.g. because you've specified a custom <<PassengerStartupFile,passenger_startup_file>>) then you can use this option to force Phusion Passenger to recognize the application as a specific type.
736
-
737
- Allowed values are:
738
-
739
- * `rack` - Ruby and Rails
740
- * `wsgi` - Python
741
- * `node` - Node.js, or Meteor JS in bundled mode
742
- * `meteor` - Meteor JS in non-bundled mode
743
-
744
- This option may occur in the following places:
745
-
746
- * In the 'http' configuration block.
747
- * In a 'server' configuration block.
748
- * In a 'location' configuration block.
749
- * In an 'if' configuration scope.
750
-
751
- In each place, it may be specified at most once.
752
154
 
753
- Example:
754
-
755
- -----------------------------
756
- server {
757
- server_name example.com;
758
- root /webapps/example.com/public;
759
- passenger_enabled on;
760
- # Use server.js as the startup file (entry point file) for
761
- # your Node.js application, instead of the default app.js
762
- passenger_startup_file server.js;
763
- passenger_app_type node;
764
- </VirtualHost>
765
- -----------------------------
155
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_app_type
766
156
 
767
157
  [[PassengerStartupFile]]
768
158
  ==== passenger_startup_file <filename>
769
- :version: 4.0.25
770
- include::users_guide_snippets/since_version.txt[]
771
-
772
- This option specifies the startup file that Phusion Passenger should use when loading the application.
773
-
774
- Every application has a *startup file* or *entry point file*: a file where the application begins execution. Some languages have widely accepted conventions about how such a file should be called (e.g. Ruby, with its `config.ru`). Other languages have somewhat-accepted conventions (e.g. Node.js, with its `app.js`). In these cases, Phusion Passenger reuses these conventions, and executes applications through those files.
775
-
776
- Other languages have no conventions at all, and so Phusion Passenger invents one (e.g. Python WSGI with `passenger_wsgi.py`).
777
-
778
- Here's a list of the language-specific conventions that Phusion Passenger accepts:
779
-
780
- [options="header"]
781
- |================================================
782
- | Language | Phusion Passenger convention
783
- | Ruby on Rails >= 3.0, Ruby Rack | config.ru
784
- | Ruby on Rails 1.x and 2.x | config/environment.rb
785
- | Python | passenger_wsgi.py
786
- | Node.js | app.js
787
- |================================================
788
-
789
- But sometimes you might not want to adhere to the convention that Phusion Passenger accepts. For example, on Node.js, you might want to use `server.js` as the startup file instead of the default `app.js`. With this option, you can customize the startup file to any file you like.
790
-
791
- Notes:
792
159
 
793
- * Customizing the startup file affects <<user_switching,user switching>>. After all, if user switching is enabled, the application is executed as the user that owns the startup file.
794
- * If you set this option, you **must** also set <<PassengerAppType,passenger_app_type>>, otherwise Phusion Passenger doesn't know what kind of application it is.
795
-
796
- This option may occur in the following places:
797
-
798
- * In the 'http' configuration block.
799
- * In a 'server' configuration block.
800
- * In a 'location' configuration block.
801
- * In an 'if' configuration scope.
802
-
803
- In each place, it may be specified at most once.
804
-
805
- Example:
806
-
807
- -----------------------------
808
- server {
809
- server_name example.com;
810
- root /webapps/example.com/public;
811
- passenger_enabled on;
812
- # Use server.js as the startup file (entry point file) for
813
- # your Node.js application, instead of the default app.js
814
- passenger_startup_file server.js;
815
- passenger_app_type node;
816
- </VirtualHost>
817
- -----------------------------
160
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_startup_file
818
161
 
819
162
  [[PassengerSpawnMethod]]
820
163
  ==== passenger_spawn_method <string>
821
- [TIP]
822
- ."What spawn method should I use?"
823
- =========================================================
824
- This subsection attempts to describe spawn methods, but it's okay if you don't (want to)
825
- understand it, as it's mostly a technical detail. You can basically follow this rule of thumb:
826
-
827
- ************************************************
828
- If your application works on Mongrel or Thin, but not on Phusion Passenger, then set
829
- `passenger_spawn_method` to 'direct'. Otherwise, leave it at 'smart' (the default).
830
- ************************************************
831
-
832
- However, we do recommend you to try to understand it. The 'smart' spawn
833
- method brings many benefits.
834
- =========================================================
835
-
836
- include::users_guide_snippets/passenger_spawn_method.txt[]
837
164
 
838
- This option may occur in the following places:
839
-
840
- * In the 'http' configuration block.
841
- * In a 'server' configuration block.
842
- * In a 'location' configuration block.
843
- * In an 'if' configuration scope.
844
-
845
- In each place, it may be specified at most once. The default value is 'smart'.
165
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_spawn_method
846
166
 
847
167
  [[PassengerEnvVar]]
848
168
  ==== passenger_env_var <name> <value>
849
- :version: 5.0.0
850
- include::users_guide_snippets/since_version.txt[]
851
-
852
- Sets environment variables to pass to the application. Environment variables are only set during application loading.
853
-
854
- Example:
855
-
856
- -------------------------
857
- server {
858
- server_name www.foo.com;
859
- root /webapps/foo/public;
860
- passenger_enabled on;
861
-
862
- passenger_env_var DATABASE_USERNAME foo_db;
863
- passenger_env_var DATABASE_PASSWORD secret;
864
- }
865
- -------------------------
866
-
867
- This option may occur in the following places:
868
-
869
- * In the 'http' configuration block.
870
- * In a 'server' configuration block.
871
- * In a 'location' configuration block.
872
- * In an 'if' configuration scope.
873
169
 
874
- In each place, it may be specified multiple times.
170
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_env_var
875
171
 
876
172
  [[PassengerLoadShellEnvvars]]
877
173
  ==== passenger_load_shell_envvars <on|off>
878
- :version: 4.0.20
879
- include::users_guide_snippets/since_version.txt[]
880
174
 
881
- Enables or disables the loading of shell environment variables before spawning the application.
882
-
883
- If this option is turned on, and the user's shell is `bash`, then applications are loaded by running them with `bash -l -c`. Otherwise, they are loaded by running them directly from the `PassengerAgent core` process.
884
-
885
- This option may occur in the following places:
886
-
887
- * In the 'http' configuration block.
888
- * In a 'server' configuration block.
889
- * In a 'location' configuration block.
890
- * In an 'if' configuration scope.
891
-
892
- In each place, it may be specified at most once. The default value is 'on'.
175
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_load_shell_envvars
893
176
 
894
177
  [[PassengerRollingRestarts]]
895
178
  ==== passenger_rolling_restarts <on|off>
896
- :version: 3.0.0
897
- include::users_guide_snippets/enterprise_only.txt[]
898
-
899
- Enables or disables support for rolling restarts through restart.txt. Normally when you
900
- restart an application by touching restart.txt, Phusion Passenger would
901
- shut down all application processes and spawn a new one. The spawning
902
- of a new application process could take a while, and any requests that
903
- come in during this time will be blocked until this first application
904
- process has spawned.
905
-
906
- But when rolling restarts are enabled, Phusion Passenger Enterprise will:
907
-
908
- 1. Spawn a new process in the background.
909
- 2. When it's done spawning, Phusion Passenger Enterprise will replace one of the old processes with this newly spawned one.
910
- 3. Step 1 and 2 are repeated until all processes have been replaced.
911
179
 
912
- This way, visitors will not experience any delays when you are restarting your application. This allows you to, for example, upgrade your application often without degrading user experience.
913
-
914
- Rolling restarts have a few caveat however that you should be aware of:
915
-
916
- - Upgrading an application sometimes involves upgrading the database schema.
917
- With rolling restarts, there may be a point in time during which processes
918
- belonging to the previous version and processes belonging to the new version
919
- both exist at the same time. Any database schema upgrades you perform must
920
- therefore be backwards-compatible with the old application version.
921
- - Because there's no telling which process will serve a request, users may
922
- not see changes brought about by the new version until all processes have
923
- been restarted. It is for this reason that you should not use rolling
924
- restarts in development, only in production.
925
-
926
- If Passenger Enterprise could not rolling restart a process (let's call it 'A') because it is unable to spawn a new process (let's call it 'B'), then Passenger Enterprise will give up trying to rolling restart that particular process 'A'. What happens next depends on whether <<PassengerResistDeploymentErrors,deployment error resistance>> is enabled:
927
-
928
- - If deployment error resistance is disabled (the default), then Passenger Enterprise will proceed with trying to restart the remaining processes.
929
- - If deployment error resistance is enabled, the Passenger Enterprise will give up rolling restarting immediately. The application group will be put into Deployment Error Resistance Mode.
930
-
931
- Please note that `passenger_rolling_restarts` is completely unrelated to the `passenger-config restart-app` command. That command always initiates a blocking restart, unless `--rolling-restart` is given.
932
-
933
- This option may occur in the following places:
934
-
935
- * In the 'http' configuration block.
936
- * In a 'server' configuration block.
937
- * In a 'location' configuration block.
938
- * In an 'if' configuration scope.
939
-
940
- In each place, it may be specified at most once. The default value is 'off'.
941
-
942
- NOTE: Are you looking to prevent applications from being restarted when you restart Nginx? That is handled by the <<flying_passenger,Flying Passenger mode>>, not by the rolling restarts feature.
180
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_rolling_restarts
943
181
 
944
182
  [[PassengerResistDeploymentErrors]]
945
183
  ==== passenger_resist_deployment_errors <on|off>
946
- :version: 3.0.0
947
- include::users_guide_snippets/enterprise_only.txt[]
948
-
949
- Enables or disables resistance against deployment errors.
950
-
951
- Suppose you've upgraded your application and you've issued a command to restart it (e.g. by touching restart.txt), but the application code contains an error that prevents Phusion Passenger from successfully spawning a process (e.g. a syntax error). Phusion Passenger would normally display an error message in response to this.
952
-
953
- By enabling deployment error resistance, Phusion Passenger Enterprise would instead do this:
954
-
955
- - It passes the request to one of the existing application processes (that belong to the previous version of the application). The visitor will not see a Phusion Passenger process spawning error message.
956
- - It logs the error to the global web server error log file.
957
- - It sets an internal flag so that no processes for this application will be spawned (even when the current traffic would normally result in more processes being spawned) and no processes will be idle cleaned. Processes *could* still be shutdown because of other events, e.g. because their <<PassengerMemoryLimit,memory limit>> have been reached. You can see whether the flag is set by invoking `passenger-status`. If you see the message "Resisting deployment error" then the flag is set.
958
-
959
- This way, visitors will suffer minimally from deployment errors. Phusion Passenger will attempt to restart the application again next time restart.txt is touched, or when you issue the `passenger-config restart-app` command.
960
-
961
- Enabling deployment error resistance only works if <<PassengerRollingRestarts,rolling restart>> is also enabled.
962
184
 
963
- This option may occur in the following places:
964
-
965
- * In the 'http' configuration block.
966
- * In a 'server' configuration block.
967
- * In a 'location' configuration block.
968
- * In an 'if' configuration scope.
969
-
970
- In each place, it may be specified at most once. The default value is 'off'.
185
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_resist_deployment_errors
971
186
 
972
187
  === Security options ===
973
188
  [[PassengerUserSwitching]]
974
189
  ==== passenger_user_switching <on|off> ====
975
- Whether to enable <<user_switching,user switching support>>.
976
-
977
- This option may only occur once, in the 'http' configuration block.
978
- The default value is 'on'.
979
-
980
- NOTE: This option has no effect when you are using <<flying_passenger,Flying Passenger>>. You can disable user switching for Flying Passenger by starting the Flying Passenger daemon as a non-root user.
981
190
 
982
- WARNING: If you're on Red Hat or CentOS, be sure to read <<user_switching_rpm_caveats,the Red Hat and CentOS user switching caveats>>.
191
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_user_switching
983
192
 
984
193
  [[PassengerUser]]
985
194
  ==== passenger_user <username> ====
986
- If <<user_switching,user switching support>> is enabled, then Phusion Passenger will
987
- by default run the web application as the owner of the file 'config/environment.rb'
988
- (for Rails apps) or 'config.ru' (for Rack apps). This option allows you to override
989
- that behavior and explicitly set a user to run the web application as, regardless
990
- of the ownership of 'environment.rb'/'config.ru'.
991
195
 
992
- This option may occur in the following places:
993
-
994
- * In the 'http' configuration block.
995
- * In a 'server' configuration block.
996
- * In a 'location' configuration block.
997
- * In an 'if' configuration scope.
998
-
999
- In each place, it may be specified at most once.
196
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_user
1000
197
 
1001
198
  [[PassengerGroup]]
1002
199
  ==== passenger_group <group name> ====
1003
- If <<user_switching,user switching support>> is enabled, then Phusion Passenger will
1004
- by default run the web application as the primary group of the owner of the file
1005
- 'config/environment.rb' (for Rails apps) or 'config.ru' (for Rack apps). This option
1006
- allows you to override that behavior and explicitly set a group to run the web application
1007
- as, regardless of the ownership of 'environment.rb'/'config.ru'.
1008
-
1009
- '<group name>' may also be set to the special value '!STARTUP_FILE!', in which case
1010
- the web application's group will be set to 'environment.rb'/'config.ru''s group.
1011
-
1012
- This option may occur in the following places:
1013
200
 
1014
- * In the 'http' configuration block.
1015
- * In a 'server' configuration block.
1016
- * In a 'location' configuration block.
1017
- * In an 'if' configuration scope.
1018
-
1019
- In each place, it may be specified at most once.
201
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_group
1020
202
 
1021
203
  [[PassengerDefaultUser]]
1022
204
  ==== passenger_default_user <username> ====
1023
- Phusion Passenger enables <<user_switching,user switching support>> by default.
1024
- This configuration option allows one to specify the user that applications must
1025
- run as, if user switching fails or is disabled.
1026
-
1027
- This option may only occur once, in the 'http' configuration block.
1028
- The default value is 'nobody'.
1029
205
 
1030
- NOTE: This option has no effect when you are using <<flying_passenger,Flying Passenger>>. There is currently no way to set this option when using Flying Passenger, but if you want to disable user switching for Flying Passenger then you can do so by starting the Flying Passenger daemon as a non-root user.
206
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_default_user
1031
207
 
1032
208
  [[PassengerDefaultGroup]]
1033
209
  ==== Passenger_default_group <group name> ====
1034
- Phusion Passenger enables <<user_switching,user switching support>> by default.
1035
- This configuration option allows one to specify the group that applications must
1036
- run as, if user switching fails or is disabled.
1037
210
 
1038
- This option may only occur once, in the 'http' configuration block.
1039
- The default value is the primary group of the user specifified by
1040
- <<PassengerDefaultUser,passenger_default_user>>.
1041
-
1042
- NOTE: This option has no effect when you are using <<flying_passenger,Flying Passenger>>. There is currently no way to set this option when using Flying Passenger, but if you want to disable user switching for Flying Passenger then you can do so by starting the Flying Passenger daemon as a non-root user.
211
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_default_group
1043
212
 
1044
213
  ==== passenger_show_version_in_header <on|off> ====
1045
- When turned on, Phusion Passenger will output its version number in the `Server` and `X-Powered-By` header in all Phusion Passenger-served requests:
1046
-
1047
- ----------------------------------------------------
1048
- Server: nginx/1.3.11 + Phusion Passenger 4.0.0
1049
- X-Powered-By: Phusion Passenger 4.0.0
1050
- ----------------------------------------------------
1051
214
 
1052
- When turned off, the version number will be hidden:
1053
-
1054
- ----------------------------------------------------
1055
- Server: nginx/1.3.11 + Phusion Passenger
1056
- X-Powered-By: Phusion Passenger
1057
- ----------------------------------------------------
1058
-
1059
- This option may only occur once, in the 'http' configuration block.
1060
- The default value is 'on'.
215
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_show_version_in_header
1061
216
 
1062
217
  [[PassengerFriendlyErrorPages]]
1063
218
  ==== passenger_friendly_error_pages <on|off> ====
1064
- Phusion Passenger can display friendly error pages whenever an application fails
1065
- to start. This friendly error page presents the startup error message, some
1066
- suggestions for solving the problem, a backtrace and a dump of the environment variables.
1067
- This feature is very useful during application development and useful for less experienced
1068
- system administrators, but the page might reveal potentially sensitive information,
1069
- depending on the application. For this reason, friendly error pages are turned off by default when
1070
- <<PassengerAppEnv,passenger_app_env (and its aliases such as rails_env and rack_env)>>
1071
- is set to 'staging' or 'production', but enabled by default otherwise. You can use
1072
- this option to explicitly enable or disable this feature.
1073
-
1074
- This option may occur in the following places:
1075
219
 
1076
- * In the 'http' configuration block.
1077
- * In a 'server' configuration block.
1078
- * In a 'location' configuration block.
1079
- * In an 'if' configuration scope.
1080
-
1081
- In each place, it may be specified at most once. The default value depends on <<PassengerAppEnv,passenger_app_env (and its aliases such as rails_env and rack_env)>>, as documented above.
220
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_friendly_error_pages
1082
221
 
1083
222
  === Resource control and optimization options ===
1084
223
  [[PassengerMaxPoolSize]]
1085
224
  ==== passenger_max_pool_size <integer> ====
1086
- The maximum number of <<application_process,application processes>> that may
1087
- simultaneously exist. A larger number results in higher memory usage,
1088
- but improves the ability to handle concurrent HTTP requests.
1089
-
1090
- The optimal value depends on your system's hardware and your workload. You can learn more at the Phusion article link:http://blog.phusion.nl/2013/03/12/tuning-phusion-passengers-concurrency-settings/[Tuning Phusion Passenger's concurrency settings].
1091
-
1092
- If you find that your server is running out of memory then you should lower this value.
1093
-
1094
- This option may only occur once, in the 'http' configuration block.
1095
- The default value is '6'.
1096
225
 
1097
- :option: `--max-pool-size`
1098
- include::users_guide_snippets/alternative_for_flying_passenger.txt[]
226
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_max_pool_size
1099
227
 
1100
228
  [[PassengerMinInstances]]
1101
229
  ==== passenger_min_instances <integer> ====
1102
- This specifies the minimum number of application processes that should exist for a
1103
- given application. You should set this option to a
1104
- non-zero value if you want to avoid potentially long startup times after a website
1105
- has been <<idle_process,idle>> for an extended period.
1106
-
1107
- Please note that this option does *not* pre-start application processes during Nginx
1108
- startup. It just makes sure that when the application is first accessed:
1109
-
1110
- 1. at least the given number of processes will be spawned.
1111
- 2. the given number of processes will be kept around even when processes are being
1112
- idle cleaned (see <<PassengerPoolIdleTime,passenger_pool_idle_time>>).
1113
-
1114
- If you want to pre-start application processes during Nginx startup, then you should use the <<PassengerPreStart,passenger_pre_start>> directive, possibly in combination with
1115
- 'passenger_min_instances'. This behavior might seem counter-intuitive at first sight,
1116
- but <<PassengerPreStart,passenger_pre_start>> explains the rationale behind it.
1117
-
1118
- For example, suppose that you have the following configuration:
1119
-
1120
- ---------------------------------
1121
- http {
1122
- ...
1123
- passenger_max_pool_size 15;
1124
- passenger_pool_idle_time 10;
1125
-
1126
- server {
1127
- listen 80;
1128
- server_name foobar.com;
1129
- root /webapps/foobar/public;
1130
- passenger_min_instances 3;
1131
- }
1132
- }
1133
- ---------------------------------
1134
-
1135
- When you start Nginx, there are 0 application processes for 'foobar.com'. Things will
1136
- stay that way until someone visits 'foobar.com'. Suppose that there is only 1 visitor.
1137
- 1 application process will be started immediately to serve the visitor, while 2 will
1138
- be spawned in the background. After 10 seconds, when the idle timeout has
1139
- been reached, these 3 application processes will not be cleaned up.
1140
-
1141
- Now suppose that there's a sudden spike of traffic, and 100 users visit 'foobar.com'
1142
- simultaneously. Phusion Passenger will start 12 more application processes. After the idle
1143
- timeout of 10 seconds have passed, Phusion Passenger will clean up 12 application
1144
- processes, keeping 3 processes around.
1145
-
1146
- The passenger_min_instances option may occur in the following places:
1147
-
1148
- * In the 'http' configuration block.
1149
- * In a 'server' configuration block.
1150
- * In a 'location' configuration block.
1151
- * In an 'if' configuration scope.
1152
-
1153
- In each place, it may be specified at most once. The default value is '1'.
230
+
231
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_min_instances
1154
232
 
1155
233
  [[PassengerMaxInstances]]
1156
234
  ==== passenger_max_instances <integer> ====
1157
- :version: 3.0.0
1158
- include::users_guide_snippets/enterprise_only.txt[]
1159
-
1160
- The maximum number of application processes that may simultaneously exist
1161
- for an application. This helps to make sure that a single application
1162
- will not occupy all available slots in the application pool.
1163
-
1164
- This value must be less than <<PassengerMaxPoolSize,passenger_max_pool_size>>. A value of 0
1165
- means that there is no limit placed on the number of processes a single application
1166
- may spawn, i.e. only the global limit of <<PassengerMaxPoolSize,passenger_max_pool_size>>
1167
- will be enforced.
1168
-
1169
- This option may occur in the following places:
1170
-
1171
- * In the 'http' configuration block.
1172
- * In a 'server' configuration block.
1173
- * In a 'location' configuration block.
1174
- * In an 'if' configuration scope.
1175
-
1176
- In each place, it may be specified at most once. The default value is '0'.
1177
-
1178
- .Practical usage example
1179
- [TIP]
1180
- ===========================================================================
1181
- Suppose that you're hosting two web applications on your server, a personal
1182
- blog and an e-commerce website. You've set <<PassengerMaxPoolSize,passenger_max_pool_size>>
1183
- to 10. The e-commerce website is more important to you. You can then set
1184
- 'passenger_max_instances' to 3 for your blog, so that it will never spawn more
1185
- than 3 processes, even if it suddenly gets a lot of traffic. Your e-commerce website
1186
- on the other hand will be free to spawn up to 10 processes if it gets a lot of traffic.
1187
- ===========================================================================
1188
235
 
1189
- ==== passenger_max_instances_per_app <integer> ====
1190
- The maximum number of application processes that may simultaneously exist
1191
- for a single application. This helps to make sure that a single application
1192
- will not occupy all available slots in the application pool.
236
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_max_instances
1193
237
 
1194
- This value must be less than <<PassengerMaxPoolSize,passenger_max_pool_size>>. A value of 0
1195
- means that there is no limit placed on the number of processes a single application
1196
- may use, i.e. only the global limit of <<PassengerMaxPoolSize,passenger_max_pool_size>>
1197
- will be enforced.
238
+ ==== passenger_max_instances_per_app <integer> ====
1198
239
 
1199
- This option may only occur once, in the 'http' configuration block.
1200
- The default value is '0'.
240
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_max_instances_per_app
1201
241
 
1202
242
  [[PassengerPoolIdleTime]]
1203
243
  ==== passenger_pool_idle_time <integer> ====
1204
- The maximum number of seconds that an application process may be idle. That is,
1205
- if an application process hasn't received any traffic after the given number of
1206
- seconds, then it will be shutdown in order to conserve memory.
1207
-
1208
- Decreasing this value means that applications will have to be spawned
1209
- more often. Since spawning is a relatively slow operation, some visitors may
1210
- notice a small delay when they visit your Rails/Rack website. However, it will also
1211
- free up resources used by applications more quickly.
1212
244
 
1213
- The optimal value depends on the average time that a visitor spends on a single
1214
- Rails/Rack web page. We recommend a value of `2 * x`, where `x` is the average
1215
- number of seconds that a visitor spends on a single Rails/Rack web page. But your
1216
- mileage may vary.
1217
-
1218
- When this value is set to '0', application processes will not be shutdown unless
1219
- it's really necessary, i.e. when Phusion Passenger is out of worker processes
1220
- for a given application and one of the <<inactive_process,inactive application processes>> needs to
1221
- make place for another application process. Setting the value to 0 is
1222
- recommended if you're on a non-shared host that's only running a few
1223
- applications, each which must be available at all times.
1224
-
1225
- This option may only occur once, in the 'http' configuration block.
1226
- The default value is '300'.
1227
-
1228
- :option: `--pool-idle-time`
1229
- include::users_guide_snippets/alternative_for_flying_passenger.txt[]
245
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_pool_idle_time
1230
246
 
1231
247
  ==== passenger_max_preloader_idle_time <integer> ====
1232
- The preloader process (explained in <<spawning_methods_explained,Spawning
1233
- methods explained>>) has an idle timeout, just like the backend processes spawned by
1234
- Phusion Passenger do. That is, it will automatically shutdown if it hasn't done
1235
- anything for a given period.
1236
-
1237
- This option allows you to set the prealoader's idle timeout, in
1238
- seconds. A value of '0' means that it should never idle timeout.
1239
248
 
1240
- Setting a higher value will mean that the preloader is kept around
1241
- longer, which may slightly increase memory usage. But as long as the
1242
- preloader is running, the time to spawn a Ruby on Rails backend
1243
- process only takes about 10% of the time that is normally needed, assuming that
1244
- you're using the 'smart' <<PassengerSpawnMethod,spawning method>>. So if your
1245
- system has enough memory, is it recommended that you set this option to a high
1246
- value or to '0'.
1247
-
1248
- This option may occur in the following places:
1249
-
1250
- * In the 'http' configuration block.
1251
- * In a 'server' configuration block.
1252
- * In a 'location' configuration block.
1253
- * In an 'if' configuration scope.
1254
-
1255
- In each place, it may be specified at most once. The default value is '300' (5 minutes).
249
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_max_preloader_idle_time
1256
250
 
1257
251
  ==== passenger_start_timeout <seconds> ====
1258
- :version: 4.0.15
1259
- include::users_guide_snippets/since_version.txt[]
1260
-
1261
- Specifies a timeout for the startup of application processes. If an application process fails to start within the timeout period then it will be forcefully killed with SIGKILL, and the error will be logged.
1262
252
 
1263
- This option may occur in the following places:
1264
-
1265
- * In the 'http' configuration block.
1266
- * In a 'server' configuration block.
1267
- * In a 'location' configuration block.
1268
- * In an 'if' configuration scope.
1269
-
1270
- In each place, it may be specified at most once. The default value is '90'.
253
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_start_timeout
1271
254
 
1272
255
  [[PassengerConcurrencyModel]]
1273
256
  ==== passenger_concurrency_model <process|thread> ====
1274
- :version: 4.0.0
1275
- include::users_guide_snippets/enterprise_only.txt[]
1276
-
1277
- Specifies the I/O concurrency model that should be used for Ruby application processes. Phusion Passenger supports two concurrency models:
1278
-
1279
- * 'process' - single-threaded, multi-processed I/O concurrency. Each application process only has a single thread and can only handle 1 request at a time. This is the concurrency model that Ruby applications traditionally used. It has excellent compatiblity (can work with applications that are not designed to be thread-safe) but is unsuitable for workloads in which the application has to wait for a lot of external I/O (e.g. HTTP API calls), and uses more memory because each process has a large memory overhead.
1280
- * 'thread' - multi-threaded, multi-processed I/O concurrency. Each application process has multiple threads (customizable via <<PassengerThreadCount,passenger_thread_count>>). This model provides much better I/O concurrency and uses less memory because threads share memory with each other within the same process. However, using this model may cause compatibility problems if the application is not designed to be thread-safe.
1281
257
 
1282
- This option has no effect on non-Ruby applications.
1283
-
1284
- This option may occur in the following places:
1285
-
1286
- * In the 'http' configuration block.
1287
- * In a 'server' configuration block.
1288
- * In a 'location' configuration block.
1289
- * In an 'if' configuration scope.
1290
-
1291
- In each place, it may be specified at most once. The default value is 'process'.
258
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_concurrency_model
1292
259
 
1293
260
  [[PassengerThreadCount]]
1294
261
  ==== passenger_thread_count <number> ====
1295
- :version: 4.0.0
1296
- include::users_guide_snippets/enterprise_only.txt[]
1297
-
1298
- Specifies the number of threads that Phusion Passenger should spawn per Ruby application process. This option only has effect if <<PassengerConcurrencyModel,passenger_concurrency_model>> is 'thread'.
1299
262
 
1300
- This option has no effect on non-Ruby applications.
1301
-
1302
- This option may occur in the following places:
1303
-
1304
- * In the 'http' configuration block.
1305
- * In a 'server' configuration block.
1306
- * In a 'location' configuration block.
1307
- * In an 'if' configuration scope.
1308
-
1309
- In each place, it may be specified at most once. The default value is '1'.
263
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_thread_count
1310
264
 
1311
265
  [[PassengerMaxRequests]]
1312
266
  ==== passenger_max_requests <integer> ====
1313
- The maximum number of requests an application process will process. After
1314
- serving that many requests, the application process will be shut down and
1315
- Phusion Passenger will restart it. A value of 0 means that there is no maximum:
1316
- an application process will thus be shut down when its idle timeout has been
1317
- reached.
1318
-
1319
- This option is useful if your application is leaking memory. By shutting
1320
- it down after a certain number of requests, all of its memory is guaranteed
1321
- to be freed by the operating system.
1322
-
1323
- This option may occur in the following places:
1324
-
1325
- * In the 'http' configuration block.
1326
- * In a 'server' configuration block.
1327
- * In a 'location' configuration block.
1328
- * In an 'if' configuration scope.
1329
-
1330
- In each place, it may be specified at most once. The default value is '0'.
1331
267
 
1332
- [CAUTION]
1333
- =====================================================
1334
- The <<PassengerMaxRequests,passenger_max_requests>> directive should be considered
1335
- as a workaround for misbehaving applications. It is advised that you fix the
1336
- problem in your application rather than relying on these directives as a
1337
- measure to avoid memory leaks.
1338
- =====================================================
268
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_max_requests
1339
269
 
1340
270
  [[PassengerMaxRequestTime]]
1341
271
  ==== passenger_max_request_time <seconds> ====
1342
- :version: 3.0.0
1343
- include::users_guide_snippets/enterprise_only.txt[]
1344
-
1345
- The maximum amount of time, in seconds, that an application process may take
1346
- to process a request. If the request takes longer than this amount of time,
1347
- then the application process will be forcefully shut down, and possibly
1348
- restarted upon the next request. A value of 0 means that there is no time limit.
1349
-
1350
- This option is useful for preventing your application from freezing for an
1351
- indefinite period of time.
1352
-
1353
- This option may occur in the following places:
1354
-
1355
- * In the 'http' configuration block.
1356
- * In a 'server' configuration block.
1357
- * In a 'location' configuration block.
1358
- * In an 'if' configuration scope.
1359
-
1360
- In each place, it may be specified at most once. The default value is '0'.
1361
-
1362
- .Example
1363
- Suppose that most of your requests are known to finish within 2 seconds.
1364
- However, there is one URI, '/expensive_computation', which is known to take up
1365
- to 10 seconds. You can then configure Phusion Passenger as follows:
1366
-
1367
- ----------------------------------------------
1368
- server {
1369
- listen 80;
1370
- server_name www.example.com;
1371
- root /webapps/my_app/public;
1372
- passenger_enabled on;
1373
- passenger_max_request_time 2;
1374
- location /expensive_compuation {
1375
- passenger_enabled on;
1376
- passenger_max_request_time 10;
1377
- }
1378
- }
1379
- ----------------------------------------------
1380
-
1381
- If a request to '/expensive_computation' takes more than 10 seconds,
1382
- or if a request to any other URI takes more than 2 seconds,
1383
- then the corresponding application process will be forced to shutdown.
1384
-
1385
- [CAUTION]
1386
- =====================================================
1387
- The <<PassengerMaxRequestTime,passenger_max_request_time>> directive should be
1388
- considered as a workaround for misbehaving applications. It is advised that you
1389
- fix the problem in your application rather than relying on these directives as a
1390
- measure to avoid freezing applications.
1391
- =====================================================
272
+
273
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_max_request_time
1392
274
 
1393
275
  [[PassengerMemoryLimit]]
1394
276
  ==== passenger_memory_limit <integer> ====
1395
- :version: 3.0.0
1396
- include::users_guide_snippets/enterprise_only.txt[]
1397
-
1398
- The maximum amount of memory that an application process may use, in megabytes.
1399
- Once an application process has surpassed its memory limit, it will process
1400
- all the requests currently present in its queue and then shut down.
1401
- A value of 0 means that there is no maximum: the application's memory usage
1402
- will not be checked.
1403
-
1404
- This option is useful if your application is leaking memory. By shutting
1405
- it down, all of its memory is guaranteed to be freed by the operating system.
1406
-
1407
- This option may occur in the following places:
1408
-
1409
- * In the 'http' configuration block.
1410
- * In a 'server' configuration block.
1411
- * In a 'location' configuration block.
1412
- * In an 'if' configuration scope.
1413
-
1414
- In each place, it may be specified at most once. The default value is '0'.
1415
-
1416
- [NOTE]
1417
- .A word about permissions
1418
- =====================================================
1419
- The <<PassengerMemoryLimit,passenger_memory_limit>> directive uses the
1420
- `ps` command to query memory usage information. On Linux, it further
1421
- queries `/proc` to obtain additional memory usage information that's
1422
- not obtainable through `ps`. You should ensure that the `ps` works
1423
- correctly and that the `/proc` filesystem is accessible by the
1424
- `PassengerAgent core` process.
1425
- =====================================================
1426
-
1427
- [CAUTION]
1428
- =====================================================
1429
- The <<PassengerMaxRequests,passenger_max_requests>> and
1430
- <<PassengerMemoryLimit,passenger_memory_limit>> directives should be considered
1431
- as workarounds for misbehaving applications. It is advised that you fix the
1432
- problem in your application rather than relying on these directives as a
1433
- measure to avoid memory leaks.
1434
- =====================================================
1435
-
1436
- ==== passenger_stat_throttle_rate <integer> ====
1437
- By default, Phusion Passenger performs several filesystem checks (or, in
1438
- programmers jargon, 'stat() calls') each time a request is processed:
1439
-
1440
- - It checks which the application <<PassengerStartupFile,startup files>> are present, in order to autodetect the application type.
1441
- - It checks whether 'restart.txt' has changed or whether 'always_restart.txt'
1442
- exists, in order to determine whether the application should be restarted.
1443
277
 
1444
- On some systems where disk I/O is expensive, e.g. systems where the harddisk is
1445
- already being heavily loaded, or systems where applications are stored on NFS
1446
- shares, these filesystem checks can incur a lot of overhead.
278
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_memory_limit
1447
279
 
1448
- You can decrease or almost entirely eliminate this overhead by setting
1449
- 'PassengerStatThrottleRate'. Setting this option to a value of 'x' means that
1450
- the above list of filesystem checks will be performed at most once every 'x'
1451
- seconds. Setting it to a value of '0' means that no throttling will take place,
1452
- or in other words, that the above list of filesystem checks will be performed on
1453
- every request.
280
+ ==== passenger_stat_throttle_rate <integer> ====
1454
281
 
1455
- This option may be specified once, in the `http` configuration block. The default value is '10'.
282
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_stat_throttle_rate
1456
283
 
1457
284
  [[PassengerPreStart]]
1458
285
  ==== passenger_pre_start <url> ====
1459
- By default, Phusion Passenger does not start any application processes until said
1460
- web application is first accessed. The result is that the first visitor of said
1461
- web application might experience a small delay as Phusion Passenger is starting
1462
- the web application on demand. If that is undesirable, then this directive can be
1463
- used to pre-started application processes during Nginx startup.
1464
-
1465
- A few things to be careful of:
1466
-
1467
- - This directive accepts the *URL* of the web application you want to pre-start,
1468
- not a on/off value! This might seem a bit weird, but read on for rationale. As
1469
- for the specifics of the URL:
1470
- * The domain part of the URL must be equal to the value of the 'server_name'
1471
- directive of the server block that defines the web application.
1472
- * Unless the web application is deployed on port 80, the URL should contain
1473
- the web application's port number too.
1474
- * The path part of the URL must point to some URI that the web application
1475
- handles.
1476
- - You will probably want to combine this option with
1477
- <<PassengerMinInstances,passenger_min_instances>> because application processes
1478
- started with 'passenger_pre_start' are subject to the usual idle timeout rules.
1479
- See the example below for an explanation.
1480
-
1481
- This option may only occur in the 'http' configuration block. It may be specified
1482
- any number of times.
1483
-
1484
- NOTE: This option is currently not available when using <<flying_passenger,Flying Passenger>>.
1485
-
1486
- ===== Example 1: basic usage =====
1487
-
1488
- Suppose that you have the following web applications.
1489
-
1490
- ---------------------------
1491
- server {
1492
- listen 80;
1493
- server_name foo.com;
1494
- root /webapps/foo/public;
1495
- passenger_enabled on;
1496
- }
1497
-
1498
- server {
1499
- listen 3500;
1500
- server_name bar.com;
1501
- root /webapps/bar/public;
1502
- passenger_enabled on;
1503
- }
1504
- ---------------------------
1505
-
1506
- You want both of them to be pre-started during Nginx startup. The URL for
1507
- foo.com is 'http://foo.com/' (or, equivalently, 'http://foo.com:80/') and
1508
- the URL for bar.com is 'http://bar.com:3500/'. So we add two passenger_pre_start
1509
- directives, like this:
1510
-
1511
- ---------------------------
1512
- server {
1513
- listen 80;
1514
- server_name foo.com;
1515
- root /webapps/foo/public;
1516
- passenger_enabled on;
1517
- }
1518
-
1519
- server {
1520
- listen 3500;
1521
- server_name bar.com;
1522
- root /webapps/bar/public;
1523
- passenger_enabled on;
1524
- }
1525
-
1526
- passenger_pre_start http://foo.com/; # <--- added
1527
- passenger_pre_start http://bar.com:3500/; # <--- added
1528
- ---------------------------
1529
-
1530
- ===== Example 2: pre-starting apps that are deployed in sub-URIs =====
1531
-
1532
- Suppose that you have a web application deployed in a sub-URI '/store', like this:
1533
-
1534
- ---------------------------
1535
- server {
1536
- listen 80;
1537
- server_name myblog.com;
1538
- root /webapps/wordpress;
1539
- passenger_base_uri /store;
1540
- }
1541
- ---------------------------
1542
-
1543
- Then specify the 'server_name' value followed by the sub-URI, like this:
1544
-
1545
- ---------------------------
1546
- server {
1547
- listen 80;
1548
- server_name myblog.com;
1549
- root /webapps/wordpress;
1550
- passenger_base_uri /store;
1551
- }
1552
-
1553
- passenger_pre_start http://myblog.com/store; # <----- added
1554
- ---------------------------
1555
-
1556
- The sub-URI *must* be included; if you don't then the directive will have no effect.
1557
- The following example is wrong and won't pre-start the store web application:
1558
-
1559
- ---------------------------
1560
- passenger_pre_start http://myblog.com/; # <----- WRONG! Missing "/store" part.
1561
- ---------------------------
1562
-
1563
- ===== Example 3: combining with passenger_min_instances =====
1564
-
1565
- Application processes started with passenger_pre_start are
1566
- also subject to the idle timeout rules as specified by
1567
- <<PassengerPoolIdleTime,passenger_pool_idle_time>>! That means that by default,
1568
- the pre-started application processes for foo.com and bar.com are shut down
1569
- after a few minutes of inactivity. If you don't want that to happen, then
1570
- you should combine passenger_pre_start with
1571
- <<PassengerMinInstances,passenger_min_instances>>, like this:
1572
-
1573
- ---------------------------
1574
- server {
1575
- listen 80;
1576
- server_name foo.com;
1577
- root /webapps/foo/public;
1578
- passenger_enabled on;
1579
- passenger_min_instances 1; # <--- added
1580
- }
1581
-
1582
- server {
1583
- listen 3500;
1584
- server_name bar.com;
1585
- root /webapps/bar/public;
1586
- passenger_enabled on;
1587
- passenger_min_instances 1; # <--- added
1588
- }
1589
-
1590
- passenger_pre_start http://foo.com/;
1591
- passenger_pre_start http://bar.com:3500/;
1592
- ---------------------------
1593
-
1594
- ===== So why a URL? Why not just an on/off flag? =====
1595
-
1596
- A directive that accepts a simple on/off flag is definitely more intuitive,
1597
- but due technical difficulties w.r.t. the way Nginx works, it's very hard
1598
- to implement it like that:
1599
-
1600
- It is very hard to obtain a full list of web applications defined in the
1601
- Nginx configuration file(s). In other words, it's hard for Phusion Passenger
1602
- to know which web applications are deployed on Nginx until a web application
1603
- is first accessed, and without such a list Phusion Passenger wouldn't know
1604
- which web applications to pre-start. So as a compromise, we made it accept a
1605
- URL.
1606
-
1607
- ===== What does Phusion Passenger do with the URL? =====
1608
-
1609
- During Nginx startup, Phusion Passenger will send a dummy HEAD request to the
1610
- given URL and discard the result. In other words, Phusion Passenger simulates a
1611
- web access at the given URL. However this simulated request is always sent to
1612
- localhost, *not* to the IP that the domain resolves to. Suppose that bar.com
1613
- in example 1 resolves to 209.85.227.99; Phusion Passenger will
1614
- send the following HTTP request to 127.0.0.1 port 3500 (and not to 209.85.227.99
1615
- port 3500):
1616
-
1617
- ----------------------
1618
- HEAD / HTTP/1.1
1619
- Host: bar.com
1620
- Connection: close
1621
- ----------------------
1622
-
1623
- Similarly, for example 2, Phusion Passenger will send the following HTTP request
1624
- to 127.0.0.1 port 80:
1625
-
1626
- ----------------------
1627
- HEAD /store HTTP/1.1
1628
- Host: myblog.com
1629
- Connection: close
1630
- ----------------------
1631
-
1632
- ===== Do I need to edit /etc/hosts and point the domain in the URL to 127.0.0.1? =====
1633
-
1634
- No. See previous subsection.
1635
-
1636
- ===== My web application consists of multiple web servers. What URL do I need to specify, and in which web server's Nginx config file? =====
1637
-
1638
- Put the web application's 'server_name' value and the server block's
1639
- port in the URL, and put
1640
- passenger_pre_start on all machines that you want to pre-start the web application
1641
- on. The simulated web request is always sent to 127.0.0.1, with the domain name
1642
- in the URL as value for the 'Host' HTTP header, so you don't need to worry about
1643
- the request ending up at a different web server in the cluster.
1644
-
1645
- ===== Does passenger_pre_start support https:// URLs? =====
1646
-
1647
- Yes. And it does not perform any certificate validation.
286
+
287
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_pre_start
1648
288
 
1649
289
 
1650
290
  === Connection handling options ===
1651
291
 
1652
292
  [[PassengerSetHeader]]
1653
293
  ==== passenger_set_header <HTTP header name> <value> ====
1654
- Sets additional HTTP headers to pass to the web application. This is comparable to ngx_http_proxy_module's 'proxy_set_header' option. Nginx variables in the value are interpolated.
1655
-
1656
- Example:
1657
-
1658
- -------------------------
1659
- server {
1660
- server_name www.foo.com;
1661
- root /webapps/foo/public;
1662
- passenger_enabled on;
1663
-
1664
- passenger_set_header X-Power-Level 9000;
1665
- passenger_set_header X-Forwarded-For internal-router.foo.com;
1666
- }
1667
- -------------------------
1668
-
1669
- .This configuration option is NOT inherited across contexts
1670
- [WARNING]
1671
- ===============================================
1672
- In each new context (e.g. in each new 'location' block), you must re-specify `passenger_set_header`. Values set in parent contexts have no effect on subcontexts. For example:
1673
-
1674
- ------------------------------
1675
- server {
1676
- ...
1677
- passenger_set_header X-Foo foo;
1678
-
1679
- location /users {
1680
- passenger_enabled on;
1681
- # !!!THIS IS WRONG!!! The 'X-Foo' header will not
1682
- # be passed URLs beginning with /users because we didn't
1683
- # re-specify passenger_set_header.
1684
- }
1685
-
1686
- location /apps {
1687
- passenger_enabled on;
1688
- # This is correct. Here we re-specify passenger_set_header,
1689
- # so the 'X-Foo' header will be correctly passed to URLs
1690
- # starting with /apps.
1691
- passenger_set_header X-Foo foo;
1692
- }
1693
- }
1694
- ------------------------------
1695
- ===============================================
1696
-
1697
- This option may occur in the following places:
1698
-
1699
- * In a 'server' configuration block.
1700
- * In a 'location' configuration block.
1701
- * In an 'if' configuration scope.
1702
-
1703
- In each place, it may be specified multiple times.
294
+
295
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_set_header
1704
296
 
1705
297
  [[passenger_max_request_queue_size]]
1706
298
  ==== passenger_max_request_queue_size <number> ====
1707
- :version: 4.0.15
1708
- include::users_guide_snippets/since_version.txt[]
1709
-
1710
- When all application processes are already handling their maximum number of concurrent requests, Phusion Passenger will queue all incoming requests. This option specifies the maximum size for that queue. If the queue is already at this specified limit, then Phusion Passenger will immediately send a "503 Service Unavailable" error to any incoming requests. You may use <<passenger_request_queue_overflow_status_code,passenger_request_queue_overflow_status_code>> to customize the response status.
1711
299
 
1712
- A value of 0 means that the queue is unbounded.
1713
-
1714
- link:http://stackoverflow.com/questions/20402801/what-is-optimal-value-for-phusion-passenger-passengermaxrequestqueuesize[This article on StackOverflow] explains how the request queue works, what it means for the queue to grow or become full, why that is bad, and what you can do about it.
1715
-
1716
- You may combine this option with <<passenger_intercept_errors,passenger_intercept_errors>> and `error_page` to set a custom error page whenever the queue is full. In the following example, Nginx will serve /error503.html whenever the queue is full:
1717
-
1718
- ---------------------------------
1719
- passenger_intercept_errors on;
1720
- error_page 503 /error503.html;
1721
- ---------------------------------
1722
-
1723
- This option may occur in the following places:
1724
-
1725
- * In the 'http' configuration block.
1726
- * In a 'server' configuration block.
1727
- * In a 'location' configuration block.
1728
- * In an 'if' configuration scope.
1729
-
1730
- In each place, it may be specified at most once. The default value is '100'.
300
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_max_request_queue_size
1731
301
 
1732
302
  [[passenger_request_queue_overflow_status_code]]
1733
303
  ==== passenger_request_queue_overflow_status_code <code> ====
1734
- :version: 4.0.15
1735
- include::users_guide_snippets/since_version.txt[]
1736
-
1737
- This option allows you to customize the HTTP status code that is sent back when the request queue is full. See <<passenger_max_request_queue_size,passenger_max_request_queue_size>> for more information.
1738
304
 
1739
- This option may occur in the following places:
1740
-
1741
- * In the 'http' configuration block.
1742
- * In a 'server' configuration block.
1743
- * In a 'location' configuration block.
1744
- * In an 'if' configuration scope.
1745
-
1746
- In each place, it may be specified at most once. The default value is '503'.
305
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_request_queue_overflow_status_code
1747
306
 
1748
307
  [[PassengerStickySessions]]
1749
308
  ==== passenger_sticky_sessions <on|off>
1750
- :version: 4.0.45
1751
- include::users_guide_snippets/since_version.txt[]
1752
-
1753
- When sticky sessions are enabled, all requests that a client sends will be routed to the same originating application process, whenever possible. When sticky sessions are disabled, requests may be distributed over multiple processes, and may not necessarily be routed to the originating process, in order to balance traffic over multiple CPU cores. Because of this, sticky sessions should only be enabled in specific circumstances.
1754
-
1755
- For applications that store important state inside the process's own memory -- that is, as opposed to storing state in a distributed data store, such as the database or Redis -- sticky sessions *should* be enabled. This is because otherwise, some requests could be routed to a different process, which stores different state data. Because processes don't share memory with each other, there's no way for one process to know about the state in another process, and then things can go wrong.
1756
-
1757
- One prominent example is the popular link:http://sockjs.org/[SockJS library], which is capable of emulating WebSockets through long polling. This is implemented through two HTTP endpoints, `/SESSION_ID/xhr_stream` (a long polling end point which sends data from the server to the client), and `/SESSION_ID/xhr_send` (a normal POST endpoint which is used for sending data from the client to the server). SockJS correlates the two requests with each other through a session identifier. At the same time, in its default configuration, it stores all known session identifiers in an in-memory data structure. It is therefore important that a particular `/SESSION_ID/xhr_send` request is sent to the same process where the corresponding `/SESSION_ID/xhr_stream` request originates from; otherwise, SockJS cannot correlate the two requests, and an error occurs.
1758
-
1759
- So prominent examples where sticky sessions should (or even *must*) be enabled, include:
1760
-
1761
- * Applications that use the SockJS library (unless configured with a distributed data store)
1762
- * Applications that use the Socket.io library (unless configured with a distributed data store)
1763
- * Applications that use the faye-websocket gem (unless configured with a distributed data store)
1764
- * Meteor JS applications (because Meteor uses SockJS)
1765
-
1766
- Sticky sessions work through the use of a special cookie, whose name can be customized with <<PassengerStickySessionsCookieName,passenger_sticky_sessions_cookie_name>>. Phusion Passenger puts an identifier in this cookie, which tells Phusion Passenger what the originating process is. Next time the client sends a request, Phusion Passenger reads this cookie and uses the value in the cookie to route the request back to the originating process. If the originating process no longer exists (e.g. because it has crashed or restarted) then Phusion Passenger will route the request to some other process, and reset the cookie.
1767
309
 
1768
- If you have a load balancer in front end of Phusion Passenger + Nginx, then you must configure sticky sessions on that load balancer too. Otherwise, the load balancer could route the request to a different server.
1769
-
1770
- This option may occur in the following places:
1771
-
1772
- * In the `http` configuration block.
1773
- * In a `server` configuration block.
1774
- * In a `location` configuration block.
1775
- * In an `if` configuration scope.
1776
-
1777
- In each place, it may be specified at most once. The default value is `off`.
310
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_sticky_sessions
1778
311
 
1779
312
  [[PassengerStickySessionsCookieName]]
1780
313
  ==== passenger_sticky_sessions_cookie_name
1781
- :version: 4.0.45
1782
- include::users_guide_snippets/since_version.txt[]
1783
-
1784
- Sets the name of the <<PassengerStickySessions,sticky sessions>> cookie.
1785
314
 
1786
- This option may occur in the following places:
1787
-
1788
- * In the `http` configuration block.
1789
- * In a `server` configuration block.
1790
- * In a `location` configuration block.
1791
- * In an `if` configuration scope.
1792
-
1793
- In each place, it may be specified at most once. The default value is `_passenger_route`.
315
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_sticky_sessions_cookie_name
1794
316
 
1795
317
  ==== passenger_ignore_client_abort <on|off> ====
1796
- Normally, when the HTTP client aborts the connection (e.g. when the user clicked on "Stop"
1797
- in the browser), the connection with the application process will be closed too. If the
1798
- application process continues to send its response, then that will result in EPIPE errors
1799
- in the application, which will be printed in the error log if the application doesn't
1800
- handle them gracefully.
1801
-
1802
- If this option is turned on then upon client abort Phusion Passenger will continue to
1803
- read the application process's response while discarding all the read data. This prevents
1804
- EPIPE errors but it'll also mean the backend process will be unavailable for new requests
1805
- until it is done sending its response.
1806
318
 
1807
- This option may occur in the following places:
1808
-
1809
- * In the 'http' configuration block.
1810
- * In a 'server' configuration block.
1811
- * In a 'location' configuration block.
1812
- * In an 'if' configuration scope.
1813
-
1814
- In each place, it may be specified at most once. The default value is 'off'.
319
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_ignore_client_abort
1815
320
 
1816
321
  [[passenger_intercept_errors]]
1817
322
  ==== passenger_intercept_errors <on|off> ====
1818
- :version: 4.0.15
1819
- include::users_guide_snippets/since_version.txt[]
1820
-
1821
- Decides if Nginx will intercept responses with HTTP status codes of 400 and higher.
1822
-
1823
- By default, all responses are sent as-is from the application or from the Phusion Passenger core. If you turn this option on then Nginx will be able to handle such responses using the Nginx `error_page` option. Responses with status codes that do not match an `error_page` option are sent as-is.
1824
323
 
1825
- This option may occur in the following places:
1826
-
1827
- * In the 'http' configuration block.
1828
- * In a 'server' configuration block.
1829
- * In a 'location' configuration block.
1830
- * In an 'if' configuration scope.
1831
-
1832
- In each place, it may be specified at most once. The default value is 'off'.
324
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_intercept_errors
1833
325
 
1834
326
  ==== passenger_pass_header <header name> ====
1835
- Some headers generated by backend applications are not forwarded to the HTTP client,
1836
- e.g. 'X-Accel-Redirect' which is directly processed by Nginx and then discarded from
1837
- the final response. This directive allows one to force Nginx to pass those headers
1838
- anyway, similar to how 'proxy_pass_header' works.
1839
-
1840
- For example:
1841
-
1842
- ------------------------------
1843
- location / {
1844
- passenger_pass_header X-Accel-Redirect;
1845
- }
1846
- ------------------------------
1847
327
 
1848
- This option may occur in the following places:
1849
-
1850
- * In the 'http' configuration block.
1851
- * In a 'server' configuration block.
1852
- * In a 'location' configuration block.
1853
- * In an 'if' configuration scope.
328
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_pass_header-header-name
1854
329
 
1855
330
  ==== passenger_ignore_headers <header names...> ====
1856
- Disables processing of certain response header fields from the application, similar to how 'proxy_ignore_headers' works.
1857
-
1858
- This option may occur in the following places:
1859
331
 
1860
- * In the 'http' configuration block.
1861
- * In a 'server' configuration block.
1862
- * In a 'location' configuration block.
1863
- * In an 'if' configuration scope.
332
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_ignore_headers
1864
333
 
1865
334
  ==== passenger_headers_hash_bucket_size <size> ====
1866
- Sets the bucket size of the hash tables used by the <<PassengerSetHeader,passenger_set_header>> directive. The details of setting up hash tables are can be found in link:http://nginx.org/en/docs/hash.html[the Nginx documentation].
1867
-
1868
- This option may occur in the following places:
1869
-
1870
- * In the 'http' configuration block.
1871
- * In a 'server' configuration block.
1872
- * In a 'location' configuration block.
1873
- * In an 'if' configuration scope.
1874
335
 
1875
- In each place, it may be specified at most once. The default value is '64'.
336
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_headers_hash_bucket_size
1876
337
 
1877
338
  ==== passenger_headers_hash_max_size <size> ====
1878
- Sets the maximum size of the hash tables used by the <<PassengerSetHeader,passenger_set_header>> directive. The details of setting up hash tables are can be found in link:http://nginx.org/en/docs/hash.html[the Nginx documentation].
1879
339
 
1880
- This option may occur in the following places:
1881
-
1882
- * In the 'http' configuration block.
1883
- * In a 'server' configuration block.
1884
- * In a 'location' configuration block.
1885
- * In an 'if' configuration scope.
1886
-
1887
- In each place, it may be specified at most once. The default value is '512'.
340
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_headers_hash_max_size
1888
341
 
1889
342
  [[passenger_buffer_response]]
1890
343
  ==== passenger_buffer_response <on|off> ====
1891
- When turned on, application-generated responses are buffered by Nginx. Buffering will
1892
- happen in memory and also on disk if the response is larger than a certain threshold.
1893
-
1894
- Before we proceed with explaining this configuration option, we want to state the following to avoid confusion. If you use Phusion Passenger for Nginx, there are in fact two response buffering systems active:
1895
-
1896
- 1. The Nginx response buffering system. `passenger_buffer_response` turns this on or off.
1897
- 2. The Phusion Passenger response buffering system, a.k.a. 'real-time disk-backed response buffering'. This buffering system is always on, regardless of the value of `passenger_buffer_response`, but its behavior can be tweaked with <<PassengerResponseBufferHighWatermark,passenger_response_buffer_high_watermark>>.
1898
-
1899
- Response buffering is useful because it protects against slow HTTP clients that do not read responses immediately or quickly enough. Buffering prevents such slow clients from blocking web applications that have limited concurrency. Because Phusion Passenger's response buffering is always turned on, you are always protected. Therefore, `passenger_buffer_response` is off by default, and you never should have to turn it on.
1900
-
1901
- If for whatever reason you want to turn Nginx-level response buffering on, you can do so with this option.
1902
-
1903
- Nginx's response buffering works differently from Phusion Passenger's. Nginx's buffering system buffers the entire response before attempting to send it to the client, while Phusion Passenger's attempts to send the data to the client immediately. Therefore, if you turn on `passenger_buffer_response`, you may interfere with applications that want to stream responses to the client.
1904
-
1905
- How does response buffering - whether it's done by Nginx or by Phusion Passenger - exactly protect against slow clients?
1906
- Consider an HTTP client that's on a dial-up modem link, and your
1907
- application process generates a 2 MB response. If the response is not buffered
1908
- then your application process will be blocked until the entire 2 MB has been
1909
- sent out to the HTTP client. This disallows your application process to do any useful
1910
- work in the mean time. By buffering responses, Phusion Passenger or Nginx will read
1911
- the application response as quickly as possible and will take care of forwarding the data
1912
- to slow clients.
1913
-
1914
- So keep in mind that enabling `passenger_buffering_response` will make streaming responses
1915
- impossible. Consider for example this piece of Rails code:
1916
-
1917
- --------------------------------
1918
- render :text => lambda { |response, output|
1919
- 10.times do |i|
1920
- output.write("entry #{i}\n")
1921
- output.flush
1922
- sleep 1
1923
- end
1924
- }
1925
- --------------------------------
1926
-
1927
- ...or this piece of Rack code:
1928
-
1929
- --------------------------------
1930
- class Response
1931
- def each
1932
- 10.times do |i|
1933
- yield("entry #{i}\n")
1934
- sleep 1
1935
- end
1936
- end
1937
- end
1938
-
1939
- app = lambda do |env|
1940
- [200, { "Content-Type" => "text/plain" }, Response.new]
1941
- end
1942
- --------------------------------
1943
-
1944
- When `passenger_buffer_response` is turned on, Nginx will wait until
1945
- the application is done sending the entire response before forwarding it
1946
- to the client. The client will not receive anything for 10 seconds,
1947
- after which it receives the entire response at once.
1948
- When `passenger_buffer_response` is turned off, it works as expected: the client
1949
- receives an "entry X" message every second for 10 seconds.
1950
-
1951
- This option may occur in the following places:
1952
-
1953
- * In the 'http' configuration block.
1954
- * In a 'server' configuration block.
1955
- * In a 'location' configuration block.
1956
- * In an 'if' configuration scope.
1957
-
1958
- In each place, it may be specified at most once. The default value is 'off'.
344
+
345
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_buffer_response
1959
346
 
1960
347
  [[PassengerResponseBufferHighWatermark]]
1961
348
  ==== passenger_response_buffer_high_watermark <bytes>
1962
- :version: 5.0.0
1963
- include::users_guide_snippets/since_version.txt[]
1964
349
 
1965
- As explained in <<passenger_buffer_response,passenger_buffer_response>>, Phusion Passenger has two response buffering mechanisms. This option configures the maximum size of the real-time disk-backed response buffering system. If the buffer is full, the application will be blocked until the client has fully read the buffer.
1966
-
1967
- This buffering system has a default size of *128 MB* (134217728 bytes). This default value is large enough to prevent most applications from blocking on slow clients, but small enough to prevent broken applications from filling up the hard disk.
1968
-
1969
- You can't disable real-time disk-backed response buffering, but you can set the buffer size to a small value, which is effectively the same as disabling it.
1970
-
1971
- Most of the time, you won't need to tweak this value. But there is one good use case where you may want set this option to a low value: if you are streaming a large response, but want to detect client disconnections as soon as possible. If the buffer size is larger than your response size, then Phusion Passenger will read and buffer the response as fast as it can, offloading the application as soon as it can, thereby preventing the application from detecting client disconnects. But if the buffer size is sufficiently small (say, 64 KB), then your application will effectively output response data at the same speed as the client reads it, allowing you to detect client disconnects almost immediately. This is also a down side, because many slow clients blocking your application can result in a denial of service, so use this option with care.
1972
-
1973
- If your application outputs responses larger than 128 MB and you are not interested in detecting client disconnects as soon as possible, then you should raise this value, or set it to 0.
1974
-
1975
- A value of 0 means that the buffer size is unlimited.
1976
-
1977
- This option may only occur once, in the 'http' configuration block. The default value is '134217728' (128 MB).
350
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_response_buffer_high_watermark
1978
351
 
1979
352
  ==== passenger_buffer_size ====
1980
353
  ==== passenger_buffers ====
1981
354
  ==== passenger_busy_buffers_size ====
1982
- These options have the same effect as ngx_http_proxy_module's similarly named options.
1983
- They can be used to modify the maximum allowed HTTP header size.
355
+
356
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_buffer_size-passenger_buffers-passenger_busy_buffers_size
1984
357
 
1985
358
 
1986
359
  === Logging and debugging options ===
1987
360
 
1988
361
  [[PassengerLogLevel]]
1989
362
  ==== passenger_log_level <integer> ====
1990
- This option allows one to specify how much information Phusion Passenger should
1991
- write to the Nginx error log file. A higher log level value means that more
1992
- information will be logged.
1993
-
1994
- Possible values are:
1995
363
 
1996
- - '0' (crit): Show only critical errors which would cause Phusion Passenger to abort.
1997
- - '1' (error): Also show non-critical errors -- errors that do not cause Phusion Passenger to abort.
1998
- - '2' (warn): Also show warnings. These are not errors, and Phusion Passenger continues to operate correctly, but they might be an indication that something is wrong with the system.
1999
- - '3' (notice): Also show important informational messages. These give you a high-level overview of what Phusion Passenger is doing.
2000
- - '4' (info): Also show less important informational messages. These messages show more details about what Phusion Passenger is doing. They're high-level enough to be readable by users.
2001
- - '5' (debug): Also show the most important debugging information. Reading this information requires some system or programming knowledge, but the information shown is typically high-level enough to be understood by experienced system administrators.
2002
- - '6' (debug2): Show more debugging information. This is typically only useful for developers.
2003
- - '7' (debug3): Show even more debugging information.
2004
-
2005
- This option may only occur once, in the 'http' configuration block. The default is '3'.
364
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_log_level
2006
365
 
2007
366
  [[PassengerLogFile]]
2008
367
  ==== passenger_log_file <filename> ====
2009
- :version: 5.0.5
2010
- include::users_guide_snippets/since_version.txt[]
2011
-
2012
- By default Phusion Passenger log messages are written to the global web server error log. With this option, you can have those messages logged to a different file instead.
2013
368
 
2014
- This option may only occur once, in the 'http' configuration block.
2015
-
2016
- :option: `--log-file`
2017
- include::users_guide_snippets/alternative_for_flying_passenger.txt[]
369
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_log_file
2018
370
 
2019
371
  ==== PassengerFileDescriptorLogFile <filename>
2020
- :version: 5.0.5
2021
- include::users_guide_snippets/since_version.txt[]
2022
-
2023
- Log file descriptor debug tracing messages to the given file.
2024
-
2025
- Phusion Passenger has the ability to log all file descriptors that it opens and closes. These logs are useful to the Phusion Passenger developers for the purpose of analyzing file descriptor leaks.
2026
-
2027
- File descriptor activity is logged as follows:
2028
-
2029
- * If `passenger_file_descriptor_log_file` is not set, then file descriptor activity is logged to the <<PassengerLogFile,main log file>>, but only if the <<PassengerLogLevel,log level>> is 5 (debug) or higher.
2030
- * If `passenger_file_descriptor_log_file` is set, then file descriptor activity is logged to the specified file, regardless of the log level.
2031
372
 
2032
- This option may only occur once, in the 'http' configuration block.
2033
-
2034
- :option: `--file-descriptor-log-file`
2035
- include::users_guide_snippets/alternative_for_flying_passenger.txt[]
373
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_file_descriptor_log_file
2036
374
 
2037
375
  ==== passenger_debugger <on|off> ====
2038
- :version: 3.0.0
2039
- include::users_guide_snippets/enterprise_only.txt[]
2040
-
2041
- Turns support for application debugging on or off. In case of Ruby applications,
2042
- turning this option on will cause them to load the `ruby-debug` gem (when on Ruby 1.8),
2043
- the `debugger` gem (when on Ruby 1.9) or the `byebug` gem (when on Ruby 2.0). If you're
2044
- using Bundler, you should add this to your Gemfile:
2045
-
2046
- -------------------------------------------
2047
- gem 'ruby-debug', :platforms => :ruby_18
2048
- gem 'debugger', :platforms => :ruby_19
2049
- gem 'byebug', :platforms => :ruby_20
2050
- -------------------------------------------
2051
-
2052
- Once debugging is turned on, you can use the command `passenger-irb --debug <PID>` to attach an rdebug console to the application process with the given PID. Attaching will succeed once the application process executes a `debugger` command.
2053
376
 
2054
- This option may occur in the following places:
2055
-
2056
- * In the 'http' configuration block.
2057
- * In a 'server' configuration block.
2058
- * In a 'location' configuration block.
2059
- * In an 'if' configuration scope.
2060
-
2061
- In each place, it may be specified at most once. The default value is 'off'.
377
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_debugger
2062
378
 
2063
379
 
2064
380
  === Advanced options
2065
381
 
2066
382
  [[PassengerInstanceRegistryDir]]
2067
383
  ==== passenger_instance_registry_dir <directory>
2068
- :version: 5.0.0
2069
- include::users_guide_snippets/since_version.txt[]
2070
-
2071
- Specifies the directory that Phusion Passenger should use for registering its current instance.
2072
-
2073
- When Phusion Passenger starts up, it creates a temporary directory inside the 'instance registry directory'. This temporary directory is called the 'instance directory'. It contains all sorts of files that are important to that specific running Phusion Passenger instance, such as Unix domain socket files so that all the different Phusion Passenger processes can communicate with each other. Command line tools such as `passenger-status` use the files in this directory in order to query Phusion Passenger's status.
2074
-
2075
- It is therefore important that, while Phusion Passenger is working, the instance directory is never removed or tampered with. However, the default path for the instance registry directory is the system's temporary directory, and some systems may run background jobs that periodically clean this directory. If this happens, and the files inside the instance directory are removed, then it will cause Phusion Passenger to malfunction: Phusion Passenger won't be able to communicate with its own processes, and you will see all kinds of connection errors in the log files. This malfunction can only be recovered from by restarting Nginx. You can prevent such cleaning background jobs from interfering by setting this option to a different directory.
2076
-
2077
- This option is also useful if the partition that the temporary directory lives on doesn't have enough disk space.
2078
-
2079
- The instance directory is automatically removed when Nginx shuts down.
2080
-
2081
- This option may be specified once, in the `http` configuration block. The default value is as follows:
2082
-
2083
- * If you are on Red Hat and CentOS, and installed Passenger through the RPMs provided by Phusion, then the default value is `/var/run/passenger-instreg`.
2084
- * Otherwise, the default value is the value of the `$TMPDIR` environment variable. Or, if `$TMPDIR` is not set, `/tmp`.
2085
-
2086
- :option: `--instance-registry-dir`
2087
- include::users_guide_snippets/alternative_for_flying_passenger.txt[]
2088
-
2089
- .Note regarding command line tools
2090
- Some Phusion Passenger command line administration tools, such as `passenger-status`, must know what Phusion Passenger's instance registry directory is in order to function properly. You can pass the directory through the `PASSENGER_INSTANCE_REGISTRY_DIR` environment variable or the `TMPDIR` environment variable.
2091
384
 
2092
- For example, if you set 'passenger_instance_registry_dir' to '/my_temp_dir', then invoke `passenger-status` after you've set the `PASSENGER_INSTANCE_REGISTRY_DIR`, like this:
2093
-
2094
- ----------------------------------------------------------
2095
- export PASSENGER_INSTANCE_REGISTRY_DIR=/my_temp-dir
2096
- sudo -E passenger-status
2097
- ----------------------------------------------------------
2098
-
2099
- Notes regarding the above example:
2100
-
2101
- * The -E option tells 'sudo' to preserve environment variables.
2102
- * If Phusion Passenger is installed through an RVM Ruby, then you must use `rvmsudo` instead of `sudo`.
385
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_instance_registry_dir
2103
386
 
2104
387
  [[PassengerDataBufferDir]]
2105
388
  ==== passenger_data_buffer_dir <directory>
2106
- :version: 5.0.0
2107
- include::users_guide_snippets/since_version.txt[]
2108
-
2109
- By default, Phusion Passenger buffers large web application responses. This prevents slow HTTP clients from blocking web applications by reading responses very slowly. This feature is also known as 'real-time disk-backed response buffering'.
2110
-
2111
- By default, such buffers are stored in the directory given by the `$TMPDIR` environment variable, or (if `$TMPDIR` is not set) the `/tmp` directory. This configuration directive allows you to specify a different directory.
2112
-
2113
- Changing this option is especially useful if the partition that the default directory lives on doesn't have enough disk space.
2114
-
2115
- If you've specified such a directory (as opposed to using Phusion Passenger's default) then you *must* ensure that this directory exists.
2116
-
2117
- This option may be specified once, in the `http` configuration block.
2118
389
 
2119
- :option: `--data-buffer-dir`
2120
- include::users_guide_snippets/alternative_for_flying_passenger.txt[]
390
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_data_buffer_dir
2121
391
 
2122
392
  ==== passenger_fly_with <socket filename>
2123
- :version: 4.1.0
2124
- include::users_guide_snippets/enterprise_only.txt[]
2125
393
 
2126
- Enables <<flying_passenger,Flying Passenger>> mode, and configures Nginx to connect to the Flying Passenger daemon that's listening on the given socket filename.
2127
-
2128
- This option may only occur once, in the 'http' configuration block. When not set, Flying Passenger is not enabled.
394
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_fly_with
2129
395
 
2130
396
 
2131
397
  === Deprecated or removed options ===
@@ -2147,9 +413,7 @@ include::users_guide_snippets/troubleshooting/default.txt[]
2147
413
 
2148
414
  === The application thinks its not on SSL even though it is
2149
415
 
2150
- Rails and many other frameworks infers whether it's running on SSL through the CGI
2151
- environment variable `HTTPS`. This variable is *only* set if you set `ssl on`.
2152
- Setting just `listen 443 ssl` is not enough.
416
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/admin/nginx/troubleshooting/
2153
417
 
2154
418
  include::users_guide_snippets/troubleshooting/rails.txt[]
2155
419
 
@@ -2165,46 +429,14 @@ include::users_guide_snippets/tips.txt[]
2165
429
 
2166
430
 
2167
431
  == Under the hood ==
2168
- Phusion Passenger hides a lot of complexity for the end user (i.e. the web server
2169
- system administrator), but sometimes it is desirable to know what is going on.
2170
- This section describes a few things that Phusion Passenger does under the hood.
2171
432
 
2172
433
  include::users_guide_snippets/under_the_hood/page_caching_support.txt[]
2173
434
  include::users_guide_snippets/under_the_hood/relationship_with_ruby.txt[]
2174
435
 
2175
436
  [[application_detection]]
2176
437
  === How Phusion Passenger detects whether a virtual host is a web application ===
2177
- After you've read the deployment instructions you might wonder how Phusion Passenger
2178
- knows that the server root points to a web application that Phusion Passenger is
2179
- able to serve, and how it knows what kind of web application it is (e.g. Rails or Rack).
2180
-
2181
- Phusion Passenger checks whether the virtual host is a Rails application by checking
2182
- whether the following file exists:
2183
-
2184
- ------------------------------------------------
2185
- dirname(DocumentRoot) + "/config/environment.rb"
2186
- ------------------------------------------------
2187
-
2188
- If you're not a programmer and don't understand the above pseudo-code snippet, it means
2189
- that Phusion Passenger will:
2190
-
2191
- 1. Extract the parent directory filename from the value of the ``root'' directive.
2192
- 2. Append the text "/config/environment.rb" to the result, and check whether the resulting
2193
- filename exists.
2194
-
2195
- So suppose that your server root is '/webapps/foo/public'. Phusion Passenger will check
2196
- whether the file '/webapps/foo/config/environment.rb' exists.
2197
-
2198
- Note that Phusion Passenger for Nginx does *not* resolve any symlinks in the root path.
2199
- So for example, suppose that your root points to '/home/www/example.com', which in
2200
- turn is a symlink to '/webapps/example.com/public'. Phusion Passenger for Nginx will check for
2201
- '/home/www/config/environment.rb', *not* '/webapps/example.com/config/environment.rb'.
2202
- This file of course doesn't exist, and as a result Phusion Passenger will not activate
2203
- itself for this virtual host, and you'll most likely see some output generated by the
2204
- Nginx default directory handler such as a Forbidden error message.
2205
438
 
2206
- Detection of Rack applications happens through the same mechanism, exception that
2207
- Phusion Passenger will look for 'config.ru' instead of 'config/environment.rb'.
439
+ This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/app_autodetection/nginx/
2208
440
 
2209
441
 
2210
442
  include::users_guide_snippets/appendix_a_about.txt[]