passenger 4.0.44 → 4.0.45
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.
- checksums.yaml +8 -8
- checksums.yaml.gz.asc +7 -7
- data.tar.gz.asc +7 -7
- data/.travis.yml +3 -0
- data/CHANGELOG +31 -0
- data/CONTRIBUTING.md +70 -10
- data/CONTRIBUTORS +4 -0
- data/README.md +1 -1
- data/Vagrantfile +50 -0
- data/bin/passenger-install-nginx-module +7 -2
- data/build/basics.rb +4 -1
- data/build/documentation.rb +6 -0
- data/build/node_tests.rb +7 -1
- data/build/packaging.rb +5 -0
- data/build/test_basics.rb +3 -3
- data/debian.template/copyright +1 -1
- data/debian.template/passenger.manpages +0 -1
- data/dev/rack.test/config.ru +5 -0
- data/dev/rack.test/public/asset.txt +1 -0
- data/dev/vagrant/apache_default_site.conf +35 -0
- data/dev/vagrant/apache_passenger.conf +5 -0
- data/dev/vagrant/apache_passenger.load +1 -0
- data/dev/vagrant/apache_ports.conf +24 -0
- data/dev/vagrant/apache_rack_test.conf +9 -0
- data/dev/vagrant/bashrc +21 -0
- data/dev/vagrant/nginx.conf +39 -0
- data/dev/vagrant/nginx_rakefile +34 -0
- data/dev/vagrant/nginx_start +32 -0
- data/dev/vagrant/provision.sh +115 -0
- data/dev/vagrant/sudoers.conf +5 -0
- data/doc/Design and Architecture.txt +515 -0
- data/doc/DeveloperQuickstart.md +70 -0
- data/doc/Users guide Apache.idmap.txt +24 -18
- data/doc/Users guide Apache.txt +200 -62
- data/doc/Users guide Nginx.idmap.txt +53 -45
- data/doc/Users guide Nginx.txt +501 -360
- data/doc/Users guide Standalone.txt +8 -0
- data/doc/images/direct_spawning.png +0 -0
- data/doc/images/direct_spawning.svg +16 -13
- data/doc/images/helper_agent_core_architecture.png +0 -0
- data/doc/images/passenger_architecture_overview.png +0 -0
- data/doc/images/smart_spawning.png +0 -0
- data/doc/images/{smart.svg → smart_spawning.svg} +23 -20
- data/doc/images/spawning_preparation_work.png +0 -0
- data/doc/images/startup_sequence.png +0 -0
- data/doc/users_guide_snippets/appendix_c_spawning_methods.txt +82 -121
- data/doc/users_guide_snippets/environment_variables.txt +1 -1
- data/doc/users_guide_snippets/support_information.txt +2 -0
- data/doc/users_guide_snippets/tips.txt +117 -9
- data/ext/apache2/Configuration.hpp +4 -2
- data/ext/apache2/ConfigurationCommands.cpp +14 -0
- data/ext/apache2/ConfigurationFields.hpp +4 -0
- data/ext/apache2/ConfigurationSetters.cpp +22 -0
- data/ext/apache2/CreateDirConfig.cpp +2 -0
- data/ext/apache2/Hooks.cpp +30 -14
- data/ext/apache2/MergeDirConfig.cpp +14 -0
- data/ext/apache2/SetHeaders.cpp +8 -0
- data/ext/common/ApplicationPool2/AppTypes.cpp +6 -1
- data/ext/common/ApplicationPool2/Implementation.cpp +1 -1
- data/ext/common/ApplicationPool2/Session.h +1 -1
- data/ext/common/Constants.h +9 -7
- data/ext/common/Utils/HttpHeaderBufferer.h +23 -4
- data/ext/common/Utils/StrIntUtils.h +35 -0
- data/ext/common/Utils/StringScanning.h +4 -10
- data/ext/common/agents/HelperAgent/RequestHandler.h +90 -49
- data/ext/nginx/CacheLocationConfig.c +40 -0
- data/ext/nginx/ConfigurationCommands.c +20 -0
- data/ext/nginx/ConfigurationFields.h +4 -0
- data/ext/nginx/ContentHandler.c +1 -1
- data/ext/nginx/CreateLocationConfig.c +9 -0
- data/ext/nginx/MergeLocationConfig.c +12 -0
- data/ext/nginx/config +2 -2
- data/ext/nginx/ngx_http_passenger_module.c +4 -4
- data/helper-scripts/node-loader.js +40 -27
- data/lib/phusion_passenger.rb +1 -1
- data/lib/phusion_passenger/apache2/config_options.rb +14 -2
- data/lib/phusion_passenger/constants.rb +7 -6
- data/lib/phusion_passenger/loader_shared_helpers.rb +11 -1
- data/lib/phusion_passenger/nginx/config_options.rb +8 -0
- data/lib/phusion_passenger/packaging.rb +8 -3
- data/lib/phusion_passenger/platform_info/apache.rb +3 -0
- data/lib/phusion_passenger/platform_info/ruby.rb +4 -1
- data/lib/phusion_passenger/standalone/command.rb +0 -1
- data/lib/phusion_passenger/standalone/package_runtime_command.rb +1 -0
- data/lib/phusion_passenger/standalone/start_command.rb +80 -62
- data/lib/phusion_passenger/standalone/status_command.rb +1 -0
- data/lib/phusion_passenger/standalone/stop_command.rb +1 -0
- data/man/passenger-config.1 +1 -1
- data/man/passenger-memory-stats.8 +1 -1
- data/man/passenger-status.8 +1 -1
- data/npm-shrinkwrap.json +229 -0
- data/package.json +28 -0
- data/resources/templates/standalone/config.erb +2 -0
- data/rpm/Vagrantfile +0 -3
- data/test/config.json.vagrant +30 -0
- data/test/cxx/HttpHeaderBuffererTest.cpp +64 -10
- data/test/cxx/RequestHandlerTest.cpp +35 -13
- data/test/integration_tests/apache2_tests.rb +1 -0
- data/test/stub/node/app.js +26 -18
- metadata +28 -13
- metadata.gz.asc +7 -7
- data/doc/Architectural overview.idmap.txt +0 -36
- data/doc/Architectural overview.txt +0 -410
- data/doc/images/smart.png +0 -0
- data/ext/common/ApplicationPool2/README.md +0 -56
- data/man/passenger-stress-test.1 +0 -43
- data/node_lib/phusion_passenger/httplib_emulation.js +0 -215
- data/node_lib/phusion_passenger/request_handler.js +0 -73
- data/node_lib/phusion_passenger/session_protocol_parser.js +0 -113
- data/test/node/httplib_emulation_spec.js +0 -623
@@ -132,53 +132,37 @@
|
|
132
132
|
|
133
133
|
8.2.1. passenger_enabled <on|off> => passenger-enabled-on-off--1rpb2t7
|
134
134
|
|
135
|
-
8.2.2.
|
135
|
+
8.2.2. passenger_base_uri <uri> => passenger-base-uri-uri--1xtuo50
|
136
136
|
|
137
|
-
8.2.3.
|
137
|
+
8.2.3. passenger_document_root <path> => passenger-document-root-path--1pge8kd
|
138
138
|
|
139
|
-
8.
|
139
|
+
8.3. Application loading options => application-loading-options-f3skts
|
140
140
|
|
141
|
-
8.
|
141
|
+
8.3.1. passenger_ruby <filename> => passenger-ruby-filename--1gnok5k
|
142
142
|
|
143
|
-
8.2.
|
143
|
+
8.3.2. passenger_python <filename> => passenger-python-filename--14p554
|
144
144
|
|
145
|
-
8.
|
145
|
+
8.3.3. passenger_nodejs <filename> => passenger-nodejs-filename--16hzjsv
|
146
146
|
|
147
|
-
8.
|
147
|
+
8.3.4. passenger_app_env <string> => passenger-app-env-string--qjeimp
|
148
148
|
|
149
|
-
8.
|
149
|
+
8.3.5. rails_env <string> => rails-env-string--jlh7v9
|
150
150
|
|
151
|
-
8.
|
151
|
+
8.3.6. rack_env <string> => rack-env-string--tqmrt0
|
152
152
|
|
153
|
-
8.
|
153
|
+
8.3.7. passenger_app_root <path/to/root> => passenger-app-root-path-to-root--1dbudc6
|
154
154
|
|
155
|
-
8.
|
155
|
+
8.3.8. passenger_app_type <name> => passenger-app-type-name--g9zccv
|
156
156
|
|
157
|
-
8.
|
157
|
+
8.3.9. passenger_startup_file <filename> => passenger-startup-file-filename--y4gy1m
|
158
158
|
|
159
|
-
8.
|
159
|
+
8.3.10. passenger_spawn_method <string> => passenger-spawn-method-string--1sc6njl
|
160
160
|
|
161
|
-
8.3.
|
161
|
+
8.3.11. passenger_load_shell_envvars <on|off> => passenger-load-shell-envvars-on-off--fw5u4l
|
162
162
|
|
163
|
-
8.3.
|
163
|
+
8.3.12. passenger_rolling_restarts <on|off> => passenger-rolling-restarts
|
164
164
|
|
165
|
-
8.3.
|
166
|
-
|
167
|
-
8.3.3. passenger_pass_header <header name> => passenger-pass-header-header-name--1cg31je
|
168
|
-
|
169
|
-
8.3.4. passenger_buffer_response <on|off> => passenger-buffer-response
|
170
|
-
|
171
|
-
8.3.5. passenger_buffer_size => passenger-buffer-size-1jfkq87
|
172
|
-
|
173
|
-
8.3.6. passenger_buffers => passenger-busy-buffers
|
174
|
-
|
175
|
-
8.3.7. passenger_busy_buffer_size => passenger-busy-buffer-size-124sj61
|
176
|
-
|
177
|
-
8.3.8. passenger_intercept_errors <on|off> => passenger-intercept-errors-1uvcb9x
|
178
|
-
|
179
|
-
8.3.9. passenger_max_request_queue_size <number> => passenger-max-request-queue-size-number--i0te1b
|
180
|
-
|
181
|
-
8.3.10. passenger_request_queue_overflow_status_code <code> => passenger-request-queue-overflow-status-code-code--1wcwuxl
|
165
|
+
8.3.13. passenger_resist_deployment_errors <on|off> => passenger-resist-deployment-errors-on-off--k9yf1
|
182
166
|
|
183
167
|
8.4. Security options => security-options-1bv93g4
|
184
168
|
|
@@ -224,23 +208,49 @@
|
|
224
208
|
|
225
209
|
8.5.13. passenger_pre_start <url> => passenger-pre-start-url--npldeb
|
226
210
|
|
227
|
-
8.6.
|
211
|
+
8.6. Connection handling options => connection-handling-options-8jgq90
|
212
|
+
|
213
|
+
8.6.1. passenger_set_cgi_param <CGI environment name> <value> => passenger-set-cgi-param-cgi-environment-name-value--rx9gc0
|
214
|
+
|
215
|
+
8.6.2. passenger_max_request_queue_size <number> => passenger-max-request-queue-size-number--i0te1b
|
216
|
+
|
217
|
+
8.6.3. passenger_request_queue_overflow_status_code <code> => passenger-request-queue-overflow-status-code-code--1wcwuxl
|
228
218
|
|
229
|
-
8.6.
|
219
|
+
8.6.4. passenger_sticky_sessions <on|off> => passenger-sticky-sessions-on-off--lwvbxs
|
230
220
|
|
231
|
-
8.6.
|
221
|
+
8.6.5. passenger_sticky_sessions_cookie_name => passenger-sticky-sessions-cookie-name-8hrox9
|
232
222
|
|
233
|
-
8.6.
|
223
|
+
8.6.6. passenger_ignore_client_abort <on|off> => passenger-ignore-client-abort
|
234
224
|
|
235
|
-
8.7.
|
225
|
+
8.6.7. passenger_intercept_errors <on|off> => passenger-intercept-errors-1uvcb9x
|
236
226
|
|
237
|
-
8.
|
227
|
+
8.6.8. passenger_pass_header <header name> => passenger-pass-header-header-name--1cg31je
|
238
228
|
|
239
|
-
8.
|
229
|
+
8.6.9. passenger_buffer_response <on|off> => passenger-buffer-response
|
240
230
|
|
241
|
-
8.
|
231
|
+
8.6.10. passenger_buffer_size => passenger-buffer-size-1jfkq87
|
242
232
|
|
243
|
-
8.
|
233
|
+
8.6.11. passenger_buffers => passenger-busy-buffers
|
234
|
+
|
235
|
+
8.6.12. passenger_busy_buffer_size => passenger-busy-buffer-size-124sj61
|
236
|
+
|
237
|
+
8.7. Logging and debugging options => logging-and-debugging-options-14e91ni
|
238
|
+
|
239
|
+
8.7.1. passenger_log_level <integer> => passenger-log-level-integer--17snhon
|
240
|
+
|
241
|
+
8.7.2. passenger_debug_log_file <filename> => passenger-debug-log-file-filename--21ubaj
|
242
|
+
|
243
|
+
8.7.3. passenger_debugger <on|off> => passenger-debugger-on-off--1wkuq85
|
244
|
+
|
245
|
+
8.8. Advanced options => advanced-options-hnuhqz
|
246
|
+
|
247
|
+
8.8.1. passenger_temp_dir <directory> => passenger-temp-dir-directory--1t3opri
|
248
|
+
|
249
|
+
8.8.2. passenger_fly_with <socket filename> => passenger-fly-with-socket-filename--1amd1xn
|
250
|
+
|
251
|
+
8.9. Deprecated options => deprecated-options-1dtzo0g
|
252
|
+
|
253
|
+
8.9.1. rails_spawn_method => rails-spawn-method-17vdnpt
|
244
254
|
|
245
255
|
9. Troubleshooting => troubleshooting-1pt0c76
|
246
256
|
|
@@ -362,15 +372,13 @@
|
|
362
372
|
|
363
373
|
15.2.2. Summary of benefits => summary-of-benefits-qovyvk
|
364
374
|
|
365
|
-
15.3. Smart spawning
|
375
|
+
15.3. Smart spawning caveat #1: unintentional file descriptor sharing => smart-spawning-gotcha-1-unintentional-file-descriptor-sharing-cebw6q
|
366
376
|
|
367
377
|
15.3.1. Example 1: Memcached connection sharing (harmful) => example-1-memcached-connection-sharing-harmful--1wfs3ad
|
368
378
|
|
369
379
|
15.3.2. Example 2: Log file sharing (not harmful) => example-2-log-file-sharing-not-harmful--ox4yfy
|
370
380
|
|
371
|
-
15.4. Smart spawning
|
372
|
-
|
373
|
-
15.5. Smart spawning gotcha #3: code load order => smart-spawning-gotcha-3-code-load-order-12ydsn8
|
381
|
+
15.4. Smart spawning caveat #2: the need to revive threads => smart-spawning-gotcha-2-the-need-to-revive-threads-1ey176o
|
374
382
|
|
375
383
|
16. Appendix D: About environment variables => appendix-d-about-environment-variables-1t2cuff
|
376
384
|
|
data/doc/Users guide Nginx.txt
CHANGED
@@ -557,6 +557,47 @@ server {
|
|
557
557
|
}
|
558
558
|
----------------------------
|
559
559
|
|
560
|
+
[[PassengerBaseURI]]
|
561
|
+
==== passenger_base_uri <uri>
|
562
|
+
Used to specify that the given URI is an distinct application that should
|
563
|
+
be served by Phusion Passenger. Please refer to the following sections for
|
564
|
+
more information:
|
565
|
+
|
566
|
+
* <<deploying_rack_to_sub_uri,Deploying Rack to a sub URI>>
|
567
|
+
* <<deploying_wsgi_to_sub_uri,Deploying WSGI to a sub URI>>
|
568
|
+
* <<deploying_rails_to_sub_uri,Deploying Rails 1 and Rails 2 to a sub URI>>
|
569
|
+
|
570
|
+
It is allowed to specify this option multiple times. Do this to deploy multiple
|
571
|
+
applications in different sub-URIs under the same virtual host.
|
572
|
+
|
573
|
+
This option may occur in the following places:
|
574
|
+
|
575
|
+
* In the 'http' configuration block.
|
576
|
+
* In a 'server' configuration block.
|
577
|
+
* In a 'location' configuration block.
|
578
|
+
* In an 'if' configuration scope.
|
579
|
+
|
580
|
+
[[PassengerDocumentRoot]]
|
581
|
+
==== passenger_document_root <path>
|
582
|
+
Used in sub-URI deployment scenarios to tell Phusion Passenger where it
|
583
|
+
should look for static files. Please refer to the following sections for
|
584
|
+
more information:
|
585
|
+
|
586
|
+
* <<deploying_rack_to_sub_uri,Deploying Rack to a sub URI>>
|
587
|
+
* <<deploying_wsgi_to_sub_uri,Deploying WSGI to a sub URI>>
|
588
|
+
* <<deploying_rails_to_sub_uri,Deploying Rails 1 and Rails 2 to a sub URI>>
|
589
|
+
|
590
|
+
This option may occur in the following places:
|
591
|
+
|
592
|
+
* In the 'http' configuration block.
|
593
|
+
* In a 'server' configuration block.
|
594
|
+
* In a 'location' configuration block.
|
595
|
+
* In an 'if' configuration scope.
|
596
|
+
|
597
|
+
In each place, it may be specified at most once.
|
598
|
+
|
599
|
+
=== Application loading options
|
600
|
+
|
560
601
|
[[PassengerRuby]]
|
561
602
|
==== passenger_ruby <filename>
|
562
603
|
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.
|
@@ -679,6 +720,7 @@ An alias for <<PassengerAppEnv,passenger_app_env>>.
|
|
679
720
|
==== passenger_app_root <path/to/root>
|
680
721
|
:version: 4.0.0
|
681
722
|
include::users_guide_snippets/since_version.txt[]
|
723
|
+
|
682
724
|
By default, Phusion Passenger assumes that the application's root directory
|
683
725
|
is the parent directory of the 'public' directory. This option allows one to
|
684
726
|
specify the application's root independently from the Nginx 'root', which
|
@@ -706,18 +748,20 @@ server {
|
|
706
748
|
}
|
707
749
|
-----------------------------
|
708
750
|
|
709
|
-
[[
|
710
|
-
====
|
711
|
-
|
712
|
-
|
713
|
-
more information:
|
751
|
+
[[PassengerAppType]]
|
752
|
+
==== passenger_app_type <name>
|
753
|
+
:version: 4.0.25
|
754
|
+
include::users_guide_snippets/since_version.txt[]
|
714
755
|
|
715
|
-
|
716
|
-
* <<deploying_wsgi_to_sub_uri,Deploying WSGI to a sub URI>>
|
717
|
-
* <<deploying_rails_to_sub_uri,Deploying Rails 1 and Rails 2 to a sub URI>>
|
756
|
+
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.
|
718
757
|
|
719
|
-
|
720
|
-
|
758
|
+
Allowed values are:
|
759
|
+
|
760
|
+
* `rack` - Ruby on Rails >= 3.0 and Ruby Rack
|
761
|
+
* `classic-rails` - Ruby on Rails 1.x and 2.0
|
762
|
+
* `wsgi` - Python
|
763
|
+
* `node` - Node.js, or Meteor JS in bundled mode
|
764
|
+
* `meteor` - Meteor JS in non-bundled mode
|
721
765
|
|
722
766
|
This option may occur in the following places:
|
723
767
|
|
@@ -726,15 +770,50 @@ This option may occur in the following places:
|
|
726
770
|
* In a 'location' configuration block.
|
727
771
|
* In an 'if' configuration scope.
|
728
772
|
|
729
|
-
|
730
|
-
==== passenger_document_root <path>
|
731
|
-
Used in sub-URI deployment scenarios to tell Phusion Passenger where it
|
732
|
-
should look for static files. Please refer to the following sections for
|
733
|
-
more information:
|
773
|
+
In each place, it may be specified at most once.
|
734
774
|
|
735
|
-
|
736
|
-
|
737
|
-
|
775
|
+
Example:
|
776
|
+
|
777
|
+
-----------------------------
|
778
|
+
server {
|
779
|
+
server_name example.com;
|
780
|
+
root /webapps/example.com/public;
|
781
|
+
passenger_enabled on;
|
782
|
+
# Use server.js as the startup file (entry point file) for
|
783
|
+
# your Node.js application, instead of the default app.js
|
784
|
+
passenger_startup_file server.js;
|
785
|
+
passenger_app_type node;
|
786
|
+
</VirtualHost>
|
787
|
+
-----------------------------
|
788
|
+
|
789
|
+
[[PassengerStartupFile]]
|
790
|
+
==== passenger_startup_file <filename>
|
791
|
+
:version: 4.0.25
|
792
|
+
include::users_guide_snippets/since_version.txt[]
|
793
|
+
|
794
|
+
This option specifies the startup file that Phusion Passenger should use when loading the application.
|
795
|
+
|
796
|
+
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.
|
797
|
+
|
798
|
+
Other languages have no conventions at all, and so Phusion Passenger invents one (e.g. Python WSGI with `passenger_wsgi.py`).
|
799
|
+
|
800
|
+
Here's a list of the language-specific conventions that Phusion Passenger accepts:
|
801
|
+
|
802
|
+
[options="header"]
|
803
|
+
|================================================
|
804
|
+
| Language | Phusion Passenger convention
|
805
|
+
| Ruby on Rails >= 3.0, Ruby Rack | config.ru
|
806
|
+
| Ruby on Rails 1.x and 2.x | config/environment.rb
|
807
|
+
| Python | passenger_wsgi.py
|
808
|
+
| Node.js | app.js
|
809
|
+
|================================================
|
810
|
+
|
811
|
+
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.
|
812
|
+
|
813
|
+
Notes:
|
814
|
+
|
815
|
+
* 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.
|
816
|
+
* 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.
|
738
817
|
|
739
818
|
This option may occur in the following places:
|
740
819
|
|
@@ -745,6 +824,20 @@ This option may occur in the following places:
|
|
745
824
|
|
746
825
|
In each place, it may be specified at most once.
|
747
826
|
|
827
|
+
Example:
|
828
|
+
|
829
|
+
-----------------------------
|
830
|
+
server {
|
831
|
+
server_name example.com;
|
832
|
+
root /webapps/example.com/public;
|
833
|
+
passenger_enabled on;
|
834
|
+
# Use server.js as the startup file (entry point file) for
|
835
|
+
# your Node.js application, instead of the default app.js
|
836
|
+
passenger_startup_file server.js;
|
837
|
+
passenger_app_type node;
|
838
|
+
</VirtualHost>
|
839
|
+
-----------------------------
|
840
|
+
|
748
841
|
[[PassengerSpawnMethod]]
|
749
842
|
==== passenger_spawn_method <string>
|
750
843
|
[TIP]
|
@@ -867,19 +960,23 @@ This option may occur in the following places:
|
|
867
960
|
|
868
961
|
In each place, it may be specified at most once. The default value is 'off'.
|
869
962
|
|
870
|
-
===
|
963
|
+
=== Security options ===
|
964
|
+
[[PassengerUserSwitching]]
|
965
|
+
==== passenger_user_switching <on|off> ====
|
966
|
+
Whether to enable <<user_switching,user switching support>>.
|
871
967
|
|
872
|
-
|
873
|
-
|
874
|
-
in the browser), the connection with the application process will be closed too. If the
|
875
|
-
application process continues to send its response, then that will result in EPIPE errors
|
876
|
-
in the application, which will be printed in the error log if the application doesn't
|
877
|
-
handle them gracefully.
|
968
|
+
This option may only occur once, in the 'http' configuration block.
|
969
|
+
The default value is 'on'.
|
878
970
|
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
971
|
+
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.
|
972
|
+
|
973
|
+
[[PassengerUser]]
|
974
|
+
==== passenger_user <username> ====
|
975
|
+
If <<user_switching,user switching support>> is enabled, then Phusion Passenger will
|
976
|
+
by default run the web application as the owner of the file 'config/environment.rb'
|
977
|
+
(for Rails apps) or 'config.ru' (for Rack apps). This option allows you to override
|
978
|
+
that behavior and explicitly set a user to run the web application as, regardless
|
979
|
+
of the ownership of 'environment.rb'/'config.ru'.
|
883
980
|
|
884
981
|
This option may occur in the following places:
|
885
982
|
|
@@ -888,91 +985,86 @@ This option may occur in the following places:
|
|
888
985
|
* In a 'location' configuration block.
|
889
986
|
* In an 'if' configuration scope.
|
890
987
|
|
891
|
-
In each place, it may be specified at most once.
|
988
|
+
In each place, it may be specified at most once.
|
892
989
|
|
893
|
-
[[
|
894
|
-
====
|
895
|
-
|
896
|
-
application
|
897
|
-
|
898
|
-
|
990
|
+
[[PassengerGroup]]
|
991
|
+
==== passenger_group <group name> ====
|
992
|
+
If <<user_switching,user switching support>> is enabled, then Phusion Passenger will
|
993
|
+
by default run the web application as the primary group of the owner of the file
|
994
|
+
'config/environment.rb' (for Rails apps) or 'config.ru' (for Rack apps). This option
|
995
|
+
allows you to override that behavior and explicitly set a group to run the web application
|
996
|
+
as, regardless of the ownership of 'environment.rb'/'config.ru'.
|
899
997
|
|
900
|
-
|
998
|
+
'<group name>' may also be set to the special value '!STARTUP_FILE!', in which case
|
999
|
+
the web application's group will be set to 'environment.rb'/'config.ru''s group.
|
901
1000
|
|
902
|
-
|
903
|
-
* During application spawning, in the form of a system environment variable that can be looked up through `getenv()`.
|
1001
|
+
This option may occur in the following places:
|
904
1002
|
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
1003
|
+
* In the 'http' configuration block.
|
1004
|
+
* In a 'server' configuration block.
|
1005
|
+
* In a 'location' configuration block.
|
1006
|
+
* In an 'if' configuration scope.
|
909
1007
|
|
910
|
-
|
911
|
-
passenger_set_cgi_param EXTRA_REQUEST_METHOD method=$request_method;
|
912
|
-
------------------------------
|
1008
|
+
In each place, it may be specified at most once.
|
913
1009
|
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
1010
|
+
[[PassengerDefaultUser]]
|
1011
|
+
==== passenger_default_user <username> ====
|
1012
|
+
Phusion Passenger enables <<user_switching,user switching support>> by default.
|
1013
|
+
This configuration option allows one to specify the user that applications must
|
1014
|
+
run as, if user switching fails or is disabled.
|
919
1015
|
|
920
|
-
|
921
|
-
|
922
|
-
passenger_set_cgi_param X-Forwarded-For 127.0.0.2;
|
1016
|
+
This option may only occur once, in the 'http' configuration block.
|
1017
|
+
The default value is 'nobody'.
|
923
1018
|
|
924
|
-
|
925
|
-
passenger_set_cgi_param HTTP_X_FORWARDED_FOR 127.0.0.2;
|
926
|
-
------------------------------
|
927
|
-
===============================================
|
1019
|
+
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.
|
928
1020
|
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
1021
|
+
[[PassengerDefaultGroup]]
|
1022
|
+
==== Passenger_default_group <group name> ====
|
1023
|
+
Phusion Passenger enables <<user_switching,user switching support>> by default.
|
1024
|
+
This configuration option allows one to specify the group that applications must
|
1025
|
+
run as, if user switching fails or is disabled.
|
933
1026
|
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
passenger_set_cgi_param FOO foo;
|
1027
|
+
This option may only occur once, in the 'http' configuration block.
|
1028
|
+
The default value is the primary group of the user specifified by
|
1029
|
+
<<PassengerDefaultUser,passenger_default_user>>.
|
938
1030
|
|
939
|
-
|
940
|
-
passenger_enabled_on;
|
941
|
-
# !!!THIS IS WRONG!!! The 'FOO' CGI variable will not
|
942
|
-
# be passed URLs beginning with /users because you didn't
|
943
|
-
# re-specify passenger_set_cgi_param.
|
944
|
-
}
|
1031
|
+
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.
|
945
1032
|
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
1033
|
+
==== passenger_show_version_in_header <on|off> ====
|
1034
|
+
When turned on, Phusion Passenger will output its version number in the `Server` and `X-Powered-By` header in all Phusion Passenger-served requests:
|
1035
|
+
|
1036
|
+
----------------------------------------------------
|
1037
|
+
Server: nginx/1.3.11 + Phusion Passenger 4.0.0
|
1038
|
+
X-Powered-By: Phusion Passenger 4.0.0
|
1039
|
+
----------------------------------------------------
|
1040
|
+
|
1041
|
+
When turned off, the version number will be hidden:
|
1042
|
+
|
1043
|
+
----------------------------------------------------
|
1044
|
+
Server: nginx/1.3.11 + Phusion Passenger
|
1045
|
+
X-Powered-By: Phusion Passenger
|
1046
|
+
----------------------------------------------------
|
956
1047
|
|
957
1048
|
This option may occur in the following places:
|
958
1049
|
|
1050
|
+
* In the 'http' configuration block.
|
959
1051
|
* In a 'server' configuration block.
|
960
1052
|
* In a 'location' configuration block.
|
961
1053
|
* In an 'if' configuration scope.
|
962
1054
|
|
963
|
-
|
964
|
-
Some headers generated by backend applications are not forwarded to the HTTP client,
|
965
|
-
e.g. 'X-Accel-Redirect' which is directly processed by Nginx and then discarded from
|
966
|
-
the final response. This directive allows one to force Nginx to pass those headers
|
967
|
-
anyway, similar to how 'proxy_pass_header' works.
|
968
|
-
|
969
|
-
For example:
|
1055
|
+
In each place, it may be specified at most once. The default value is 'on'.
|
970
1056
|
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
1057
|
+
[[PassengerFriendlyErrorPages]]
|
1058
|
+
==== passenger_friendly_error_pages <on|off> ====
|
1059
|
+
Phusion Passenger can display friendly error pages whenever an application fails
|
1060
|
+
to start. This friendly error page presents the startup error message, some
|
1061
|
+
suggestions for solving the problem, a backtrace and a dump of the environment variables.
|
1062
|
+
This feature is very useful during application development and useful for less experienced
|
1063
|
+
system administrators, but the page might reveal potentially sensitive information,
|
1064
|
+
depending on the application. For this reason, friendly error pages are turned off by default when
|
1065
|
+
<<PassengerAppEnv,passenger_app_env (and its aliases such as rails_env and rack_env)>>
|
1066
|
+
is set to 'staging' or 'production', but enabled by default otherwise. You can use
|
1067
|
+
this option to explicitly enable or disable this feature.
|
976
1068
|
|
977
1069
|
This option may occur in the following places:
|
978
1070
|
|
@@ -981,271 +1073,21 @@ This option may occur in the following places:
|
|
981
1073
|
* In a 'location' configuration block.
|
982
1074
|
* In an 'if' configuration scope.
|
983
1075
|
|
984
|
-
|
985
|
-
When turned on, application-generated responses are buffered by Nginx. Buffering will
|
986
|
-
happen in memory and also on disk if the response is larger than a certain threshold.
|
1076
|
+
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.
|
987
1077
|
|
988
|
-
|
1078
|
+
=== Resource control and optimization options ===
|
1079
|
+
[[PassengerMaxPoolSize]]
|
1080
|
+
==== passenger_max_pool_size <integer> ====
|
1081
|
+
The maximum number of <<application_process,application processes>> that may
|
1082
|
+
simultanously exist. A larger number results in higher memory usage,
|
1083
|
+
but improves the ability to handle concurrent HTTP requests.
|
989
1084
|
|
990
|
-
|
991
|
-
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`.
|
1085
|
+
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].
|
992
1086
|
|
993
|
-
|
1087
|
+
If you find that your server is running out of memory then you should lower this value.
|
994
1088
|
|
995
|
-
|
996
|
-
|
997
|
-
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.
|
998
|
-
|
999
|
-
How does response buffering - whether it's done by Nginx or by Phusion Passenger - exactly protect against slow clients?
|
1000
|
-
Consider an HTTP client that's on a dial-up modem link, and your
|
1001
|
-
application process generates a 2 MB response. If the response is not buffered
|
1002
|
-
then your application process will be blocked until the entire 2 MB has been
|
1003
|
-
sent out to the HTTP client. This disallows your application process to do any useful
|
1004
|
-
work in the mean time. By buffering responses, Phusion Passenger or Nginx will read
|
1005
|
-
the application response as quickly as possible and will take care of forwarding the data
|
1006
|
-
to slow clients.
|
1007
|
-
|
1008
|
-
So keep in mind that enabling `passenger_buffering_response` will make streaming responses
|
1009
|
-
impossible. Consider for example this piece of Rails code:
|
1010
|
-
|
1011
|
-
--------------------------------
|
1012
|
-
render :text => lambda { |response, output|
|
1013
|
-
10.times do |i|
|
1014
|
-
output.write("entry #{i}\n")
|
1015
|
-
output.flush
|
1016
|
-
sleep 1
|
1017
|
-
end
|
1018
|
-
}
|
1019
|
-
--------------------------------
|
1020
|
-
|
1021
|
-
...or this piece of Rack code:
|
1022
|
-
|
1023
|
-
--------------------------------
|
1024
|
-
class Response
|
1025
|
-
def each
|
1026
|
-
10.times do |i|
|
1027
|
-
yield("entry #{i}\n")
|
1028
|
-
sleep 1
|
1029
|
-
end
|
1030
|
-
end
|
1031
|
-
end
|
1032
|
-
|
1033
|
-
app = lambda do |env|
|
1034
|
-
[200, { "Content-Type" => "text/plain" }, Response.new]
|
1035
|
-
end
|
1036
|
-
--------------------------------
|
1037
|
-
|
1038
|
-
When `passenger_buffer_response` is turned on, Nginx will wait until
|
1039
|
-
the application is done sending the entire response before forwarding it
|
1040
|
-
to the client. The client will not receive anything for 10 seconds,
|
1041
|
-
after which it receives the entire response at once.
|
1042
|
-
When `passenger_buffer_response` is turned off, it works as expected: the client
|
1043
|
-
receives an "entry X" message every second for 10 seconds.
|
1044
|
-
|
1045
|
-
This option may occur in the following places:
|
1046
|
-
|
1047
|
-
* In the 'http' configuration block.
|
1048
|
-
* In a 'server' configuration block.
|
1049
|
-
* In a 'location' configuration block.
|
1050
|
-
* In an 'if' configuration scope.
|
1051
|
-
|
1052
|
-
In each place, it may be specified at most once. The default value is 'off'.
|
1053
|
-
|
1054
|
-
==== passenger_buffer_size ====
|
1055
|
-
==== passenger_buffers ====
|
1056
|
-
==== passenger_busy_buffer_size ====
|
1057
|
-
These options have the same effect as proxy_module's similarly named options.
|
1058
|
-
They can be used to modify the maximum allowed HTTP header size.
|
1059
|
-
|
1060
|
-
[[passenger_intercept_errors]]
|
1061
|
-
==== passenger_intercept_errors <on|off> ====
|
1062
|
-
:version: 4.0.15
|
1063
|
-
include::users_guide_snippets/since_version.txt[]
|
1064
|
-
|
1065
|
-
Decides if Nginx will intercept responses with HTTP status codes of 400 and higher.
|
1066
|
-
|
1067
|
-
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.
|
1068
|
-
|
1069
|
-
This option may occur in the following places:
|
1070
|
-
|
1071
|
-
* In the 'http' configuration block.
|
1072
|
-
* In a 'server' configuration block.
|
1073
|
-
* In a 'location' configuration block.
|
1074
|
-
* In an 'if' configuration scope.
|
1075
|
-
|
1076
|
-
In each place, it may be specified at most once. The default value is 'off'.
|
1077
|
-
|
1078
|
-
[[passenger_max_request_queue_size]]
|
1079
|
-
==== passenger_max_request_queue_size <number> ====
|
1080
|
-
:version: 4.0.15
|
1081
|
-
include::users_guide_snippets/since_version.txt[]
|
1082
|
-
|
1083
|
-
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.
|
1084
|
-
|
1085
|
-
A value of 0 means that the queue is unbounded.
|
1086
|
-
|
1087
|
-
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.
|
1088
|
-
|
1089
|
-
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:
|
1090
|
-
|
1091
|
-
---------------------------------
|
1092
|
-
passenger_intercept_errors on;
|
1093
|
-
error_page 503 /error503.html;
|
1094
|
-
---------------------------------
|
1095
|
-
|
1096
|
-
This option may occur in the following places:
|
1097
|
-
|
1098
|
-
* In the 'http' configuration block.
|
1099
|
-
* In a 'server' configuration block.
|
1100
|
-
* In a 'location' configuration block.
|
1101
|
-
* In an 'if' configuration scope.
|
1102
|
-
|
1103
|
-
In each place, it may be specified at most once. The default value is '100'.
|
1104
|
-
|
1105
|
-
[[passenger_request_queue_overflow_status_code]]
|
1106
|
-
==== passenger_request_queue_overflow_status_code <code> ====
|
1107
|
-
:version: 4.0.15
|
1108
|
-
include::users_guide_snippets/since_version.txt[]
|
1109
|
-
|
1110
|
-
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.
|
1111
|
-
|
1112
|
-
This option may occur in the following places:
|
1113
|
-
|
1114
|
-
* In the 'http' configuration block.
|
1115
|
-
* In a 'server' configuration block.
|
1116
|
-
* In a 'location' configuration block.
|
1117
|
-
* In an 'if' configuration scope.
|
1118
|
-
|
1119
|
-
In each place, it may be specified at most once. The default value is '503'.
|
1120
|
-
|
1121
|
-
=== Security options ===
|
1122
|
-
[[PassengerUserSwitching]]
|
1123
|
-
==== passenger_user_switching <on|off> ====
|
1124
|
-
Whether to enable <<user_switching,user switching support>>.
|
1125
|
-
|
1126
|
-
This option may only occur once, in the 'http' configuration block.
|
1127
|
-
The default value is 'on'.
|
1128
|
-
|
1129
|
-
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.
|
1130
|
-
|
1131
|
-
[[PassengerUser]]
|
1132
|
-
==== passenger_user <username> ====
|
1133
|
-
If <<user_switching,user switching support>> is enabled, then Phusion Passenger will
|
1134
|
-
by default run the web application as the owner of the file 'config/environment.rb'
|
1135
|
-
(for Rails apps) or 'config.ru' (for Rack apps). This option allows you to override
|
1136
|
-
that behavior and explicitly set a user to run the web application as, regardless
|
1137
|
-
of the ownership of 'environment.rb'/'config.ru'.
|
1138
|
-
|
1139
|
-
This option may occur in the following places:
|
1140
|
-
|
1141
|
-
* In the 'http' configuration block.
|
1142
|
-
* In a 'server' configuration block.
|
1143
|
-
* In a 'location' configuration block.
|
1144
|
-
* In an 'if' configuration scope.
|
1145
|
-
|
1146
|
-
In each place, it may be specified at most once.
|
1147
|
-
|
1148
|
-
[[PassengerGroup]]
|
1149
|
-
==== passenger_group <group name> ====
|
1150
|
-
If <<user_switching,user switching support>> is enabled, then Phusion Passenger will
|
1151
|
-
by default run the web application as the primary group of the owner of the file
|
1152
|
-
'config/environment.rb' (for Rails apps) or 'config.ru' (for Rack apps). This option
|
1153
|
-
allows you to override that behavior and explicitly set a group to run the web application
|
1154
|
-
as, regardless of the ownership of 'environment.rb'/'config.ru'.
|
1155
|
-
|
1156
|
-
'<group name>' may also be set to the special value '!STARTUP_FILE!', in which case
|
1157
|
-
the web application's group will be set to 'environment.rb'/'config.ru''s group.
|
1158
|
-
|
1159
|
-
This option may occur in the following places:
|
1160
|
-
|
1161
|
-
* In the 'http' configuration block.
|
1162
|
-
* In a 'server' configuration block.
|
1163
|
-
* In a 'location' configuration block.
|
1164
|
-
* In an 'if' configuration scope.
|
1165
|
-
|
1166
|
-
In each place, it may be specified at most once.
|
1167
|
-
|
1168
|
-
[[PassengerDefaultUser]]
|
1169
|
-
==== passenger_default_user <username> ====
|
1170
|
-
Phusion Passenger enables <<user_switching,user switching support>> by default.
|
1171
|
-
This configuration option allows one to specify the user that applications must
|
1172
|
-
run as, if user switching fails or is disabled.
|
1173
|
-
|
1174
|
-
This option may only occur once, in the 'http' configuration block.
|
1175
|
-
The default value is 'nobody'.
|
1176
|
-
|
1177
|
-
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.
|
1178
|
-
|
1179
|
-
[[PassengerDefaultGroup]]
|
1180
|
-
==== Passenger_default_group <group name> ====
|
1181
|
-
Phusion Passenger enables <<user_switching,user switching support>> by default.
|
1182
|
-
This configuration option allows one to specify the group that applications must
|
1183
|
-
run as, if user switching fails or is disabled.
|
1184
|
-
|
1185
|
-
This option may only occur once, in the 'http' configuration block.
|
1186
|
-
The default value is the primary group of the user specifified by
|
1187
|
-
<<PassengerDefaultUser,passenger_default_user>>.
|
1188
|
-
|
1189
|
-
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.
|
1190
|
-
|
1191
|
-
==== passenger_show_version_in_header <on|off> ====
|
1192
|
-
When turned on, Phusion Passenger will output its version number in the `Server` and `X-Powered-By` header in all Phusion Passenger-served requests:
|
1193
|
-
|
1194
|
-
----------------------------------------------------
|
1195
|
-
Server: nginx/1.3.11 + Phusion Passenger 4.0.0
|
1196
|
-
X-Powered-By: Phusion Passenger 4.0.0
|
1197
|
-
----------------------------------------------------
|
1198
|
-
|
1199
|
-
When turned off, the version number will be hidden:
|
1200
|
-
|
1201
|
-
----------------------------------------------------
|
1202
|
-
Server: nginx/1.3.11 + Phusion Passenger
|
1203
|
-
X-Powered-By: Phusion Passenger
|
1204
|
-
----------------------------------------------------
|
1205
|
-
|
1206
|
-
This option may occur in the following places:
|
1207
|
-
|
1208
|
-
* In the 'http' configuration block.
|
1209
|
-
* In a 'server' configuration block.
|
1210
|
-
* In a 'location' configuration block.
|
1211
|
-
* In an 'if' configuration scope.
|
1212
|
-
|
1213
|
-
In each place, it may be specified at most once. The default value is 'on'.
|
1214
|
-
|
1215
|
-
[[PassengerFriendlyErrorPages]]
|
1216
|
-
==== passenger_friendly_error_pages <on|off> ====
|
1217
|
-
Phusion Passenger can display friendly error pages whenever an application fails
|
1218
|
-
to start. This friendly error page presents the startup error message, some
|
1219
|
-
suggestions for solving the problem, a backtrace and a dump of the environment variables.
|
1220
|
-
This feature is very useful during application development and useful for less experienced
|
1221
|
-
system administrators, but the page might reveal potentially sensitive information,
|
1222
|
-
depending on the application. For this reason, friendly error pages are turned off by default when
|
1223
|
-
<<PassengerAppEnv,passenger_app_env (and its aliases such as rails_env and rack_env)>>
|
1224
|
-
is set to 'staging' or 'production', but enabled by default otherwise. You can use
|
1225
|
-
this option to explicitly enable or disable this feature.
|
1226
|
-
|
1227
|
-
This option may occur in the following places:
|
1228
|
-
|
1229
|
-
* In the 'http' configuration block.
|
1230
|
-
* In a 'server' configuration block.
|
1231
|
-
* In a 'location' configuration block.
|
1232
|
-
* In an 'if' configuration scope.
|
1233
|
-
|
1234
|
-
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.
|
1235
|
-
|
1236
|
-
=== Resource control and optimization options ===
|
1237
|
-
[[PassengerMaxPoolSize]]
|
1238
|
-
==== passenger_max_pool_size <integer> ====
|
1239
|
-
The maximum number of <<application_process,application processes>> that may
|
1240
|
-
simultanously exist. A larger number results in higher memory usage,
|
1241
|
-
but improves the ability to handle concurrent HTTP requests.
|
1242
|
-
|
1243
|
-
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].
|
1244
|
-
|
1245
|
-
If you find that your server is running out of memory then you should lower this value.
|
1246
|
-
|
1247
|
-
This option may only occur once, in the 'http' configuration block.
|
1248
|
-
The default value is '6'.
|
1089
|
+
This option may only occur once, in the 'http' configuration block.
|
1090
|
+
The default value is '6'.
|
1249
1091
|
|
1250
1092
|
:option: `--max-pool-size`
|
1251
1093
|
include::users_guide_snippets/alternative_for_flying_passenger.txt[]
|
@@ -1382,19 +1224,19 @@ The default value is '300'.
|
|
1382
1224
|
include::users_guide_snippets/alternative_for_flying_passenger.txt[]
|
1383
1225
|
|
1384
1226
|
==== passenger_max_preloader_idle_time <integer> ====
|
1385
|
-
The
|
1227
|
+
The preloader process (explained in <<spawning_methods_explained,Spawning
|
1386
1228
|
methods explained>>) has an idle timeout, just like the backend processes spawned by
|
1387
1229
|
Phusion Passenger do. That is, it will automatically shutdown if it hasn't done
|
1388
1230
|
anything for a given period.
|
1389
1231
|
|
1390
|
-
This option allows you to set the
|
1232
|
+
This option allows you to set the prealoader's idle timeout, in
|
1391
1233
|
seconds. A value of '0' means that it should never idle timeout.
|
1392
1234
|
|
1393
|
-
Setting a higher value will mean that the
|
1235
|
+
Setting a higher value will mean that the preloader is kept around
|
1394
1236
|
longer, which may slightly increase memory usage. But as long as the
|
1395
|
-
|
1237
|
+
preloader is running, the time to spawn a Ruby on Rails backend
|
1396
1238
|
process only takes about 10% of the time that is normally needed, assuming that
|
1397
|
-
you're using the 'smart'
|
1239
|
+
you're using the 'smart' <<PassengerSpawnMethod,spawning method>>. So if your
|
1398
1240
|
system has enough memory, is it recommended that you set this option to a high
|
1399
1241
|
value or to '0'.
|
1400
1242
|
|
@@ -1778,6 +1620,305 @@ the request ending up at a different web server in the cluster.
|
|
1778
1620
|
Yes. And it does not perform any certificate validation.
|
1779
1621
|
|
1780
1622
|
|
1623
|
+
=== Connection handling options ===
|
1624
|
+
|
1625
|
+
[[passenger_set_cgi_param]]
|
1626
|
+
==== passenger_set_cgi_param <CGI environment name> <value> ====
|
1627
|
+
Allows one to define additional CGI environment variables to pass to the web
|
1628
|
+
application. This is comparable to ngx_http_fastcgi_module's 'fastcgi_param'
|
1629
|
+
directive, and to ngx_http_proxy_module's 'proxy_set_header' option.
|
1630
|
+
Nginx variables in the value are interpolated.
|
1631
|
+
|
1632
|
+
These variables passed in the following manner:
|
1633
|
+
|
1634
|
+
* On every request, in the form of a request variable.
|
1635
|
+
* During application spawning, in the form of a system environment variable that can be looked up through `getenv()`.
|
1636
|
+
|
1637
|
+
Example usage:
|
1638
|
+
------------------------------
|
1639
|
+
# Application will see a CGI environment "APP_NAME" with value "my super blog".
|
1640
|
+
passenger_set_cgi_param APP_NAME "my super blog";
|
1641
|
+
|
1642
|
+
# Nginx variables are interpolated.
|
1643
|
+
passenger_set_cgi_param EXTRA_REQUEST_METHOD method=$request_method;
|
1644
|
+
------------------------------
|
1645
|
+
|
1646
|
+
.Use CGI environment names
|
1647
|
+
[NOTE]
|
1648
|
+
===============================================
|
1649
|
+
If you want to set an HTTP header, then you must set it in the CGI environment name
|
1650
|
+
format, i.e. 'HTTP_*':
|
1651
|
+
|
1652
|
+
------------------------------
|
1653
|
+
# !!!THIS IS WRONG!!! Don't do this!
|
1654
|
+
passenger_set_cgi_param X-Forwarded-For 127.0.0.2;
|
1655
|
+
|
1656
|
+
# Instead, write it like this:
|
1657
|
+
passenger_set_cgi_param HTTP_X_FORWARDED_FOR 127.0.0.2;
|
1658
|
+
------------------------------
|
1659
|
+
===============================================
|
1660
|
+
|
1661
|
+
.This configuration option is NOT inherited across contexts
|
1662
|
+
[WARNING]
|
1663
|
+
===============================================
|
1664
|
+
In each new context (e.g. in each new 'location' block), you must re-specify `passenger_set_cgi_param`. Values set in parent contexts have no effect on subcontexts. For example:
|
1665
|
+
|
1666
|
+
------------------------------
|
1667
|
+
server {
|
1668
|
+
...
|
1669
|
+
passenger_set_cgi_param FOO foo;
|
1670
|
+
|
1671
|
+
location /users {
|
1672
|
+
passenger_enabled_on;
|
1673
|
+
# !!!THIS IS WRONG!!! The 'FOO' CGI variable will not
|
1674
|
+
# be passed URLs beginning with /users because you didn't
|
1675
|
+
# re-specify passenger_set_cgi_param.
|
1676
|
+
}
|
1677
|
+
|
1678
|
+
location /apps {
|
1679
|
+
passenger_enabled on;
|
1680
|
+
# This is correct. Here we re-specify passenger_set_cgi_param,
|
1681
|
+
# so the 'FOO' CGI variable will be correctly passed to URLs
|
1682
|
+
# starting with /apps.
|
1683
|
+
passenger_set_cgi_param FOO foo;
|
1684
|
+
}
|
1685
|
+
}
|
1686
|
+
------------------------------
|
1687
|
+
===============================================
|
1688
|
+
|
1689
|
+
This option may occur in the following places:
|
1690
|
+
|
1691
|
+
* In a 'server' configuration block.
|
1692
|
+
* In a 'location' configuration block.
|
1693
|
+
* In an 'if' configuration scope.
|
1694
|
+
|
1695
|
+
[[passenger_max_request_queue_size]]
|
1696
|
+
==== passenger_max_request_queue_size <number> ====
|
1697
|
+
:version: 4.0.15
|
1698
|
+
include::users_guide_snippets/since_version.txt[]
|
1699
|
+
|
1700
|
+
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.
|
1701
|
+
|
1702
|
+
A value of 0 means that the queue is unbounded.
|
1703
|
+
|
1704
|
+
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.
|
1705
|
+
|
1706
|
+
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:
|
1707
|
+
|
1708
|
+
---------------------------------
|
1709
|
+
passenger_intercept_errors on;
|
1710
|
+
error_page 503 /error503.html;
|
1711
|
+
---------------------------------
|
1712
|
+
|
1713
|
+
This option may occur in the following places:
|
1714
|
+
|
1715
|
+
* In the 'http' configuration block.
|
1716
|
+
* In a 'server' configuration block.
|
1717
|
+
* In a 'location' configuration block.
|
1718
|
+
* In an 'if' configuration scope.
|
1719
|
+
|
1720
|
+
In each place, it may be specified at most once. The default value is '100'.
|
1721
|
+
|
1722
|
+
[[passenger_request_queue_overflow_status_code]]
|
1723
|
+
==== passenger_request_queue_overflow_status_code <code> ====
|
1724
|
+
:version: 4.0.15
|
1725
|
+
include::users_guide_snippets/since_version.txt[]
|
1726
|
+
|
1727
|
+
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.
|
1728
|
+
|
1729
|
+
This option may occur in the following places:
|
1730
|
+
|
1731
|
+
* In the 'http' configuration block.
|
1732
|
+
* In a 'server' configuration block.
|
1733
|
+
* In a 'location' configuration block.
|
1734
|
+
* In an 'if' configuration scope.
|
1735
|
+
|
1736
|
+
In each place, it may be specified at most once. The default value is '503'.
|
1737
|
+
|
1738
|
+
[[PassengerStickySessions]]
|
1739
|
+
==== passenger_sticky_sessions <on|off>
|
1740
|
+
:version: 4.0.55
|
1741
|
+
include::users_guide_snippets/since_version.txt[]
|
1742
|
+
|
1743
|
+
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.
|
1744
|
+
|
1745
|
+
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.
|
1746
|
+
|
1747
|
+
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.
|
1748
|
+
|
1749
|
+
So prominent examples where sticky sessions should (or even *must*) be enabled, include:
|
1750
|
+
|
1751
|
+
* Applications that use the SockJS library (unless configured with a distributed data store)
|
1752
|
+
* Applications that use the Socket.io library (unless configured with a distributed data store)
|
1753
|
+
* Applications that use the faye-websocket gem (unless configured with a distributed data store)
|
1754
|
+
* Meteor JS applications (because Meteor uses SockJS)
|
1755
|
+
|
1756
|
+
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.
|
1757
|
+
|
1758
|
+
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.
|
1759
|
+
|
1760
|
+
This option may occur in the following places:
|
1761
|
+
|
1762
|
+
* In the `http` configuration block.
|
1763
|
+
* In a `server` configuration block.
|
1764
|
+
* In a `location` configuration block.
|
1765
|
+
* In an `if` configuration scope.
|
1766
|
+
|
1767
|
+
In each place, it may be specified at most once. The default value is `off`.
|
1768
|
+
|
1769
|
+
[[PassengerStickySessionsCookieName]]
|
1770
|
+
==== passenger_sticky_sessions_cookie_name
|
1771
|
+
:version: 4.0.55
|
1772
|
+
include::users_guide_snippets/since_version.txt[]
|
1773
|
+
|
1774
|
+
Sets the name of the <<PassengerStickySessions,sticky sessions>> cookie.
|
1775
|
+
|
1776
|
+
This option may occur in the following places:
|
1777
|
+
|
1778
|
+
* In the `http` configuration block.
|
1779
|
+
* In a `server` configuration block.
|
1780
|
+
* In a `location` configuration block.
|
1781
|
+
* In an `if` configuration scope.
|
1782
|
+
|
1783
|
+
In each place, it may be specified at most once. The default value is `_passenger_route`.
|
1784
|
+
|
1785
|
+
==== passenger_ignore_client_abort <on|off> ====
|
1786
|
+
Normally, when the HTTP client aborts the connection (e.g. when the user clicked on "Stop"
|
1787
|
+
in the browser), the connection with the application process will be closed too. If the
|
1788
|
+
application process continues to send its response, then that will result in EPIPE errors
|
1789
|
+
in the application, which will be printed in the error log if the application doesn't
|
1790
|
+
handle them gracefully.
|
1791
|
+
|
1792
|
+
If this option is turned on then upon client abort Phusion Passenger will continue to
|
1793
|
+
read the application process's response while discarding all the read data. This prevents
|
1794
|
+
EPIPE errors but it'll also mean the backend process will be unavailable for new requests
|
1795
|
+
until it is done sending its response.
|
1796
|
+
|
1797
|
+
This option may occur in the following places:
|
1798
|
+
|
1799
|
+
* In the 'http' configuration block.
|
1800
|
+
* In a 'server' configuration block.
|
1801
|
+
* In a 'location' configuration block.
|
1802
|
+
* In an 'if' configuration scope.
|
1803
|
+
|
1804
|
+
In each place, it may be specified at most once. The default value is 'off'.
|
1805
|
+
|
1806
|
+
[[passenger_intercept_errors]]
|
1807
|
+
==== passenger_intercept_errors <on|off> ====
|
1808
|
+
:version: 4.0.15
|
1809
|
+
include::users_guide_snippets/since_version.txt[]
|
1810
|
+
|
1811
|
+
Decides if Nginx will intercept responses with HTTP status codes of 400 and higher.
|
1812
|
+
|
1813
|
+
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.
|
1814
|
+
|
1815
|
+
This option may occur in the following places:
|
1816
|
+
|
1817
|
+
* In the 'http' configuration block.
|
1818
|
+
* In a 'server' configuration block.
|
1819
|
+
* In a 'location' configuration block.
|
1820
|
+
* In an 'if' configuration scope.
|
1821
|
+
|
1822
|
+
In each place, it may be specified at most once. The default value is 'off'.
|
1823
|
+
|
1824
|
+
==== passenger_pass_header <header name> ====
|
1825
|
+
Some headers generated by backend applications are not forwarded to the HTTP client,
|
1826
|
+
e.g. 'X-Accel-Redirect' which is directly processed by Nginx and then discarded from
|
1827
|
+
the final response. This directive allows one to force Nginx to pass those headers
|
1828
|
+
anyway, similar to how 'proxy_pass_header' works.
|
1829
|
+
|
1830
|
+
For example:
|
1831
|
+
|
1832
|
+
------------------------------
|
1833
|
+
location / {
|
1834
|
+
passenger_pass_header X-Accel-Redirect;
|
1835
|
+
}
|
1836
|
+
------------------------------
|
1837
|
+
|
1838
|
+
This option may occur in the following places:
|
1839
|
+
|
1840
|
+
* In the 'http' configuration block.
|
1841
|
+
* In a 'server' configuration block.
|
1842
|
+
* In a 'location' configuration block.
|
1843
|
+
* In an 'if' configuration scope.
|
1844
|
+
|
1845
|
+
==== passenger_buffer_response <on|off> ====
|
1846
|
+
When turned on, application-generated responses are buffered by Nginx. Buffering will
|
1847
|
+
happen in memory and also on disk if the response is larger than a certain threshold.
|
1848
|
+
|
1849
|
+
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:
|
1850
|
+
|
1851
|
+
1. The Nginx response buffering system. `passenger_buffer_response` turns this on or off.
|
1852
|
+
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`.
|
1853
|
+
|
1854
|
+
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.
|
1855
|
+
|
1856
|
+
If for whatever reason you want to turn Nginx-level response buffering on, you can do so with this option.
|
1857
|
+
|
1858
|
+
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.
|
1859
|
+
|
1860
|
+
How does response buffering - whether it's done by Nginx or by Phusion Passenger - exactly protect against slow clients?
|
1861
|
+
Consider an HTTP client that's on a dial-up modem link, and your
|
1862
|
+
application process generates a 2 MB response. If the response is not buffered
|
1863
|
+
then your application process will be blocked until the entire 2 MB has been
|
1864
|
+
sent out to the HTTP client. This disallows your application process to do any useful
|
1865
|
+
work in the mean time. By buffering responses, Phusion Passenger or Nginx will read
|
1866
|
+
the application response as quickly as possible and will take care of forwarding the data
|
1867
|
+
to slow clients.
|
1868
|
+
|
1869
|
+
So keep in mind that enabling `passenger_buffering_response` will make streaming responses
|
1870
|
+
impossible. Consider for example this piece of Rails code:
|
1871
|
+
|
1872
|
+
--------------------------------
|
1873
|
+
render :text => lambda { |response, output|
|
1874
|
+
10.times do |i|
|
1875
|
+
output.write("entry #{i}\n")
|
1876
|
+
output.flush
|
1877
|
+
sleep 1
|
1878
|
+
end
|
1879
|
+
}
|
1880
|
+
--------------------------------
|
1881
|
+
|
1882
|
+
...or this piece of Rack code:
|
1883
|
+
|
1884
|
+
--------------------------------
|
1885
|
+
class Response
|
1886
|
+
def each
|
1887
|
+
10.times do |i|
|
1888
|
+
yield("entry #{i}\n")
|
1889
|
+
sleep 1
|
1890
|
+
end
|
1891
|
+
end
|
1892
|
+
end
|
1893
|
+
|
1894
|
+
app = lambda do |env|
|
1895
|
+
[200, { "Content-Type" => "text/plain" }, Response.new]
|
1896
|
+
end
|
1897
|
+
--------------------------------
|
1898
|
+
|
1899
|
+
When `passenger_buffer_response` is turned on, Nginx will wait until
|
1900
|
+
the application is done sending the entire response before forwarding it
|
1901
|
+
to the client. The client will not receive anything for 10 seconds,
|
1902
|
+
after which it receives the entire response at once.
|
1903
|
+
When `passenger_buffer_response` is turned off, it works as expected: the client
|
1904
|
+
receives an "entry X" message every second for 10 seconds.
|
1905
|
+
|
1906
|
+
This option may occur in the following places:
|
1907
|
+
|
1908
|
+
* In the 'http' configuration block.
|
1909
|
+
* In a 'server' configuration block.
|
1910
|
+
* In a 'location' configuration block.
|
1911
|
+
* In an 'if' configuration scope.
|
1912
|
+
|
1913
|
+
In each place, it may be specified at most once. The default value is 'off'.
|
1914
|
+
|
1915
|
+
==== passenger_buffer_size ====
|
1916
|
+
==== passenger_buffers ====
|
1917
|
+
==== passenger_busy_buffer_size ====
|
1918
|
+
These options have the same effect as proxy_module's similarly named options.
|
1919
|
+
They can be used to modify the maximum allowed HTTP header size.
|
1920
|
+
|
1921
|
+
|
1781
1922
|
=== Logging and debugging options ===
|
1782
1923
|
|
1783
1924
|
[[PassengerLogLevel]]
|