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
@@ -0,0 +1,70 @@
|
|
1
|
+
# Phusion Passenger Developer QuickStart
|
2
|
+
|
3
|
+
<a href="https://vimeo.com/phusionnl/review/97427161/15cb4cc59a"><img src="http://blog.phusion.nl/wp-content/uploads/2014/06/passenger_developer_quickstart.png"></a>
|
4
|
+
|
5
|
+
_Watch the Developer QuickStart screencast_
|
6
|
+
|
7
|
+
Phusion Passenger provides an easy and convenient development environment that contributors can use. The development environment is a 64-bit Ubuntu 14.04 virtual machine and contains everything that you need. The build toolchain is already setup, all dependencies are installed and web servers are preconfigured. You can start coding almost immediately. And because it's a virtual machine, it doesn't matter which host operating system you're using.
|
8
|
+
|
9
|
+
You use this development environment through [Vagrant](http://www.vagrantup.com/) and [VirtualBox](https://www.virtualbox.org/). Vagrant is an extremely useful tool for managing virtual machines, while VirtualBox is virtualization software. Both tools are free and open source. Vagrant allows you to easily share a directory between the host OS and the VM. This means that you can use the editor on your host OS to edit source files, and compile inside the VM.
|
10
|
+
|
11
|
+
## Getting started
|
12
|
+
|
13
|
+
1. Install [Vagrant](http://www.vagrantup.com/).
|
14
|
+
2. Install [VirtualBox](http://www.virtualbox.org/).
|
15
|
+
3. Inside the Phusion Passenger source tree, run: `vagrant up`. This will spin up the VM and will set it up. This can take a while so feel free to grab a cup of coffee.
|
16
|
+
4. Once the VM has been setup, login to it by running: `vagrant ssh`.
|
17
|
+
|
18
|
+
## Workflow
|
19
|
+
|
20
|
+
The workflow is to:
|
21
|
+
|
22
|
+
* Edit code on the host.
|
23
|
+
* Use git commands on the host.
|
24
|
+
* Compile in the VM.
|
25
|
+
* Run tests in the VM.
|
26
|
+
|
27
|
+
The Phusion Passenger source code is located in /vagrant.
|
28
|
+
|
29
|
+
When you're done developing Phusion Passenger, you can shut down the VM by running `vagrant halt`. Next time you want to spin it up again, run `vagrant up`.
|
30
|
+
|
31
|
+
## Starting and accessing Apache
|
32
|
+
|
33
|
+
Apache is installed, but it's not set up with Phusion Passenger by default. So you must first compile the Phusion Passenger Apache module:
|
34
|
+
|
35
|
+
cd /vagrant
|
36
|
+
rake apache2
|
37
|
+
|
38
|
+
Next, enable the Phusion Passenger module and restart Apache:
|
39
|
+
|
40
|
+
sudo a2enmod passenger
|
41
|
+
sudo service apache2 restart
|
42
|
+
|
43
|
+
You can now access Apache from the host on http://127.0.0.1:8000 through :8005. The VM has a sample Ruby Rack application configured on http://127.0.0.1:8001/. Visit that URL and see it in action. Its source code is located in `dev/rack.test` in the Phusion Passenger source tree.
|
44
|
+
|
45
|
+
## Starting and accessing Nginx
|
46
|
+
|
47
|
+
The Nginx source code and binaries are located in /home/vagrant/nginx. If this is the first time you use Nginx in this VM, you must install it. Run:
|
48
|
+
|
49
|
+
cd /home/vagrant/nginx
|
50
|
+
rake bootstrap
|
51
|
+
|
52
|
+
Next, start Nginx by using a script that the development environment provides:
|
53
|
+
|
54
|
+
./start
|
55
|
+
|
56
|
+
You can now access Nginx from the host on http://127.0.0.1:8100 through :8105. The VM has a sample Ruby Rack application configured on http://127.0.0.1:8101/. Visit that URL and see it in action. Its source code is located in `dev/rack.test` in the Phusion Passenger source tree.
|
57
|
+
|
58
|
+
## Running tests
|
59
|
+
|
60
|
+
Tests can be run immediately without any setup.
|
61
|
+
|
62
|
+
rake test:cxx
|
63
|
+
rake test:integration:apache2
|
64
|
+
rake test:integration:nginx
|
65
|
+
|
66
|
+
## Further reading
|
67
|
+
|
68
|
+
* [Contributors Guide](https://github.com/phusion/passenger/blob/master/CONTRIBUTING.md)
|
69
|
+
* [Design and Architecture](https://www.phusionpassenger.com/documentation/Design%20and%20Architecture.html)
|
70
|
+
* [Coding Tips and Pitfalls](https://github.com/phusion/passenger/blob/master/doc/CodingTipsAndPitfalls.md)
|
@@ -134,33 +134,37 @@
|
|
134
134
|
|
135
135
|
8.3.1. PassengerEnabled <on|off> => passengerenabled-on-off--74rzth
|
136
136
|
|
137
|
-
8.3.2.
|
137
|
+
8.3.2. PassengerBaseURI <uri> => passengerbaseuri-uri--97i9mm
|
138
138
|
|
139
|
-
8.
|
139
|
+
8.4. Application loading options => application-loading-options-1uedd4o
|
140
140
|
|
141
|
-
8.
|
141
|
+
8.4.1. PassengerRuby <filename> => passengerruby-filename--1r3fv73
|
142
142
|
|
143
|
-
8.
|
143
|
+
8.4.2. PassengerPython <filename> => passengerpython-filename--1ssesv3
|
144
144
|
|
145
|
-
8.3.
|
145
|
+
8.4.3. PassengerNodejs <filename> => passengernodejs-filename--2mjb1j
|
146
146
|
|
147
|
-
8.
|
147
|
+
8.4.4. PassengerAppEnv <string> => passengerappenv-string--s3ojlc
|
148
148
|
|
149
|
-
8.
|
149
|
+
8.4.5. RailsEnv <string> => railsenv-string--1b0xxvu
|
150
150
|
|
151
|
-
8.
|
151
|
+
8.4.6. RackEnv <string> => rackenv-string--vve9py
|
152
152
|
|
153
|
-
8.
|
153
|
+
8.4.7. PassengerAppRoot <path/to/root> => passengerapproot-path-to-root--uf24yd
|
154
154
|
|
155
|
-
8.
|
155
|
+
8.4.8. PassengerAppType <name> => passengerapptype-name--62jzqf
|
156
156
|
|
157
|
-
8.
|
157
|
+
8.4.9. PassengerStartupFile <filename> => passengerstartupfile-filename--14vhvn9
|
158
158
|
|
159
|
-
8.4.
|
159
|
+
8.4.10. PassengerRestartDir <directory> => passengerrestartdir-directory--1fmhmv0
|
160
160
|
|
161
|
-
8.4.
|
161
|
+
8.4.11. PassengerSpawnMethod <string> => passengerspawnmethod-string--sodg2y
|
162
162
|
|
163
|
-
8.4.
|
163
|
+
8.4.12. PassengerLoadShellEnvvars <on|off> => passengerloadshellenvvars-on-off--1290yz1
|
164
|
+
|
165
|
+
8.4.13. PassengerRollingRestarts <on|off> => passengerrollingrestarts
|
166
|
+
|
167
|
+
8.4.14. PassengerResistDeploymentErrors <on|off> => passengerresistdeploymenterrors
|
164
168
|
|
165
169
|
8.5. Security options => security-options-1pb75ho
|
166
170
|
|
@@ -218,6 +222,10 @@
|
|
218
222
|
|
219
223
|
8.7.4. PassengerMaxRequestQueueSize <number> => passenger-max-request-queue-size-number--1f1uocd
|
220
224
|
|
225
|
+
8.7.5. PassengerStickySessions <on|off> => passengerstickysessions-on-off--fx1jkt
|
226
|
+
|
227
|
+
8.7.6. PassengerStickySessionsCookieName => passenger-sticky-sessions-cookie-name-stktkx
|
228
|
+
|
221
229
|
8.8. Compatibility options => compatibility-options-8jve5a
|
222
230
|
|
223
231
|
8.8.1. PassengerResolveSymlinksInDocumentRoot <on|off> => passengerresolvesymlinksindocumentroot-on-off--1r0qcp8
|
@@ -398,15 +406,13 @@
|
|
398
406
|
|
399
407
|
15.2.2. Summary of benefits => summary-of-benefits-1yrihfb
|
400
408
|
|
401
|
-
15.3. Smart spawning
|
409
|
+
15.3. Smart spawning caveat #1: unintentional file descriptor sharing => smart-spawning-gotcha-1-unintentional-file-descriptor-sharing-z1y55l
|
402
410
|
|
403
411
|
15.3.1. Example 1: Memcached connection sharing (harmful) => example-1-memcached-connection-sharing-harmful--c71wqw
|
404
412
|
|
405
413
|
15.3.2. Example 2: Log file sharing (not harmful) => example-2-log-file-sharing-not-harmful--1p2yuol
|
406
414
|
|
407
|
-
15.4. Smart spawning
|
408
|
-
|
409
|
-
15.5. Smart spawning gotcha #3: code load order => smart-spawning-gotcha-3-code-load-order-nkotiy
|
415
|
+
15.4. Smart spawning caveat #2: the need to revive threads => smart-spawning-gotcha-2-the-need-to-revive-threads-1k6cj7d
|
410
416
|
|
411
417
|
16. Appendix D: About environment variables => appendix-d-about-environment-variables-1lebv1u
|
412
418
|
|
data/doc/Users guide Apache.txt
CHANGED
@@ -612,6 +612,24 @@ This way, Phusion Passenger will not interfere with Wordpress.
|
|
612
612
|
|
613
613
|
In each place, it may be specified at most once. The default value is 'on'.
|
614
614
|
|
615
|
+
[[PassengerBaseURI]]
|
616
|
+
==== PassengerBaseURI <uri> ====
|
617
|
+
Used to specify that the given URI is a Phusion Passenger-served application. Please refer
|
618
|
+
to the following sections for examples:
|
619
|
+
|
620
|
+
* <<deploying_rails_to_sub_uri,Deploying Rails 1.x and 2.x to a sub URI>>
|
621
|
+
* <<deploying_rack_to_sub_uri,Deploying Rack (including Rails >= 3) to a sub URI>>
|
622
|
+
* <<deploying_python_to_sub_uri,Deploying Python to a sub URI>>
|
623
|
+
|
624
|
+
This option may occur in the following places:
|
625
|
+
|
626
|
+
* In the global server configuration.
|
627
|
+
* In a virtual host configuration block.
|
628
|
+
* In a `<Directory>` or `<Location>` block.
|
629
|
+
* In '.htaccess', if `AllowOverride Options` is on.
|
630
|
+
|
631
|
+
=== Application loading options
|
632
|
+
|
615
633
|
[[PassengerRuby]]
|
616
634
|
==== PassengerRuby <filename>
|
617
635
|
The `PassengerDefaultRuby` and `PassengerRuby` directives specify the Ruby interpreter to use. Similarly, the `PassengerPython` and `PassengerNodejs` directives are for specifying the Python interpreter and the Node.js command, respectively.
|
@@ -746,27 +764,102 @@ Example:
|
|
746
764
|
-----------------------------
|
747
765
|
<VirtualHost test.host>
|
748
766
|
DocumentRoot /var/rails/zena/sites/example.com/public
|
749
|
-
|
750
|
-
|
751
|
-
|
767
|
+
# Normally Phusion Passenger would have assumed that the
|
768
|
+
# application root is "/var/rails/zena/sites/example.com".
|
769
|
+
# This overrides it.
|
770
|
+
PassengerAppRoot /var/rails/zena
|
752
771
|
</VirtualHost>
|
753
772
|
-----------------------------
|
754
773
|
|
755
|
-
[[
|
756
|
-
====
|
757
|
-
|
758
|
-
|
774
|
+
[[PassengerAppType]]
|
775
|
+
==== PassengerAppType <name>
|
776
|
+
:version: 4.0.25
|
777
|
+
include::users_guide_snippets/since_version.txt[]
|
759
778
|
|
760
|
-
|
761
|
-
|
762
|
-
|
779
|
+
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,PassengerStartupFile>>) then you can use this option to force Phusion Passenger to recognize the application as a specific type.
|
780
|
+
|
781
|
+
Allowed values are:
|
782
|
+
|
783
|
+
* `rack` - Ruby on Rails >= 3.0 and Ruby Rack
|
784
|
+
* `classic-rails` - Ruby on Rails 1.x and 2.0
|
785
|
+
* `wsgi` - Python
|
786
|
+
* `node` - Node.js, or Meteor JS in bundled mode
|
787
|
+
* `meteor` - Meteor JS in non-bundled mode
|
788
|
+
|
789
|
+
If you set this option, then you **must** also set <<PassengerAppRoot,PassengerAppRoot>>, otherwise Phusion Passenger does not properly recognize your application.
|
763
790
|
|
764
791
|
This option may occur in the following places:
|
765
792
|
|
766
793
|
* In the global server configuration.
|
767
794
|
* In a virtual host configuration block.
|
768
795
|
* In a `<Directory>` or `<Location>` block.
|
769
|
-
* In '.htaccess'
|
796
|
+
* In '.htaccess'.
|
797
|
+
|
798
|
+
In each place, it may be specified at most once.
|
799
|
+
|
800
|
+
Example:
|
801
|
+
|
802
|
+
-----------------------------
|
803
|
+
<VirtualHost test.host>
|
804
|
+
DocumentRoot /webapps/example.com/public
|
805
|
+
# Use server.js as the startup file (entry point file) for
|
806
|
+
# your Node.js application, instead of the default app.js
|
807
|
+
PassengerStartupFile server.js
|
808
|
+
PassengerAppType node
|
809
|
+
PassengerAppRoot /webapps/example.com
|
810
|
+
</VirtualHost>
|
811
|
+
-----------------------------
|
812
|
+
|
813
|
+
[[PassengerStartupFile]]
|
814
|
+
==== PassengerStartupFile <filename>
|
815
|
+
:version: 4.0.25
|
816
|
+
include::users_guide_snippets/since_version.txt[]
|
817
|
+
|
818
|
+
This option specifies the startup file that Phusion Passenger should use when loading the application.
|
819
|
+
|
820
|
+
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.
|
821
|
+
|
822
|
+
Other languages have no conventions at all, and so Phusion Passenger invents one (e.g. Python WSGI with `passenger_wsgi.py`).
|
823
|
+
|
824
|
+
Here's a list of the language-specific conventions that Phusion Passenger accepts:
|
825
|
+
|
826
|
+
[options="header"]
|
827
|
+
|================================================
|
828
|
+
| Language | Phusion Passenger convention
|
829
|
+
| Ruby on Rails >= 3.0, Ruby Rack | config.ru
|
830
|
+
| Ruby on Rails 1.x and 2.x | config/environment.rb
|
831
|
+
| Python | passenger_wsgi.py
|
832
|
+
| Node.js | app.js
|
833
|
+
|================================================
|
834
|
+
|
835
|
+
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.
|
836
|
+
|
837
|
+
Notes:
|
838
|
+
|
839
|
+
* 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.
|
840
|
+
* If you set this option, you **must** also set <<PassengerAppRoot,PassengerAppRoot>> and <<PassengerAppType,PassengerAppType>>, otherwise Phusion Passenger doesn't know what kind of application it is.
|
841
|
+
|
842
|
+
This option may occur in the following places:
|
843
|
+
|
844
|
+
* In the global server configuration.
|
845
|
+
* In a virtual host configuration block.
|
846
|
+
* In a `<Directory>` or `<Location>` block.
|
847
|
+
* In '.htaccess'.
|
848
|
+
|
849
|
+
In each place, it may be specified at most once.
|
850
|
+
|
851
|
+
Example:
|
852
|
+
|
853
|
+
-----------------------------
|
854
|
+
<VirtualHost test.host>
|
855
|
+
DocumentRoot /webapps/example.com/public
|
856
|
+
# Use server.js as the startup file (entry point file) for
|
857
|
+
# your Node.js application, instead of the default app.js
|
858
|
+
PassengerStartupFile server.js
|
859
|
+
PassengerAppType node
|
860
|
+
PassengerAppRoot /webapps/example.com
|
861
|
+
</VirtualHost>
|
862
|
+
-----------------------------
|
770
863
|
|
771
864
|
==== PassengerRestartDir <directory>
|
772
865
|
As described in the deployment chapters of this document, Phusion Passenger
|
@@ -826,6 +919,50 @@ allow the attacker to cause a Denial-of-Service.
|
|
826
919
|
You can prevent this from happening by pointing PassengerRestartDir to a
|
827
920
|
directory that's readable by Apache, but only writable by administrators.
|
828
921
|
|
922
|
+
[[PassengerSpawnMethod]]
|
923
|
+
==== PassengerSpawnMethod <string>
|
924
|
+
[TIP]
|
925
|
+
."What spawn method should I use?"
|
926
|
+
=========================================================
|
927
|
+
This subsection attempts to describe spawn methods, but it's okay if you don't (want to)
|
928
|
+
understand it, as it's mostly a technical detail. You can basically follow this rule of thumb:
|
929
|
+
|
930
|
+
************************************************
|
931
|
+
If your application works on Mongrel or Thin, but not on Phusion Passenger, then set
|
932
|
+
`PassengerSpawnMethod` to 'direct'. Otherwise, leave it at 'smart' (the default).
|
933
|
+
************************************************
|
934
|
+
|
935
|
+
However, we do recommend you to try to understand it. The 'smart' spawn
|
936
|
+
method bring many benefits.
|
937
|
+
=========================================================
|
938
|
+
|
939
|
+
include::users_guide_snippets/passenger_spawn_method.txt[]
|
940
|
+
|
941
|
+
This option may occur in the following places:
|
942
|
+
|
943
|
+
* In the global server configuration.
|
944
|
+
* In a virtual host configuration block.
|
945
|
+
|
946
|
+
In each place, it may be specified at most once. The default value is 'smart'.
|
947
|
+
|
948
|
+
[[PassengerLoadShellEnvvars]]
|
949
|
+
==== PassengerLoadShellEnvvars <on|off>
|
950
|
+
:version: 4.0.20
|
951
|
+
include::users_guide_snippets/since_version.txt[]
|
952
|
+
|
953
|
+
Enables or disables the loading of shell environment variables before spawning the application.
|
954
|
+
|
955
|
+
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 `PassengerHelperAgent` process.
|
956
|
+
|
957
|
+
This option may occur in the following places:
|
958
|
+
|
959
|
+
* In the global server configuration.
|
960
|
+
* In a virtual host configuration block.
|
961
|
+
* In a `<Directory>` or `<Location>` block.
|
962
|
+
* In '.htaccess', if `AllowOverride Options` is on.
|
963
|
+
|
964
|
+
In each place, it may be specified at most once. The default value is 'on'.
|
965
|
+
|
829
966
|
[[PassengerRollingRestarts]]
|
830
967
|
==== PassengerRollingRestarts <on|off>
|
831
968
|
:version: 3.0.0
|
@@ -902,52 +1039,6 @@ This option may occur in the following places:
|
|
902
1039
|
|
903
1040
|
In each place, it may be specified at most once. The default value is 'off'.
|
904
1041
|
|
905
|
-
=== Process spawning options
|
906
|
-
|
907
|
-
[[PassengerSpawnMethod]]
|
908
|
-
==== PassengerSpawnMethod <string>
|
909
|
-
[TIP]
|
910
|
-
."What spawn method should I use?"
|
911
|
-
=========================================================
|
912
|
-
This subsection attempts to describe spawn methods, but it's okay if you don't (want to)
|
913
|
-
understand it, as it's mostly a technical detail. You can basically follow this rule of thumb:
|
914
|
-
|
915
|
-
************************************************
|
916
|
-
If your application works on Mongrel or Thin, but not on Phusion Passenger, then set
|
917
|
-
`PassengerSpawnMethod` to 'direct'. Otherwise, leave it at 'smart' (the default).
|
918
|
-
************************************************
|
919
|
-
|
920
|
-
However, we do recommend you to try to understand it. The 'smart' spawn
|
921
|
-
method bring many benefits.
|
922
|
-
=========================================================
|
923
|
-
|
924
|
-
include::users_guide_snippets/passenger_spawn_method.txt[]
|
925
|
-
|
926
|
-
This option may occur in the following places:
|
927
|
-
|
928
|
-
* In the global server configuration.
|
929
|
-
* In a virtual host configuration block.
|
930
|
-
|
931
|
-
In each place, it may be specified at most once. The default value is 'smart'.
|
932
|
-
|
933
|
-
[[PassengerLoadShellEnvvars]]
|
934
|
-
==== PassengerLoadShellEnvvars <on|off>
|
935
|
-
:version: 4.0.20
|
936
|
-
include::users_guide_snippets/since_version.txt[]
|
937
|
-
|
938
|
-
Enables or disables the loading of shell environment variables before spawning the application.
|
939
|
-
|
940
|
-
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 `PassengerHelperAgent` process.
|
941
|
-
|
942
|
-
This option may occur in the following places:
|
943
|
-
|
944
|
-
* In the global server configuration.
|
945
|
-
* In a virtual host configuration block.
|
946
|
-
* In a `<Directory>` or `<Location>` block.
|
947
|
-
* In '.htaccess', if `AllowOverride Options` is on.
|
948
|
-
|
949
|
-
In each place, it may be specified at most once. The default value is 'on'.
|
950
|
-
|
951
1042
|
=== Security options ===
|
952
1043
|
|
953
1044
|
[[PassengerUserSwitching]]
|
@@ -1206,19 +1297,19 @@ The default value is '300'.
|
|
1206
1297
|
|
1207
1298
|
[[PassengerMaxPreloaderIdleTime]]
|
1208
1299
|
==== PassengerMaxPreloaderIdleTime <integer> ====
|
1209
|
-
The
|
1300
|
+
The preloader process(explained in <<spawning_methods_explained,Spawning
|
1210
1301
|
methods explained>>) has an idle timeout, just like the backend processes spawned by
|
1211
1302
|
Phusion Passenger do. That is, it will automatically shutdown if it hasn't done
|
1212
1303
|
anything for a given period.
|
1213
1304
|
|
1214
|
-
This option allows you to set the
|
1305
|
+
This option allows you to set the preloader's idle timeout, in
|
1215
1306
|
seconds. A value of '0' means that it should never idle timeout.
|
1216
1307
|
|
1217
|
-
Setting a higher value will mean that the
|
1308
|
+
Setting a higher value will mean that the preloader is kept around
|
1218
1309
|
longer, which may slightly increase memory usage. But as long as the
|
1219
|
-
|
1310
|
+
preloader server is running, the time to spawn a Ruby on Rails backend
|
1220
1311
|
process only takes about 10% of the time that is normally needed, assuming that
|
1221
|
-
you're using the 'smart'
|
1312
|
+
you're using the 'smart' <<PassengerSpawnMethod,spawning method>>. So if your
|
1222
1313
|
system has enough memory, is it recommended that you set this option to a high
|
1223
1314
|
value or to '0'.
|
1224
1315
|
|
@@ -1878,6 +1969,53 @@ This option may occur in the following places:
|
|
1878
1969
|
|
1879
1970
|
In each place, it may be specified at most once. The default value is '100'.
|
1880
1971
|
|
1972
|
+
[[PassengerStickySessions]]
|
1973
|
+
==== PassengerStickySessions <on|off>
|
1974
|
+
:version: 4.0.55
|
1975
|
+
include::users_guide_snippets/since_version.txt[]
|
1976
|
+
|
1977
|
+
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.
|
1978
|
+
|
1979
|
+
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.
|
1980
|
+
|
1981
|
+
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.
|
1982
|
+
|
1983
|
+
So prominent examples where sticky sessions should (or even *must*) be enabled, include:
|
1984
|
+
|
1985
|
+
* Applications that use the SockJS library (unless configured with a distributed data store)
|
1986
|
+
* Applications that use the Socket.io library (unless configured with a distributed data store)
|
1987
|
+
* Applications that use the faye-websocket gem (unless configured with a distributed data store)
|
1988
|
+
* Meteor JS applications (because Meteor uses SockJS)
|
1989
|
+
|
1990
|
+
Sticky sessions work through the use of a special cookie, whose name can be customized with <<PassengerStickySessionsCookieName,PassengerStickySessionsCookieName>>. 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.
|
1991
|
+
|
1992
|
+
If you have a load balancer in front end of Phusion Passenger + Apache, then you must configure sticky sessions on that load balancer too. Otherwise, the load balancer could route the request to a different server.
|
1993
|
+
|
1994
|
+
This option may occur in the following places:
|
1995
|
+
|
1996
|
+
* In the global server configuration.
|
1997
|
+
* In a virtual host configuration block.
|
1998
|
+
* In a `<Directory>` or `<Location>` block.
|
1999
|
+
* In '.htaccess'.
|
2000
|
+
|
2001
|
+
In each place, it may be specified at most once. The default value is `off`.
|
2002
|
+
|
2003
|
+
[[PassengerStickySessionsCookieName]]
|
2004
|
+
==== PassengerStickySessionsCookieName
|
2005
|
+
:version: 4.0.55
|
2006
|
+
include::users_guide_snippets/since_version.txt[]
|
2007
|
+
|
2008
|
+
Sets the name of the <<PassengerStickySessions,sticky sessions>> cookie.
|
2009
|
+
|
2010
|
+
This option may occur in the following places:
|
2011
|
+
|
2012
|
+
* In the global server configuration.
|
2013
|
+
* In a virtual host configuration block.
|
2014
|
+
* In a `<Directory>` or `<Location>` block.
|
2015
|
+
* In '.htaccess'.
|
2016
|
+
|
2017
|
+
In each place, it may be specified at most once. The default value is `passenger_route`.
|
2018
|
+
|
1881
2019
|
|
1882
2020
|
=== Compatibility options ===
|
1883
2021
|
|