passenger 5.0.14 → 5.0.15
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of passenger might be problematic. Click here for more details.
- checksums.yaml +8 -8
- checksums.yaml.gz.asc +7 -7
- data.tar.gz.asc +7 -7
- data/CHANGELOG +9 -0
- data/INSTALL.md +1 -1
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/bin/passenger-install-apache2-module +6 -10
- data/bin/passenger-install-nginx-module +6 -9
- data/doc/CloudLicensingConfiguration.html +1 -216
- data/doc/CloudLicensingConfiguration.txt.md +1 -192
- data/doc/Design and Architecture.html +4 -4
- data/doc/Design and Architecture.txt +4 -4
- data/doc/ServerOptimizationGuide.html +1 -489
- data/doc/ServerOptimizationGuide.txt.md +1 -399
- data/doc/Users guide Apache.html +594 -6720
- data/doc/Users guide Apache.idmap.txt +15 -12
- data/doc/Users guide Apache.txt +113 -2047
- data/doc/Users guide Nginx.html +565 -6720
- data/doc/Users guide Nginx.idmap.txt +15 -12
- data/doc/Users guide Nginx.txt +94 -1862
- data/doc/Users guide Standalone.html +53 -2183
- data/doc/Users guide Standalone.idmap.txt +9 -6
- data/doc/Users guide Standalone.txt +16 -360
- data/doc/Users guide.html +3 -145
- data/doc/Users guide.txt +2 -54
- data/doc/users_guide_snippets/analysis_and_system_maintenance.txt +36 -175
- data/doc/users_guide_snippets/appendix_c_spawning_methods.txt +9 -215
- data/doc/users_guide_snippets/environment_variables.txt +11 -243
- data/doc/users_guide_snippets/installation.txt +66 -946
- data/doc/users_guide_snippets/rackup_specifications.txt +1 -75
- data/doc/users_guide_snippets/support_information.txt +1 -48
- data/doc/users_guide_snippets/tips.txt +103 -704
- data/doc/users_guide_snippets/troubleshooting/default.txt +16 -130
- data/doc/users_guide_snippets/troubleshooting/rails.txt +15 -12
- data/doc/users_guide_snippets/under_the_hood/relationship_with_ruby.txt +2 -113
- data/ext/apache2/Configuration.hpp +2 -2
- data/ext/apache2/Hooks.cpp +2 -2
- data/ext/common/AgentsStarter.h +18 -10
- data/ext/common/ApplicationPool2/ErrorRenderer.h +0 -3
- data/ext/common/ApplicationPool2/Options.h +8 -1
- data/ext/common/Constants.h +3 -9
- data/ext/common/agent/Core/RequestHandler/InitRequest.cpp +2 -0
- data/ext/common/agent/Watchdog/Main.cpp +1 -1
- data/ext/nginx/ContentHandler.c +2 -3
- data/ext/nginx/config +2 -2
- data/lib/phusion_passenger.rb +1 -22
- data/lib/phusion_passenger/abstract_installer.rb +10 -10
- data/lib/phusion_passenger/config/agent_compiler.rb +5 -5
- data/lib/phusion_passenger/config/nginx_engine_compiler.rb +4 -4
- data/lib/phusion_passenger/config/validate_install_command.rb +3 -3
- data/lib/phusion_passenger/constants.rb +1 -5
- data/lib/phusion_passenger/loader_shared_helpers.rb +16 -5
- data/lib/phusion_passenger/platform_info/apache_detector.rb +2 -2
- data/lib/phusion_passenger/public_api.rb +11 -2
- data/lib/phusion_passenger/request_handler/thread_handler.rb +2 -3
- data/lib/phusion_passenger/ruby_core_io_enhancements.rb +4 -1
- data/lib/phusion_passenger/standalone/start_command.rb +1 -1
- data/resources/oss-binaries.phusionpassenger.com.crt +124 -0
- data/resources/templates/apache2/deployment_example.txt.erb +5 -23
- data/resources/templates/apache2/installing_against_a_different_apache.txt.erb +3 -4
- data/resources/templates/apache2/possible_solutions_for_compilation_and_installation_problems.txt.erb +3 -3
- data/resources/templates/apache2/rpm_installation_recommended.txt.erb +1 -1
- data/resources/templates/installer_common/low_amount_of_memory_warning.txt.erb +4 -5
- data/resources/templates/nginx/deployment_example.txt.erb +5 -17
- data/resources/templates/nginx/possible_solutions_for_compilation_and_installation_problems.txt.erb +3 -3
- data/resources/templates/standalone/config.erb +1 -1
- data/resources/templates/undisclosed_error.html.template +4 -11
- metadata +2 -2
- metadata.gz.asc +7 -7
@@ -96,12 +96,6 @@
|
|
96
96
|
|
97
97
|
7. Troubleshooting => troubleshooting-o7g75o
|
98
98
|
|
99
|
-
7.1. Generic troubleshooting tips => generic-troubleshooting-tips-2vokcr
|
100
|
-
|
101
|
-
7.2. Upon uploading a file, Phusion Passenger reports "client_body_temp/00000000xx failed (2: No such file or directory)" => upon-uploading-a-file-phusion-passenger-reports-client-body-temp-00000000xx-failed-2-no-such-file-or-directory--d01goe
|
102
|
-
|
103
|
-
7.3. I get "command not found" when running a Phusion Passenger command through sudo => i-get-command-not-found-when-running-a-phusion-passenger-command-through-sudo-14k8kde
|
104
|
-
|
105
99
|
8. Under the hood => under-the-hood-ub7j3q
|
106
100
|
|
107
101
|
8.1. Phusion Passenger and its relationship with Ruby => phusion-passenger-and-its-relationship-with-ruby-1usvd0o
|
@@ -132,3 +126,12 @@
|
|
132
126
|
|
133
127
|
9.4. Environment variables and sudo => environment-variables-and-sudo-znzmif
|
134
128
|
|
129
|
+
|
130
|
+
### These sections appear to have been removed. Please check.
|
131
|
+
|
132
|
+
7.1. Generic troubleshooting tips => generic-troubleshooting-tips-2vokcr
|
133
|
+
|
134
|
+
7.2. Upon uploading a file, Phusion Passenger reports "client_body_temp/00000000xx failed (2: No such file or directory)" => upon-uploading-a-file-phusion-passenger-reports-client-body-temp-00000000xx-failed-2-no-such-file-or-directory--d01goe
|
135
|
+
|
136
|
+
7.3. I get "command not found" when running a Phusion Passenger command through sudo => i-get-command-not-found-when-running-a-phusion-passenger-command-through-sudo-14k8kde
|
137
|
+
|
@@ -2,13 +2,7 @@
|
|
2
2
|
|
3
3
|
image:images/phusion_banner.png[link="http://www.phusion.nl/"]
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
In the Standalone mode, Phusion Passenger operates as a fully-featured, secure standalone HTTP server. You do not need to have an existing web server like Apache or Nginx. This mode is ideal...
|
8
|
-
|
9
|
-
* ...if you are not familiar with Apache or Nginx
|
10
|
-
* ...when you want to quickly start up a server without editing configuration files (e.g. during development)
|
11
|
-
* ...or when you want to decouple the web server from the application server, by setting up reverse proxies.
|
5
|
+
This is the old, deprecated Passenger Standalone documentation. Please visit https://www.phusionpassenger.com/library/ for the new documentation.
|
12
6
|
|
13
7
|
== Support information
|
14
8
|
|
@@ -23,397 +17,59 @@ include::users_guide_snippets/installation.txt[]
|
|
23
17
|
|
24
18
|
== Usage
|
25
19
|
|
26
|
-
|
27
|
-
|
28
|
-
------------------------------
|
29
|
-
passenger start
|
30
|
-
------------------------------
|
20
|
+
This documentation has moved. Please visit the walkthroughs at https://www.phusionpassenger.com/library/ to learn how to use Passenger Standalone. Or visit link:https://www.phusionpassenger.com/library/deploy/standalone/deploy/[the new deployment documentation].
|
31
21
|
|
32
22
|
== Configuration
|
33
23
|
|
24
|
+
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/standalone/
|
25
|
+
|
34
26
|
=== Command line options
|
35
27
|
|
36
|
-
|
37
|
-
|
38
|
-
`--port NUMBER`::
|
39
|
-
The port number that Phusion Passenger Standalone should listen on. If not given, port 3000 is assumed.
|
40
|
-
`--environment NAME`::
|
41
|
-
Customizes the value of the `RAILS_ENV`, `RACK_ENV`, `WSGI_ENV`, `NODE_ENV` and `PASSENGER_APP_ENV` environment variables. Some web frameworks, for example Rails and Connect.js, adjust their behavior according to the environment. The default value is 'development'.
|
42
|
-
`--max-pool-size NUMBER`::
|
43
|
-
The maximum number of application processes to run. The maximum number that you can run depends on the amount of memory your server has. The article link:http://blog.phusion.nl/2013/03/12/tuning-phusion-passengers-concurrency-settings/[Tuning Phusion Passenger's concurrency settings] explains how you can infer a good number for this option.
|
44
|
-
`--min-instances NUMBER`::
|
45
|
-
If you don't want the number of application processes to scale dynamically, then use this option to set it to a value equal to `--max-pool-size`.
|
46
|
-
`--spawn-method NAME`::
|
47
|
-
When set to "smart" (the default), Phusion Passenger preloads your app and utilizes copy-on-write in order to save memory. You can disable this by setting this option to "direct". Preloading is only supported for Ruby apps. For apps written in other languages, it is as if "direct" is always used.
|
48
|
-
`--friendly-error-pages`::
|
49
|
-
Phusion Passenger can display a friendly error page whenever your application fails to start. The friendly error page presents the startup error message, some suggestions for solving the problem, a backtrace, and a dump of the environment variables. This feature is very useful during application development and useful for less experienced system administrators, but the page might reveal potentially sensitive information, depending on the application. For this reason, friendly error pages are turned off by default when `--environment` is set to 'staging' or 'production', but enabled by default otherwise.
|
50
|
-
+
|
51
|
-
You can use `--friendly-error-pages` and `--no-friendly-error-pages` to explicitly enable or disable this feature, respectively.
|
52
|
-
|
53
|
-
`--sticky-sessions`::
|
54
|
-
Enables link:Users%20guide%20Nginx.html#PassengerStickySessions[sticky sessions]. Required for SockJS, Socket.io, faye-websocket and Meteor JS applications.
|
55
|
-
`--sticky-sessions-cookie-name NAME`::
|
56
|
-
Allows customizing the sticky session cookie name.
|
57
|
-
`--ssl`::
|
58
|
-
Enables SSL support. If this is set, you must also set `--ssl-certificate` and `--ssl-certificate-key` to the SSL certificate and key files, respectively.
|
59
|
-
`--ssl-port`::
|
60
|
-
If `--ssl` is given, and you set this option, then Phusion Passenger Standalone will listen for HTTP on the regular `--port` number, *as well as* listen for HTTPS on the port you specified with this option. For example:
|
61
|
-
+
|
62
|
-
------------------------------------------------------------------------------
|
63
|
-
# Listen for HTTP on port 3000, HTTPS on port 3001.
|
64
|
-
passenger start --ssl --ssl-certificate ... --ssl-certificate-key ... --ssl-port 3001
|
65
|
-
------------------------------------------------------------------------------
|
66
|
-
|
67
|
-
`--nginx-config-template`::
|
68
|
-
Specifies the Nginx configuration template file to use. See <<advanced_configuration,Advanced configuration>>.
|
69
|
-
|
70
|
-
See `--help` for all available options.
|
28
|
+
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/standalone/reference/
|
71
29
|
|
72
30
|
|
73
31
|
[[config_file]]
|
74
32
|
=== Configuration file
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
It is possible to store some options in a configuration file `Passengerfile.json` in the application directory. Configuration in this file overrides command line options. The configuration file format is JSON.
|
79
|
-
|
80
|
-
In case Passenger Standalone is in <<mass_deployment,mass deployment mode>>, such a configuration file allows customizing options on a per-application basis.
|
81
|
-
|
82
|
-
The following configuration options are supported:
|
83
|
-
|
84
|
-
`port`::
|
85
|
-
Equivalent to the `--port` command line option.
|
86
|
-
`environment`::
|
87
|
-
Equivalent to the `--environment` command line option.
|
88
|
-
`max_pool_size`::
|
89
|
-
Equivalent to the `--max-pool-size` command line option. But when in mass deployment mode, this option in the configuration file has no effect; the command line option should be used to customize this.
|
90
|
-
`min_instances`::
|
91
|
-
Equivalent to the `--min-instances` command line option.
|
92
|
-
`spawn_method`::
|
93
|
-
Equivalent to the `--spawn-method` command line option.
|
94
|
-
`sticky_sessions`::
|
95
|
-
Equivalent to the `--sticky-sessions` command line option.
|
96
|
-
`sticky_sessions_cookie_name`::
|
97
|
-
Equivalent to the `--sticky-sessions-cookie-name` command line option.
|
98
|
-
`ssl`::
|
99
|
-
Equivalent to the `--ssl` command line option. When given, you must also set `ssl_certificate` and `ssl_certificate_key` in the configuration file.
|
100
|
-
`ssl_port`::
|
101
|
-
Equivalent to the `--ssl-port` command line option.
|
102
|
-
+
|
103
|
-
When in <<mass_deployment,mass deployment mode>>, you will probably want to set a different `port` too. If you don't, and you end up in a situation in which a port is used for both HTTP and HTTPS traffic, then the builtin Nginx core will abort with an error.
|
104
|
-
|
105
|
-
`server_names` (Enterprise only)::
|
106
|
-
Only relevant in <<mass_deployment,mass deployment mode>>. This option specifies which server names (host names) should be routed to this application. This option must be an array of names, e.g. `"server_names": ["foo.com", "bar.com"]`. By default, the name of the application directory is used as the server name. For example, for an application located in /webapps/foobar.com, "foobar.com" is used as the server name.
|
107
|
-
`envvars` (since 5.0.0 RC 1)::
|
108
|
-
Environment variables to pass to the application. This option must be a key-value map, e.g. `"envvars": { "ADMIN_EMAIL": "root@phusion.nl", "SECRET_KEY": "12345" }`.
|
109
|
-
`nginx_config_template`::
|
110
|
-
Equivalent to the `--nginx-config-template` command line option.
|
111
|
-
|
112
|
-
Here is an example configuration file:
|
113
|
-
|
114
|
-
[source,javascript]
|
115
|
-
------------------
|
116
|
-
{
|
117
|
-
"port": 8000,
|
118
|
-
"environment": "production",
|
119
|
-
"ssl": true,
|
120
|
-
"ssl_certificate": "/path-to-cert.crt",
|
121
|
-
"ssl_certificate_key": "/path-to-cert.key"
|
122
|
-
}
|
123
|
-
------------------
|
33
|
+
|
34
|
+
This documentation has moved. Please visit link:https://www.phusionpassenger.com/library/config/standalone/reference/[the new configuration reference] or link:https://www.phusionpassenger.com/library/config/standalone/intro.html[the new configuration introduction document].
|
124
35
|
|
125
36
|
|
126
37
|
[[advanced_configuration]]
|
127
38
|
=== Advanced configuration
|
128
|
-
:version: 4.0.39
|
129
|
-
include::users_guide_snippets/since_version.txt[]
|
130
|
-
|
131
|
-
Phusion Passenger Standalone is built on the same technology that powers link:Users%20guide%20Nginx.html[Phusion Passenger for Nginx], so any configuration option supported by Phusion Passenger for Nginx can be applied to Standalone as well. You can do this by editing the Standalone configuration template directly.
|
132
|
-
|
133
|
-
First, create a copy of the default Phusion Passenger Nginx configuration template file:
|
134
|
-
|
135
|
-
-------------------------------------
|
136
|
-
cp $(passenger-config about resourcesdir)/templates/standalone/config.erb nginx.conf.erb
|
137
|
-
-------------------------------------
|
138
|
-
|
139
|
-
Then open `nginx.conf.erb` and modify it as you see fit. The file is a normal Nginx configuration file, in the ERB template format.
|
140
|
-
|
141
|
-
Every time you start Standalone, you must pass the `--nginx-config-template` parameter, which tells Standalone to use your specific Nginx configuration template file. For example:
|
142
|
-
|
143
|
-
[source,sh]
|
144
|
-
------------------------------------------
|
145
|
-
passenger start --nginx-config-template nginx.conf.erb
|
146
|
-
------------------------------------------
|
147
39
|
|
148
|
-
|
149
|
-
|
150
|
-
NOTE: The original configuration template file may change from time to time, e.g. because new features are introduced into Phusion Passenger. If your configuration template file does not contain the required changes, then these new features may not work properly. In the worst case, Standalone might even malfunction. Therefore, every time you upgrade Phusion Passenger, you should check whether the original configuration template file has changed, and merge back any changes into your own file.
|
40
|
+
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/standalone/intro.html#nginx-configuration-template
|
151
41
|
|
152
42
|
|
153
43
|
== Using Passenger Standalone in production
|
154
44
|
|
155
|
-
|
156
|
-
=== Starting Passenger Standalone at system boot
|
157
|
-
|
158
|
-
The easiest way to have Passenger Standalone started during system boot is add it to the file `/etc/rc.local`. This script is called during system boot.
|
159
|
-
|
160
|
-
Here's an example of what you may want to add to `/etc/rc.local`. If there is an `exit` command in `rc.local`, make sure you add these _before_ the `exit` command.
|
161
|
-
|
162
|
-
[source,sh]
|
163
|
-
------------------------------------------
|
164
|
-
# If you installed Phusion Passenger from tarball, add its `bin` directory to PATH.
|
165
|
-
#export PATH=/path-to-passenger/bin:$PATH
|
166
|
-
|
167
|
-
# Change working directory to your webapp.
|
168
|
-
cd /path-to-your-webapp
|
45
|
+
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/standalone/
|
169
46
|
|
170
|
-
|
171
|
-
# root when run from this file, so we also tell it to drop its privileges to a
|
172
|
-
# normal user. Replace 'someusername' with the user you want to run your
|
173
|
-
# application under.
|
174
|
-
passenger start --daemonize --port 80 --user someusername
|
175
|
-
------------------------------------------
|
176
|
-
|
177
|
-
To stop Passenger Standalone, run:
|
178
|
-
|
179
|
-
[source,sh]
|
180
|
-
------------------------------------------
|
181
|
-
cd /path-to-your-webapp
|
182
|
-
|
183
|
-
# If you use RVM, use 'rvmsudo' instead of 'sudo'
|
184
|
-
sudo passenger stop
|
185
|
-
------------------------------------------
|
47
|
+
=== Starting Passenger Standalone at system boot
|
186
48
|
|
49
|
+
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/standalone/deploy/ruby/#step-4-make-sure-passenger-standalone-starts-on-system-boot
|
187
50
|
|
188
51
|
[[sharing_port]]
|
189
52
|
=== Sharing the same port between multiple Passenger Standalone instances
|
190
53
|
|
191
|
-
|
192
|
-
|
193
|
-
1. The first way is to use the <<mass_deployment,Mass deployment>> feature, which allows Passenger Standalone to directly host multiple applications at the same time. Please refer to that section to learn more.
|
194
|
-
2. The second way is to run multiple Passenger Standalone instances -- one for each application -- and to put all of them behind a *reverse proxy* or *load balancer*. The reverse proxy/load balancer can for example be Nginx, Apache or HAProxy. The reverse proxy/load balancer listens on port 80, determines which Passenger Standalone instance should handle the request, and forwards the request to that instance.
|
195
|
-
3. The third way is to use link:Users%20guide%20Nginx.html[Phusion Passenger for Nginx] or link:Users%20guide%20Apache.html[Phusion Passenger for Apache]. These are two modes of Phusion Passenger that are distinct from the Standalone mode, which this document describes. In the Nginx and Apache modes, Phusion Passenger integrates directly into Nginx and Apache, and makes it very easy to host multiple applications directly on Nginx or Apache.
|
196
|
-
+
|
197
|
-
Compared method 2 -- putting Passenger Standalone behind a reverse proxy or load balancer -- the Nginx or Apache modes are easier to use and require less configuration. On the other hand, the Nginx modes requires reinstalling or recompiling Nginx, while the Apache mode requires that the Phusion Passenger Apache module is installed.
|
198
|
-
|
199
|
-
**The rest of this subsection describes method 2.**
|
200
|
-
|
201
|
-
[float]
|
202
|
-
==== Step 1: starting all applications
|
203
|
-
|
204
|
-
Putting Passenger Standalone behind a reverse proxy requires three steps. First, you must start all Passenger Standalone instances that you want. Each one must be listening on a different port, because two applications can't listen on the same port. Suppose that you have two applications, `/webapps/foo` and `/webapps/bar`. Here's how you may start them:
|
205
|
-
|
206
|
-
[source,sh]
|
207
|
-
------------------------------
|
208
|
-
# Start foo on port 4000
|
209
|
-
cd /webapps/foo
|
210
|
-
passenger start --daemonize --address 127.0.0.1 --port 4000
|
211
|
-
|
212
|
-
# Start bar on port 4010
|
213
|
-
cd /webapps/bar
|
214
|
-
passenger start --daemonize --address 127.0.0.1 --port 4010
|
215
|
-
------------------------------
|
216
|
-
|
217
|
-
Notice the fact that we pass `--address 127.0.0.1`, which tells Passenger Standalone to only listen for requests that originate from the local machine. This is because the reverse proxy/load balancer, not Passenger Standalone, is supposed to be responsible for receiving external HTTP requests. The reverse proxy/load balancer will be running on the same machine only, so limiting Passenger Standalone in this manner improves security.
|
218
|
-
|
219
|
-
[float]
|
220
|
-
==== Step 2: install and configure the reverse proxy/load balancer
|
221
|
-
|
222
|
-
The next step is to **install a reverse proxy/load balancer**, and to **configure** it to do the following:
|
223
|
-
|
224
|
-
* To listen on port 80.
|
225
|
-
* To forward requests to either 'foo' or 'bar', depending on the request's HTTP host name.
|
226
|
-
|
227
|
-
You can use any reverse proxy/load balancer you want, but we're going to show an example using link:http://www.nginx.org/[Nginx] because it's a pretty popular choice. Install Nginx as follows:
|
228
|
-
|
229
|
-
|======================================================================
|
230
|
-
| Debian, Ubuntu | `sudo apt-get update` +
|
231
|
-
`sudo apt-get install nginx-extras`
|
232
|
-
| Red Hat, CentOS, ScientificLinux, Amazon Linux | Enable link:http://fedoraproject.org/wiki/EPEL[EPEL], then run as root: +
|
233
|
-
`yum install nginx`
|
234
|
-
| Mac OS X (Homebrew) | `brew install nginx`
|
235
|
-
| Other operating systems | Install Nginx from link:http://www.nginx.org/[the Nginx website].
|
236
|
-
|======================================================================
|
237
|
-
|
238
|
-
Open the Nginx configuration file:
|
239
|
-
|
240
|
-
|======================================================================
|
241
|
-
| Debian, Ubuntu | `/etc/nginx/nginx.conf`
|
242
|
-
| Red Hat, CentOS, ScientificLinux, Amazon Linux | `/etc/nginx/nginx.conf`
|
243
|
-
| Mac OS X (Homebrew) | `/usr/local/etc/nginx/nginx.conf`
|
244
|
-
| Other operating systems | It depends on how you installed Nginx, but it's usually `$PREFIX/conf/nginx.conf`, where `$PREFIX` is the prefix you installed Nginx to.
|
245
|
-
|======================================================================
|
246
|
-
|
247
|
-
Add virtual host entries for your applications foo and bar. While making the virtual host entries, you must determine what host names foo and bar should respond to. Let's say that foo should respond to 'www.foo.com' and bar should respond to 'www.bar.com'. Then the following entries will tell Nginx to listen on port 80, and to handle requests for the domains 'www.foo.com' and 'www.bar.com' differently.
|
248
|
-
|
249
|
-
--------------------------
|
250
|
-
http {
|
251
|
-
...
|
252
|
-
|
253
|
-
# These are some "magic" Nginx configuration options that aid in making
|
254
|
-
# WebSockets work properly with Passenger Standalone. Please learn more
|
255
|
-
# at http://nginx.org/en/docs/http/websocket.html
|
256
|
-
map $http_upgrade $connection_upgrade {
|
257
|
-
default upgrade;
|
258
|
-
'' close;
|
259
|
-
}
|
260
|
-
|
261
|
-
server {
|
262
|
-
listen 80;
|
263
|
-
server_name www.foo.com;
|
264
|
-
|
265
|
-
# Tells Nginx to serve static assets from this directory.
|
266
|
-
root /webapps/foo/public;
|
267
|
-
|
268
|
-
location / {
|
269
|
-
# Tells Nginx to forward all requests for www.foo.com
|
270
|
-
# to the Passenger Standalone instance listening on port 4000.
|
271
|
-
proxy_pass http://127.0.0.1:4000;
|
272
|
-
|
273
|
-
# These are "magic" Nginx configuration options that
|
274
|
-
# should be present in order to make the reverse proxying
|
275
|
-
# work properly. Also contains some options that make WebSockets
|
276
|
-
# work properly with Passenger Standalone. Please learn more at
|
277
|
-
# http://nginx.org/en/docs/http/ngx_http_proxy_module.html
|
278
|
-
proxy_http_version 1.1;
|
279
|
-
proxy_set_header Host $http_host;
|
280
|
-
proxy_set_header Upgrade $http_upgrade;
|
281
|
-
proxy_set_header Connection $connection_upgrade;
|
282
|
-
proxy_buffering off;
|
283
|
-
}
|
284
|
-
}
|
285
|
-
|
286
|
-
# We handle bar in a similar manner.
|
287
|
-
server {
|
288
|
-
listen 80;
|
289
|
-
server_name www.bar.com;
|
290
|
-
|
291
|
-
root /webapps/bar/public;
|
292
|
-
|
293
|
-
location / {
|
294
|
-
# bar is listening on port 4010 instead of 4000, we
|
295
|
-
# change the URL here.
|
296
|
-
proxy_pass http://127.0.0.1:4010;
|
297
|
-
|
298
|
-
proxy_http_version 1.1;
|
299
|
-
proxy_set_header Host $http_host;
|
300
|
-
proxy_set_header Upgrade $http_upgrade;
|
301
|
-
proxy_set_header Connection $connection_upgrade;
|
302
|
-
proxy_buffering off;
|
303
|
-
}
|
304
|
-
}
|
305
|
-
}
|
306
|
-
--------------------------
|
307
|
-
|
308
|
-
Once you're done editing the Nginx configuration file, restart Nginx:
|
309
|
-
|
310
|
-
|======================================================================
|
311
|
-
| Debian, Ubuntu | `sudo /etc/init.d/nginx restart`
|
312
|
-
| Red Hat, CentOS, ScientificLinux, Amazon Linux | `sudo service nginx restart`
|
313
|
-
| Mac OS X (Homebrew) | 1. Run `sudo kill $(cat /usr/local/var/run/nginx.pid)` +
|
314
|
-
2. You you installed the Nginx launchd plist that Homebrew provides (see `brew info nginx` to learn more), then you don't have to do anything, and launchd will automatically restart Nginx. Otherwise, you have to manually start Nginx again: `sudo /usr/local/bin/nginx`.
|
315
|
-
| Other operating systems | It depends on how you installed Nginx, but it's usually as follows:
|
316
|
-
|
317
|
-
1. Lookup the PID of the Nginx master process using `ps aux`. +
|
318
|
-
2. Run `sudo kill <PID>` +
|
319
|
-
3. Start Nginx again: `sudo $PREFIX/sbin/nginx`, where `$PREFIX` is the prefix you installed Nginx to.
|
320
|
-
|======================================================================
|
321
|
-
|
322
|
-
[float]
|
323
|
-
==== Step 3: testing
|
324
|
-
|
325
|
-
Nginx should now be listening on port 80, and should forward requests to foo and bar respectively. Let's test it out by accessing http://www.foo.com and http://www.bar.com. But first, we need to ensure that any requests to 'www.foo.com' and 'www.bar.com', that originate from the local machine, actually end up at the local host, and not at the IP address specified in the DNS records. To do this, edit `/etc/hosts` and add:
|
326
|
-
|
327
|
-
--------------------------------
|
328
|
-
127.0.0.1 www.foo.com www.bar.com
|
329
|
-
--------------------------------
|
330
|
-
|
331
|
-
Now visit http://www.foo.com and http://www.bar.com, and verify that it works.
|
332
|
-
|
333
|
-
[float]
|
334
|
-
==== Step 4: making all apps start at system boot
|
335
|
-
|
336
|
-
Once you restart the server, the reverse proxy/load balancer will no longer be able to serve 'www.foo.com' or 'www.bar.com' because the Passenger Standalone instances that host them are no longer running. You must therefore configure the system to start Passenger Standalone at system boot. Please refer to <<starting_at_system_boot,Starting Passenger Standalone at system boot>> for more information.
|
337
|
-
|
338
|
-
For example, you can put this in `/etc/rc.local` to make the system start foo and bar at system boot:
|
339
|
-
|
340
|
-
[source,sh]
|
341
|
-
-----------------------------------
|
342
|
-
# If you installed Phusion Passenger from tarball, add its `bin` directory to PATH.
|
343
|
-
#export PATH=/path-to-passenger/bin:$PATH
|
344
|
-
|
345
|
-
cd /webapps/foo
|
346
|
-
passenger start --daemonize --port 4000 --user someusername1
|
347
|
-
|
348
|
-
cd /webapps/bar
|
349
|
-
passenger start --daemonize --port 4010 --user someusername2
|
350
|
-
-----------------------------------
|
351
|
-
|
352
|
-
[float]
|
353
|
-
==== Step 5: wrapping up
|
354
|
-
|
355
|
-
Edit `/etc/hosts` and remove the entry that you added in step 3.
|
54
|
+
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/standalone/reverse_proxy.html
|
356
55
|
|
357
56
|
|
358
57
|
=== Installing Passenger Standalone behind Nginx
|
359
58
|
|
360
|
-
This
|
59
|
+
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/standalone/reverse_proxy.html
|
361
60
|
|
362
61
|
|
363
62
|
|
364
63
|
[[mass_deployment]]
|
365
64
|
== Mass deployment
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
Mass deployment is a special mode in Phusion Passenger Standalone that allows you to deploy multiple web applications without having to create configuration entries for each one of them. Given a directory with multiple web applications, Passenger Standalone will automatically give each web application its own virtual host entry, and serve all of them from a single server. The virtual host's server name is equal to the web application's directory name. Whenever a new web application is added or removed, Passenger Standalone automatically reconfigures itself without administrator intervention. This makes the mass deployment mode especially useful when there are a large number of web applications.
|
370
|
-
|
371
|
-
For example, suppose we have a directory `/webapps` with three web applications: Ruby app, a Python app and a Node.js app.
|
372
|
-
|
373
|
-
----------------------------
|
374
|
-
/webapps
|
375
|
-
|
|
376
|
-
+-- rubyapp.com
|
377
|
-
| |
|
378
|
-
| +-- config.ru
|
379
|
-
|
|
380
|
-
+-- pythonapp.com
|
381
|
-
| |
|
382
|
-
| +-- passenger_wsgi.py
|
383
|
-
|
|
384
|
-
+-- nodeapp.com
|
385
|
-
|
|
386
|
-
+-- app.js
|
387
|
-
----------------------------
|
388
|
-
|
389
|
-
You can activate Passenger Standalone in mass deployment mode by changing the working directory to `/webapps` and running `passenger start`:
|
390
|
-
|
391
|
-
----------------------------
|
392
|
-
$ cd /webapps
|
393
|
-
$ passenger start
|
394
|
-
=============== Phusion Passenger Standalone web server started ===============
|
395
|
-
PID file: /webapps/passenger.3000.pid
|
396
|
-
Log file: /webapps/passenger.3000.log
|
397
|
-
Environment: development
|
398
|
-
|
399
|
-
Serving these applications on 0.0.0.0 port 3000:
|
400
|
-
Host name Directory
|
401
|
-
.-----------------------------------------------------------
|
402
|
-
rubyapp.com /webapps/rubyapp.com
|
403
|
-
pythonapp.com /webapps/pythonapp.com
|
404
|
-
nodeapp.com /webapps/nodeapp.com
|
405
|
-
.-----------------------------------------------------------
|
406
|
-
----------------------------
|
407
|
-
|
408
|
-
If you for example remove `/webapps/rubyapp.com`, Passenger Standalone will reconfigure itself without that web application. Or if you add a new web applications `/webapps/newapp.org`, Passenger Standalone will reconfigure itself with that web application.
|
409
|
-
|
410
|
-
Any options that you pass to the `passenger` command will affect all deployed web applications. It is also possible to change options on a per-application basis through the use of <<config_file,a `Passengerfile.json` file inside each application's directory>>.
|
65
|
+
|
66
|
+
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/standalone/mass_deployment.html
|
411
67
|
|
412
68
|
|
413
69
|
[[troubleshooting]]
|
414
70
|
== Troubleshooting
|
415
71
|
|
416
|
-
|
72
|
+
This documentation has moved. Please visit https://www.phusionpassenger.com/library/admin/standalone/
|
417
73
|
|
418
74
|
== Under the hood
|
419
75
|
|