passenger 3.0.19 → 3.0.21
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.
- data.tar.gz.asc +12 -0
- data/NEWS +12 -0
- data/bin/passenger-install-nginx-module +3 -4
- data/doc/Architectural overview.html +90 -49
- data/doc/Security of user switching support.html +66 -35
- data/doc/Users guide Apache.html +506 -329
- data/doc/Users guide Apache.idmap.txt +55 -52
- data/doc/Users guide Nginx.html +380 -241
- data/doc/Users guide Nginx.idmap.txt +52 -52
- data/doc/Users guide Standalone.html +48 -24
- data/ext/common/Constants.h +1 -1
- data/ext/libev/configure +3545 -4964
- data/lib/phusion_passenger.rb +2 -2
- data/lib/phusion_passenger/abstract_request_handler.rb +7 -1
- data/lib/phusion_passenger/dependencies.rb +12 -20
- data/lib/phusion_passenger/platform_info.rb +17 -25
- data/lib/phusion_passenger/platform_info/apache.rb +1 -10
- data/lib/phusion_passenger/platform_info/ruby.rb +97 -37
- data/lib/phusion_passenger/rack/request_handler.rb +20 -1
- data/lib/phusion_passenger/standalone/command.rb +5 -4
- data/lib/phusion_passenger/standalone/runtime_installer.rb +4 -5
- metadata +69 -86
- metadata.gz.asc +12 -0
- data/test/stub/wsgi/passenger_wsgi.pyc +0 -0
@@ -18,36 +18,6 @@
|
|
18
18
|
|
19
19
|
1.2. Where to get support => where-to-get-support-f3pbrb
|
20
20
|
|
21
|
-
10. Appendix A: About this document => appendix-a-about-this-document-103toqs
|
22
|
-
|
23
|
-
11. Appendix B: Terminology => appendix-b-terminology-h4eaf4
|
24
|
-
|
25
|
-
11.1. Application root => application-root-otx6xf
|
26
|
-
|
27
|
-
11.2. Idle process => idle-process-potb6g
|
28
|
-
|
29
|
-
11.3. Inactive process => inactive-process-16gjv2e
|
30
|
-
|
31
|
-
12. Appendix C: Spawning methods explained => appendix-c-spawning-methods-explained-owghi9
|
32
|
-
|
33
|
-
12.1. The most straightforward and traditional way: conservative spawning => the-most-straightforward-and-traditional-way-conservative-spawning-1ybbli2
|
34
|
-
|
35
|
-
12.2. The smart spawning method => the-smart-spawning-method-1cvu9dd
|
36
|
-
|
37
|
-
12.2.1. How it works => how-it-works-672zja
|
38
|
-
|
39
|
-
12.2.2. Summary of benefits => summary-of-benefits-1yrihfb
|
40
|
-
|
41
|
-
12.3. Smart spawning gotcha #1: unintentional file descriptor sharing => smart-spawning-gotcha-1-unintentional-file-descriptor-sharing-z1y55l
|
42
|
-
|
43
|
-
12.3.1. Example 1: Memcached connection sharing (harmful) => example-1-memcached-connection-sharing-harmful--c71wqw
|
44
|
-
|
45
|
-
12.3.2. Example 2: Log file sharing (not harmful) => example-2-log-file-sharing-not-harmful--1p2yuol
|
46
|
-
|
47
|
-
12.4. Smart spawning gotcha #2: the need to revive threads => smart-spawning-gotcha-2-the-need-to-revive-threads-1k6cj7d
|
48
|
-
|
49
|
-
12.5. Smart spawning gotcha #3: code load order => smart-spawning-gotcha-3-code-load-order-nkotiy
|
50
|
-
|
51
21
|
2. Installing, upgrading and uninstalling Phusion Passenger => installing-upgrading-and-uninstalling-phusion-passenger-laryvs
|
52
22
|
|
53
23
|
2.1. Generic installation instructions => generic-installation-instructions-17jo43j
|
@@ -118,6 +88,22 @@
|
|
118
88
|
|
119
89
|
5.1. PassengerRoot <directory> => passengerroot-directory--sere8l
|
120
90
|
|
91
|
+
5.2. PassengerRuby <filename> => passengerruby-filename--1r3fv73
|
92
|
+
|
93
|
+
5.3. PassengerAppRoot <path/to/root> => passengerapproot-path-to-root--uf24yd
|
94
|
+
|
95
|
+
5.4. PassengerSpawnMethod <string> => passengerspawnmethod-string--sodg2y
|
96
|
+
|
97
|
+
5.5. PassengerUseGlobalQueue <on|off> => passengeruseglobalqueue-on-off--1ki369
|
98
|
+
|
99
|
+
5.6. PassengerEnabled <on|off> => passengerenabled-on-off--74rzth
|
100
|
+
|
101
|
+
5.7. PassengerTempDir <directory> => passengertempdir-directory--68h2ng
|
102
|
+
|
103
|
+
5.8. PassengerUploadBufferDir <directory> => passengeruploadbufferdir-directory--kdr8at
|
104
|
+
|
105
|
+
5.9. PassengerRestartDir <directory> => passengerrestartdir-directory--1fmhmv0
|
106
|
+
|
121
107
|
5.10. PassengerBufferResponse <on|off> => passengerbufferresponse-on-off--1y7ilka
|
122
108
|
|
123
109
|
5.11. PassengerRollingRestarts <on|off> => passengerrollingrestarts
|
@@ -142,10 +128,6 @@
|
|
142
128
|
|
143
129
|
5.14.1. PassengerMaxPoolSize <integer> => passengermaxpoolsize-integer--am64q8
|
144
130
|
|
145
|
-
5.14.10. PassengerPreStart <url> => passengerprestart-url--1dvgku9
|
146
|
-
|
147
|
-
5.14.11. PassengerHighPerformance <on|off> => passengerhighperformance-on-off--zgc547
|
148
|
-
|
149
131
|
5.14.2. PassengerMinInstances <integer> => passengermininstances-integer--wegq6b
|
150
132
|
|
151
133
|
5.14.3. PassengerMaxInstances <integer> => passengermaxinstances
|
@@ -162,6 +144,10 @@
|
|
162
144
|
|
163
145
|
5.14.9. PassengerStatThrottleRate <integer> => passengerstatthrottlerate
|
164
146
|
|
147
|
+
5.14.10. PassengerPreStart <url> => passengerprestart-url--1dvgku9
|
148
|
+
|
149
|
+
5.14.11. PassengerHighPerformance <on|off> => passengerhighperformance-on-off--zgc547
|
150
|
+
|
165
151
|
5.15. Compatibility options => compatibility-options-8jve5a
|
166
152
|
|
167
153
|
5.15.1. PassengerResolveSymlinksInDocumentRoot <on|off> => passengerresolvesymlinksindocumentroot-on-off--1r0qcp8
|
@@ -208,22 +194,6 @@
|
|
208
194
|
|
209
195
|
5.19.5. RailsSpawnMethod => railsspawnmethod-1aljgpa
|
210
196
|
|
211
|
-
5.2. PassengerRuby <filename> => passengerruby-filename--1r3fv73
|
212
|
-
|
213
|
-
5.3. PassengerAppRoot <path/to/root> => passengerapproot-path-to-root--uf24yd
|
214
|
-
|
215
|
-
5.4. PassengerSpawnMethod <string> => passengerspawnmethod-string--sodg2y
|
216
|
-
|
217
|
-
5.5. PassengerUseGlobalQueue <on|off> => passengeruseglobalqueue-on-off--1ki369
|
218
|
-
|
219
|
-
5.6. PassengerEnabled <on|off> => passengerenabled-on-off--74rzth
|
220
|
-
|
221
|
-
5.7. PassengerTempDir <directory> => passengertempdir-directory--68h2ng
|
222
|
-
|
223
|
-
5.8. PassengerUploadBufferDir <directory> => passengeruploadbufferdir-directory--kdr8at
|
224
|
-
|
225
|
-
5.9. PassengerRestartDir <directory> => passengerrestartdir-directory--1fmhmv0
|
226
|
-
|
227
197
|
6. Troubleshooting => troubleshooting-2ihihi
|
228
198
|
|
229
199
|
6.1. Operating system-specific problems => operating-system-specific-problems-327gbk
|
@@ -284,8 +254,6 @@
|
|
284
254
|
|
285
255
|
8.1. User switching (security) => user-switching-security--8njx1x
|
286
256
|
|
287
|
-
8.10. Upload progress => upload-progress-71cyl7
|
288
|
-
|
289
257
|
8.2. Reducing memory consumption of Ruby on Rails applications by 33% => reducing-memory-consumption-of-ruby-on-rails-applications-by-33--1ubxnq0
|
290
258
|
|
291
259
|
8.3. Capistrano recipe => capistrano-recipe-syzgo7
|
@@ -302,6 +270,8 @@
|
|
302
270
|
|
303
271
|
8.9. X-Sendfile support => x-sendfile-support-1cgyykw
|
304
272
|
|
273
|
+
8.10. Upload progress => upload-progress-71cyl7
|
274
|
+
|
305
275
|
9. Under the hood => under-the-hood-21ue5t
|
306
276
|
|
307
277
|
9.1. Static assets serving => static-assets-serving-wo2d9v
|
@@ -310,6 +280,39 @@
|
|
310
280
|
|
311
281
|
9.3. How Phusion Passenger detects whether a virtual host is a web application => how-phusion-passenger-detects-whether-a-virtual-host-is-a-web-application-179mp8m
|
312
282
|
|
283
|
+
10. Appendix A: About this document => appendix-a-about-this-document-103toqs
|
284
|
+
|
285
|
+
11. Appendix B: Terminology => appendix-b-terminology-h4eaf4
|
286
|
+
|
287
|
+
11.1. Application root => application-root-otx6xf
|
288
|
+
|
289
|
+
11.2. Idle process => idle-process-potb6g
|
290
|
+
|
291
|
+
11.3. Inactive process => inactive-process-16gjv2e
|
292
|
+
|
293
|
+
12. Appendix C: Spawning methods explained => appendix-c-spawning-methods-explained-owghi9
|
294
|
+
|
295
|
+
12.1. The most straightforward and traditional way: conservative spawning => the-most-straightforward-and-traditional-way-conservative-spawning-1ybbli2
|
296
|
+
|
297
|
+
12.2. The smart spawning method => the-smart-spawning-method-1cvu9dd
|
298
|
+
|
299
|
+
12.2.1. How it works => how-it-works-672zja
|
300
|
+
|
301
|
+
12.2.2. Summary of benefits => summary-of-benefits-1yrihfb
|
302
|
+
|
303
|
+
12.3. Smart spawning gotcha #1: unintentional file descriptor sharing => smart-spawning-gotcha-1-unintentional-file-descriptor-sharing-z1y55l
|
304
|
+
|
305
|
+
12.3.1. Example 1: Memcached connection sharing (harmful) => example-1-memcached-connection-sharing-harmful--c71wqw
|
306
|
+
|
307
|
+
12.3.2. Example 2: Log file sharing (not harmful) => example-2-log-file-sharing-not-harmful--1p2yuol
|
308
|
+
|
309
|
+
12.4. Smart spawning gotcha #2: the need to revive threads => smart-spawning-gotcha-2-the-need-to-revive-threads-1k6cj7d
|
310
|
+
|
311
|
+
12.5. Smart spawning gotcha #3: code load order => smart-spawning-gotcha-3-code-load-order-nkotiy
|
312
|
+
|
313
|
+
|
314
|
+
### These sections appear to have been removed. Please check.
|
315
|
+
|
313
316
|
Obtaining Phusion Passenger files through a tarball => obtaining-phusion-passenger-files-through-a-tarball-evcm0j
|
314
317
|
|
315
318
|
Obtaining Phusion Passenger files with RubyGems => obtaining-phusion-passenger-files-with-rubygems-8fz7a8
|
data/doc/Users guide Nginx.html
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
|
-
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
5
|
-
<meta name="generator" content="AsciiDoc 8.6.7">
|
6
|
-
<title>Phusion Passenger users guide, Nginx version</title>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
5
|
+
<meta name="generator" content="AsciiDoc 8.6.7">
|
6
|
+
<title>Phusion Passenger users guide, Nginx version</title>
|
7
7
|
<style type="text/css">
|
8
8
|
/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
|
9
9
|
|
@@ -603,7 +603,7 @@ div.exampleblock > div.content, div.sidebarblock > div.content, div.listingblock
|
|
603
603
|
div.verseblock { border-left-width: 0; margin-left: 3em; }
|
604
604
|
div.quoteblock { border-left-width: 3px; margin-left: 0; margin-right: 0;}
|
605
605
|
div.admonitionblock td.content { border-left: 3px solid #E8E8E8; }
|
606
|
-
</style>
|
606
|
+
</style>
|
607
607
|
<script type="text/javascript">
|
608
608
|
/*<![CDATA[*/
|
609
609
|
var asciidoc = { // Namespace.
|
@@ -795,11 +795,14 @@ install: function(toclevels) {
|
|
795
795
|
}
|
796
796
|
|
797
797
|
}
|
798
|
-
asciidoc.install(
|
798
|
+
asciidoc.install();
|
799
799
|
/*]]>*/
|
800
|
-
</script
|
800
|
+
</script>
|
801
|
+
<style type="text/css">
|
801
802
|
body {
|
802
|
-
margin: 1em
|
803
|
+
margin: 1em auto 1em auto;
|
804
|
+
padding: 0 1em 0 1em;
|
805
|
+
max-width: 800px;
|
803
806
|
}
|
804
807
|
|
805
808
|
a.image {
|
@@ -878,6 +881,10 @@ a.image {
|
|
878
881
|
margin: 2em;
|
879
882
|
}
|
880
883
|
|
884
|
+
pre {
|
885
|
+
overflow: auto;
|
886
|
+
}
|
887
|
+
|
881
888
|
@media print {
|
882
889
|
body {
|
883
890
|
font-size: 18pt;
|
@@ -1038,29 +1045,40 @@ a.image {
|
|
1038
1045
|
border-bottom-right-radius: 0;
|
1039
1046
|
}
|
1040
1047
|
|
1048
|
+
/* http://nicolasgallagher.com/jump-links-and-viewport-positioning/ */
|
1049
|
+
.anchor_helper {
|
1050
|
+
position: relative;
|
1051
|
+
display: block;
|
1052
|
+
top: -50px;
|
1053
|
+
width: 1px;
|
1054
|
+
height: 1px;
|
1055
|
+
}
|
1056
|
+
|
1041
1057
|
</style>
|
1042
|
-
</head>
|
1058
|
+
</head>
|
1043
1059
|
<body class="article">
|
1044
1060
|
<div id="topbar" style="display: none">
|
1045
1061
|
<div class="title">
|
1046
|
-
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAKCAYAAAEV95QVAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sGCRMSACDxkZwAAAAidEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVAgb24gYSBNYWOHqHdDAAAAZUlEQVQY032PSxbAIAjEIlfygL6ePF3UUvpzNjgSYWwqAMEhUQnANnsC7TQPeJpsVWzMuh2sog4vDTUbqP081zECrW4dtdaQGSIKlWluPyjK+VXxAz5XfcKufCzA130AfQHWB30HZxlPaP080xsAAAAASUVORK5CYII=" width="11" height="10" alt=""
|
1062
|
+
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAKCAYAAAEV95QVAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sGCRMSACDxkZwAAAAidEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVAgb24gYSBNYWOHqHdDAAAAZUlEQVQY032PSxbAIAjEIlfygL6ePF3UUvpzNjgSYWwqAMEhUQnANnsC7TQPeJpsVWzMuh2sog4vDTUbqP081zECrW4dtdaQGSIKlWluPyjK+VXxAz5XfcKufCzA130AfQHWB30HZxlPaP080xsAAAAASUVORK5CYII=" width="11" height="10" alt="">
|
1063
|
+
<a href="javascript:void(Mizuho.smoothlyScrollToToc())">Phusion Passenger users guide, Nginx version</a>
|
1047
1064
|
</div>
|
1048
1065
|
<a href="javascript:void(0)" id="current_section"></a>
|
1049
1066
|
</div>
|
1050
1067
|
<div id="header">
|
1051
|
-
<h1>Phusion Passenger users guide, Nginx version</h1>
|
1068
|
+
<h1>Phusion Passenger users guide, Nginx version</h1>
|
1052
1069
|
<div id="preamble">
|
1053
1070
|
<div class="sectionbody">
|
1054
1071
|
<div class="paragraph"><p><span class="image">
|
1055
1072
|
<a class="image" href="http://www.phusion.nl/">
|
1056
|
-
<img src="images/phusion_banner.png" alt="images/phusion_banner.png"
|
1073
|
+
<img src="images/phusion_banner.png" alt="images/phusion_banner.png">
|
1074
|
+
</a>
|
1057
1075
|
</span></p></div>
|
1058
1076
|
<div class="paragraph"><p>Phusion Passenger is an Nginx module, which makes deploying Ruby and Ruby on
|
1059
1077
|
Rails applications on Nginx a breeze. It follows the usual Ruby on Rails
|
1060
1078
|
conventions, such as "Don’t-Repeat-Yourself" and ease of setup, while at the
|
1061
1079
|
same time providing enough flexibility.</p></div>
|
1062
1080
|
<div class="paragraph"><p>This users guide will teach you:</p></div>
|
1063
|
-
<div class="ulist"><ul>
|
1081
|
+
<div class="ulist"><ul>
|
1064
1082
|
<li>
|
1065
1083
|
<p>
|
1066
1084
|
How to install Nginx with Phusion Passenger support.
|
@@ -1090,19 +1108,129 @@ How to solve common problems.
|
|
1090
1108
|
<div class="paragraph"><p>This guide assumes that the reader is somewhat familiar with Nginx and with
|
1091
1109
|
using the commandline.</p></div>
|
1092
1110
|
</div>
|
1093
|
-
</div>
|
1111
|
+
</div>
|
1094
1112
|
<div id="toc">
|
1095
|
-
|
1096
|
-
|
1097
|
-
</div>
|
1113
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><div id="toctitle">Table of Contents</div>
|
1114
|
+
<div class="foo toclevel2"><a href="#_support_information">1. Support information</a></div>
|
1115
|
+
<div class="foo toclevel3"><a href="#_supported_operating_systems">1.1. Supported operating systems</a></div>
|
1116
|
+
<div class="foo toclevel3"><a href="#_where_to_get_support">1.2. Where to get support</a></div>
|
1117
|
+
<div class="foo toclevel2"><a href="#_installing_phusion_passenger">2. Installing Phusion Passenger</a></div>
|
1118
|
+
<div class="foo toclevel3"><a href="#_overview">2.1. Overview</a></div>
|
1119
|
+
<div class="foo toclevel3"><a href="#specifying_ruby_installation">2.2. Specifying the correct Ruby installation</a></div>
|
1120
|
+
<div class="foo toclevel3"><a href="#_installing_phusion_passenger_for_nginx_through_the_installer">2.3. Installing Phusion Passenger for Nginx through the installer</a></div>
|
1121
|
+
<div class="foo toclevel4"><a href="#_obtaining_the_phusion_passenger_files_and_running_the_installer">2.3.1. Obtaining the Phusion Passenger files and running the installer</a></div>
|
1122
|
+
<div class="foo toclevel4"><a href="#_non_interactive_automatic_installation">2.3.2. Non-interactive/automatic installation</a></div>
|
1123
|
+
<div class="foo toclevel3"><a href="#_installing_phusion_passenger_for_nginx_manually">2.4. Installing Phusion Passenger for Nginx manually</a></div>
|
1124
|
+
<div class="foo toclevel3"><a href="#_upgrading_or_downgrading_phusion_passenger_or_nginx_itself">2.5. Upgrading or downgrading Phusion Passenger or Nginx itself</a></div>
|
1125
|
+
<div class="foo toclevel3"><a href="#_unloading_disabling_phusion_passenger_from_nginx_without_uninstalling_it">2.6. Unloading (disabling) Phusion Passenger from Nginx without uninstalling it</a></div>
|
1126
|
+
<div class="foo toclevel3"><a href="#_uninstalling_phusion_passenger">2.7. Uninstalling Phusion Passenger</a></div>
|
1127
|
+
<div class="foo toclevel2"><a href="#deploying_a_ror_app">3. Deploying a Ruby on Rails 1.x or 2.x (but NOT Rails >= 3) application</a></div>
|
1128
|
+
<div class="foo toclevel3"><a href="#_deploying_to_a_virtual_host_8217_s_root">3.1. Deploying to a virtual host’s root</a></div>
|
1129
|
+
<div class="foo toclevel3"><a href="#deploying_rails_to_sub_uri">3.2. Deploying to a sub URI</a></div>
|
1130
|
+
<div class="foo toclevel3"><a href="#_redeploying_restarting_the_ruby_on_rails_application">3.3. Redeploying (restarting the Ruby on Rails application)</a></div>
|
1131
|
+
<div class="foo toclevel3"><a href="#_migrations">3.4. Migrations</a></div>
|
1132
|
+
<div class="foo toclevel3"><a href="#_capistrano_integration">3.5. Capistrano integration</a></div>
|
1133
|
+
<div class="foo toclevel2"><a href="#deploying_a_rack_app">4. Deploying a Rack-based Ruby application (including Rails >= 3)</a></div>
|
1134
|
+
<div class="foo toclevel3"><a href="#_tutorial_example_writing_and_deploying_a_hello_world_rack_application">4.1. Tutorial/example: writing and deploying a Hello World Rack application</a></div>
|
1135
|
+
<div class="foo toclevel3"><a href="#_deploying_to_a_virtual_host_8217_s_root_2">4.2. Deploying to a virtual host’s root</a></div>
|
1136
|
+
<div class="foo toclevel3"><a href="#deploying_rack_to_sub_uri">4.3. Deploying to a sub URI</a></div>
|
1137
|
+
<div class="foo toclevel3"><a href="#_redeploying_restarting_the_rack_application">4.4. Redeploying (restarting the Rack application)</a></div>
|
1138
|
+
<div class="foo toclevel3"><a href="#_rackup_specifications_for_various_web_frameworks">4.5. Rackup specifications for various web frameworks</a></div>
|
1139
|
+
<div class="foo toclevel4"><a href="#_camping">4.5.1. Camping</a></div>
|
1140
|
+
<div class="foo toclevel4"><a href="#_halcyon">4.5.2. Halcyon</a></div>
|
1141
|
+
<div class="foo toclevel4"><a href="#_mack">4.5.3. Mack</a></div>
|
1142
|
+
<div class="foo toclevel4"><a href="#_merb">4.5.4. Merb</a></div>
|
1143
|
+
<div class="foo toclevel4"><a href="#_ramaze">4.5.5. Ramaze</a></div>
|
1144
|
+
<div class="foo toclevel4"><a href="#_sinatra">4.5.6. Sinatra</a></div>
|
1145
|
+
<div class="foo toclevel2"><a href="#_configuring_phusion_passenger">5. Configuring Phusion Passenger</a></div>
|
1146
|
+
<div class="foo toclevel3"><a href="#_passenger_root_lt_directory_gt">5.1. passenger_root <directory></a></div>
|
1147
|
+
<div class="foo toclevel3"><a href="#_passenger_ruby_lt_filename_gt">5.2. passenger_ruby <filename></a></div>
|
1148
|
+
<div class="foo toclevel3"><a href="#PassengerSpawnMethod">5.3. passenger_spawn_method <string></a></div>
|
1149
|
+
<div class="foo toclevel3"><a href="#PassengerRollingRestarts">5.4. passenger_rolling_restarts <on|off></a></div>
|
1150
|
+
<div class="foo toclevel3"><a href="#_passenger_resist_deployment_errors_lt_on_off_gt">5.5. passenger_resist_deployment_errors <on|off></a></div>
|
1151
|
+
<div class="foo toclevel3"><a href="#_important_deployment_options">5.6. Important deployment options</a></div>
|
1152
|
+
<div class="foo toclevel4"><a href="#_passenger_enabled_lt_on_off_gt">5.6.1. passenger_enabled <on|off></a></div>
|
1153
|
+
<div class="foo toclevel4"><a href="#PassengerBaseURI">5.6.2. passenger_base_uri <uri></a></div>
|
1154
|
+
<div class="foo toclevel3"><a href="#_connection_handling_options">5.7. Connection handling options</a></div>
|
1155
|
+
<div class="foo toclevel4"><a href="#PassengerUseGlobalQueue">5.7.1. passenger_use_global_queue <on|off></a></div>
|
1156
|
+
<div class="foo toclevel4"><a href="#_passenger_ignore_client_abort_lt_on_off_gt">5.7.2. passenger_ignore_client_abort <on|off></a></div>
|
1157
|
+
<div class="foo toclevel4"><a href="#_passenger_set_cgi_param_lt_cgi_environment_name_gt_lt_value_gt">5.7.3. passenger_set_cgi_param <CGI environment name> <value></a></div>
|
1158
|
+
<div class="foo toclevel4"><a href="#_passenger_pass_header_lt_header_name_gt">5.7.4. passenger_pass_header <header name></a></div>
|
1159
|
+
<div class="foo toclevel4"><a href="#_passenger_buffer_response_lt_on_off_gt">5.7.5. passenger_buffer_response <on|off></a></div>
|
1160
|
+
<div class="foo toclevel4"><a href="#_passenger_buffer_size">5.7.6. passenger_buffer_size</a></div>
|
1161
|
+
<div class="foo toclevel4"><a href="#_passenger_buffers">5.7.7. passenger_buffers</a></div>
|
1162
|
+
<div class="foo toclevel4"><a href="#_passenger_busy_buffer_size">5.7.8. passenger_busy_buffer_size</a></div>
|
1163
|
+
<div class="foo toclevel3"><a href="#_security_options">5.8. Security options</a></div>
|
1164
|
+
<div class="foo toclevel4"><a href="#PassengerUserSwitching">5.8.1. passenger_user_switching <on|off></a></div>
|
1165
|
+
<div class="foo toclevel4"><a href="#_passenger_user_lt_username_gt">5.8.2. passenger_user <username></a></div>
|
1166
|
+
<div class="foo toclevel4"><a href="#_passenger_group_lt_group_name_gt">5.8.3. passenger_group <group name></a></div>
|
1167
|
+
<div class="foo toclevel4"><a href="#PassengerDefaultUser">5.8.4. passenger_default_user <username></a></div>
|
1168
|
+
<div class="foo toclevel4"><a href="#PassengerDefaultGroup">5.8.5. Passenger_default_group <group name></a></div>
|
1169
|
+
<div class="foo toclevel4"><a href="#_passenger_friendly_error_pages_lt_on_off_gt">5.8.6. passenger_friendly_error_pages <on|off></a></div>
|
1170
|
+
<div class="foo toclevel3"><a href="#_resource_control_and_optimization_options">5.9. Resource control and optimization options</a></div>
|
1171
|
+
<div class="foo toclevel4"><a href="#PassengerMaxPoolSize">5.9.1. passenger_max_pool_size <integer></a></div>
|
1172
|
+
<div class="foo toclevel4"><a href="#PassengerMinInstances">5.9.2. passenger_min_instances <integer></a></div>
|
1173
|
+
<div class="foo toclevel4"><a href="#_passenger_max_instances_lt_integer_gt">5.9.3. passenger_max_instances <integer></a></div>
|
1174
|
+
<div class="foo toclevel4"><a href="#_passenger_max_instances_per_app_lt_integer_gt">5.9.4. passenger_max_instances_per_app <integer></a></div>
|
1175
|
+
<div class="foo toclevel4"><a href="#PassengerPoolIdleTime">5.9.5. passenger_pool_idle_time <integer></a></div>
|
1176
|
+
<div class="foo toclevel4"><a href="#PassengerMaxRequests">5.9.6. passenger_max_requests <integer></a></div>
|
1177
|
+
<div class="foo toclevel4"><a href="#PassengerMaxRequestTime">5.9.7. passenger_max_request_time <seconds></a></div>
|
1178
|
+
<div class="foo toclevel4"><a href="#PassengerMemoryLimit">5.9.8. passenger_memory_limit <integer></a></div>
|
1179
|
+
<div class="foo toclevel4"><a href="#PassengerPreStart">5.9.9. passenger_pre_start <url></a></div>
|
1180
|
+
<div class="foo toclevel3"><a href="#_logging_and_debugging_options">5.10. Logging and debugging options</a></div>
|
1181
|
+
<div class="foo toclevel4"><a href="#_passenger_log_level_lt_integer_gt">5.10.1. passenger_log_level <integer></a></div>
|
1182
|
+
<div class="foo toclevel4"><a href="#_passenger_debug_log_file_lt_filename_gt">5.10.2. passenger_debug_log_file <filename></a></div>
|
1183
|
+
<div class="foo toclevel4"><a href="#_passenger_debugger_lt_on_off_gt">5.10.3. passenger_debugger <on|off></a></div>
|
1184
|
+
<div class="foo toclevel3"><a href="#_ruby_on_rails_specific_options">5.11. Ruby on Rails-specific options</a></div>
|
1185
|
+
<div class="foo toclevel4"><a href="#RailsEnv">5.11.1. rails_env <string></a></div>
|
1186
|
+
<div class="foo toclevel4"><a href="#_rails_framework_spawner_idle_time_lt_integer_gt">5.11.2. rails_framework_spawner_idle_time <integer></a></div>
|
1187
|
+
<div class="foo toclevel4"><a href="#_rails_app_spawner_idle_time_lt_integer_gt">5.11.3. rails_app_spawner_idle_time <integer></a></div>
|
1188
|
+
<div class="foo toclevel3"><a href="#_rack_and_rails_gt_3_specific_options">5.12. Rack and Rails >= 3 specific options</a></div>
|
1189
|
+
<div class="foo toclevel4"><a href="#RackEnv">5.12.1. rack_env <string></a></div>
|
1190
|
+
<div class="foo toclevel3"><a href="#_deprecated_options">5.13. Deprecated options</a></div>
|
1191
|
+
<div class="foo toclevel4"><a href="#_rails_spawn_method">5.13.1. rails_spawn_method</a></div>
|
1192
|
+
<div class="foo toclevel2"><a href="#_analysis_and_system_maintenance">6. Analysis and system maintenance</a></div>
|
1193
|
+
<div class="foo toclevel3"><a href="#_inspecting_memory_usage">6.1. Inspecting memory usage</a></div>
|
1194
|
+
<div class="foo toclevel3"><a href="#_inspecting_phusion_passenger_8217_s_internal_status">6.2. Inspecting Phusion Passenger’s internal status</a></div>
|
1195
|
+
<div class="foo toclevel3"><a href="#debugging_frozen">6.3. Debugging frozen applications</a></div>
|
1196
|
+
<div class="foo toclevel3"><a href="#_accessing_individual_application_processes">6.4. Accessing individual application processes</a></div>
|
1197
|
+
<div class="foo toclevel3"><a href="#_attaching_an_irb_console_to_an_application_process">6.5. Attaching an IRB console to an application process</a></div>
|
1198
|
+
<div class="foo toclevel2"><a href="#_tips">7. Tips</a></div>
|
1199
|
+
<div class="foo toclevel3"><a href="#user_switching">7.1. User switching (security)</a></div>
|
1200
|
+
<div class="foo toclevel3"><a href="#reducing_memory_usage">7.2. Reducing memory consumption of Ruby on Rails applications by 33%</a></div>
|
1201
|
+
<div class="foo toclevel3"><a href="#capistrano">7.3. Capistrano recipe</a></div>
|
1202
|
+
<div class="foo toclevel3"><a href="#bundler_support">7.4. Bundler support</a></div>
|
1203
|
+
<div class="foo toclevel3"><a href="#moving_phusion_passenger">7.5. Moving Phusion Passenger to a different directory</a></div>
|
1204
|
+
<div class="foo toclevel3"><a href="#_installing_multiple_ruby_on_rails_versions">7.6. Installing multiple Ruby on Rails versions</a></div>
|
1205
|
+
<div class="foo toclevel3"><a href="#_making_the_application_restart_after_each_request">7.7. Making the application restart after each request</a></div>
|
1206
|
+
<div class="foo toclevel3"><a href="#sub_uri_deployment_uri_fix">7.8. How to fix broken images/CSS/JavaScript URIs in sub-URI deployments</a></div>
|
1207
|
+
<div class="foo toclevel2"><a href="#_under_the_hood">8. Under the hood</a></div>
|
1208
|
+
<div class="foo toclevel3"><a href="#_page_caching_support">8.1. Page caching support</a></div>
|
1209
|
+
<div class="foo toclevel3"><a href="#application_detection">8.2. How Phusion Passenger detects whether a virtual host is a web application</a></div>
|
1210
|
+
<div class="foo toclevel2"><a href="#_appendix_a_about_this_document">9. Appendix A: About this document</a></div>
|
1211
|
+
<div class="foo toclevel2"><a href="#_appendix_b_terminology">10. Appendix B: Terminology</a></div>
|
1212
|
+
<div class="foo toclevel3"><a href="#application_root">10.1. Application root</a></div>
|
1213
|
+
<div class="foo toclevel3"><a href="#idle_process">10.2. Idle process</a></div>
|
1214
|
+
<div class="foo toclevel3"><a href="#inactive_process">10.3. Inactive process</a></div>
|
1215
|
+
<div class="foo toclevel2"><a href="#spawning_methods_explained">11. Appendix C: Spawning methods explained</a></div>
|
1216
|
+
<div class="foo toclevel3"><a href="#_the_most_straightforward_and_traditional_way_conservative_spawning">11.1. The most straightforward and traditional way: conservative spawning</a></div>
|
1217
|
+
<div class="foo toclevel3"><a href="#_the_smart_spawning_method">11.2. The smart spawning method</a></div>
|
1218
|
+
<div class="foo toclevel4"><a href="#_how_it_works">11.2.1. How it works</a></div>
|
1219
|
+
<div class="foo toclevel4"><a href="#_summary_of_benefits">11.2.2. Summary of benefits</a></div>
|
1220
|
+
<div class="foo toclevel3"><a href="#_smart_spawning_gotcha_1_unintentional_file_descriptor_sharing">11.3. Smart spawning gotcha #1: unintentional file descriptor sharing</a></div>
|
1221
|
+
<div class="foo toclevel4"><a href="#_example_1_memcached_connection_sharing_harmful">11.3.1. Example 1: Memcached connection sharing (harmful)</a></div>
|
1222
|
+
<div class="foo toclevel4"><a href="#_example_2_log_file_sharing_not_harmful">11.3.2. Example 2: Log file sharing (not harmful)</a></div>
|
1223
|
+
<div class="foo toclevel3"><a href="#_smart_spawning_gotcha_2_the_need_to_revive_threads">11.4. Smart spawning gotcha #2: the need to revive threads</a></div>
|
1224
|
+
<div class="foo toclevel3"><a href="#_smart_spawning_gotcha_3_code_load_order">11.5. Smart spawning gotcha #3: code load order</a></div>
|
1225
|
+
</div>
|
1098
1226
|
</div>
|
1099
1227
|
<div id="content">
|
1100
1228
|
|
1101
1229
|
<div class="sect1">
|
1102
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1230
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_support_information"></span><h2 data-comment-topic="support-information-nl5gdn" data-anchor="_support_information">1. Support information</h2>
|
1103
1231
|
<div class="sectionbody">
|
1104
1232
|
<div class="sect2">
|
1105
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1233
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_supported_operating_systems"></span><h3 data-comment-topic="supported-operating-systems-a5n2x4" data-anchor="_supported_operating_systems">1.1. Supported operating systems</h3>
|
1106
1234
|
<div class="paragraph"><p>Phusion Passenger works on any POSIX-compliant operating system. In other
|
1107
1235
|
words: practically any operating system on earth, except Microsoft Windows.</p></div>
|
1108
1236
|
<div class="paragraph"><p>Phusion Passenger is confirmed on a large number of operating systems and Linux
|
@@ -1115,8 +1243,8 @@ or
|
|
1115
1243
|
if it doesn’t work on your POSIX-compliant operating system.</p></div>
|
1116
1244
|
</div>
|
1117
1245
|
<div class="sect2">
|
1118
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1119
|
-
<div class="ulist"><ul>
|
1246
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_where_to_get_support"></span><h3 data-comment-topic="where-to-get-support-2s9na5" data-anchor="_where_to_get_support">1.2. Where to get support</h3>
|
1247
|
+
<div class="ulist"><ul>
|
1120
1248
|
<li>
|
1121
1249
|
<p>
|
1122
1250
|
<a href="http://code.google.com/p/phusion-passenger/issues/list">Issue tracker</a> - report
|
@@ -1134,15 +1262,15 @@ if it doesn’t work on your POSIX-compliant operating system.</p></div>
|
|
1134
1262
|
</div>
|
1135
1263
|
</div>
|
1136
1264
|
<div class="sect1">
|
1137
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1265
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_installing_phusion_passenger"></span><h2 data-comment-topic="installing-phusion-passenger-hn03ac" data-anchor="_installing_phusion_passenger">2. Installing Phusion Passenger</h2>
|
1138
1266
|
<div class="sectionbody">
|
1139
1267
|
<div class="sect2">
|
1140
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1268
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_overview"></span><h3 data-comment-topic="overview-kvhzi4" data-anchor="_overview">2.1. Overview</h3>
|
1141
1269
|
<div class="paragraph"><p>As you might already know, Nginx does not support loadable modules, in contrast
|
1142
1270
|
to most other web servers (e.g. Apache). Therefore, to install Phusion Passenger
|
1143
1271
|
for Nginx, one must recompile and reinstall Nginx with Phusion Passenger support.
|
1144
1272
|
There are two ways to do this:</p></div>
|
1145
|
-
<div class="olist arabic"><ol class="arabic">
|
1273
|
+
<div class="olist arabic"><ol class="arabic">
|
1146
1274
|
<li>
|
1147
1275
|
<p>
|
1148
1276
|
By running the Phusion Passenger installer for Nginx. This installer will
|
@@ -1162,18 +1290,18 @@ By manually configuring and compiling Nginx with Phusion Passenger support,
|
|
1162
1290
|
</li>
|
1163
1291
|
</ol></div>
|
1164
1292
|
<div class="admonitionblock">
|
1165
|
-
<table><tr>
|
1293
|
+
<table><tr>
|
1166
1294
|
<td class="icon">
|
1167
|
-
<img src="./images/icons/tip.png" alt="Tip">
|
1295
|
+
<img src="./images/icons/tip.png" alt="Tip">
|
1168
1296
|
</td>
|
1169
1297
|
<td class="content">You might have to run the installation commands in the following sections
|
1170
1298
|
as <em>root</em>. If the installer fails because of permission errors, it will tell
|
1171
1299
|
you.</td>
|
1172
|
-
</tr></table>
|
1300
|
+
</tr></table>
|
1173
1301
|
</div>
|
1174
1302
|
</div>
|
1175
1303
|
<div class="sect2">
|
1176
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1304
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="specifying_ruby_installation"></span><h3 data-comment-topic="specifying-the-correct-ruby-installation-jvqdv6" data-anchor="specifying_ruby_installation">2.2. Specifying the correct Ruby installation</h3>
|
1177
1305
|
<div class="paragraph"><p>If your system has multiple Ruby installations — which is likely the case on
|
1178
1306
|
MacOS X, or if you’ve also installed
|
1179
1307
|
<a href="http://www.rubyenterpriseedition.com">Ruby Enterprise Edition</a> — then you
|
@@ -1184,7 +1312,7 @@ Passenger will automatically detect it.</p></div>
|
|
1184
1312
|
<div class="paragraph"><p>To specify a Ruby installation, prepend your Ruby installation’s <span class="monospaced">bin</span>
|
1185
1313
|
directory to the <span class="monospaced">PATH</span> environment variable. For example, if you have the
|
1186
1314
|
following Ruby installations:</p></div>
|
1187
|
-
<div class="ulist"><ul>
|
1315
|
+
<div class="ulist"><ul>
|
1188
1316
|
<li>
|
1189
1317
|
<p>
|
1190
1318
|
/usr/bin/ruby
|
@@ -1204,9 +1332,9 @@ following Ruby installations:</p></div>
|
|
1204
1332
|
</div>
|
1205
1333
|
</div>
|
1206
1334
|
<div class="sect2">
|
1207
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1335
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_installing_phusion_passenger_for_nginx_through_the_installer"></span><h3 data-comment-topic="installing-phusion-passenger-for-nginx-through-the-installer-1lqxes1" data-anchor="_installing_phusion_passenger_for_nginx_through_the_installer">2.3. Installing Phusion Passenger for Nginx through the installer</h3>
|
1208
1336
|
<div class="sect3">
|
1209
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1337
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_obtaining_the_phusion_passenger_files_and_running_the_installer"></span><h4 data-comment-topic="obtaining-the-phusion-passenger-files-and-running-the-installer-6l6ula" data-anchor="_obtaining_the_phusion_passenger_files_and_running_the_installer">2.3.1. Obtaining the Phusion Passenger files and running the installer</h4>
|
1210
1338
|
<div class="paragraph"><p>You must obtain the Phusion Passenger files in order to run the installer.
|
1211
1339
|
This can be done either by installing the Phusion Passenger gem, or by
|
1212
1340
|
downloading the source tarball.</p></div>
|
@@ -1247,18 +1375,18 @@ tar xzvf ~/YourDownloadsFolder/passenger-x.x.x.tar.gz</pre>
|
|
1247
1375
|
</div>
|
1248
1376
|
<div class="paragraph"><p>Please follow the instructions given by the installer.</p></div>
|
1249
1377
|
<div class="admonitionblock">
|
1250
|
-
<table><tr>
|
1378
|
+
<table><tr>
|
1251
1379
|
<td class="icon">
|
1252
|
-
<img src="./images/icons/important.png" alt="Important">
|
1380
|
+
<img src="./images/icons/important.png" alt="Important">
|
1253
1381
|
</td>
|
1254
1382
|
<td class="content">Please do not remove the passenger-x.x.x folder after installation.
|
1255
1383
|
Furthermore, the passenger-x.x.x folder must be accessible by Nginx.</td>
|
1256
|
-
</tr></table>
|
1384
|
+
</tr></table>
|
1257
1385
|
</div>
|
1258
1386
|
</div>
|
1259
1387
|
</div>
|
1260
1388
|
<div class="sect3">
|
1261
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1389
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_non_interactive_automatic_installation"></span><h4 data-comment-topic="non-interactive-automatic-installation-1u97717" data-anchor="_non_interactive_automatic_installation">2.3.2. Non-interactive/automatic installation</h4>
|
1262
1390
|
<div class="paragraph"><p>By default, the installer is interactive. If you want to automate installation,
|
1263
1391
|
then you can do so by passing various answers to the installer through command
|
1264
1392
|
line options.</p></div>
|
@@ -1267,7 +1395,7 @@ options.</p></div>
|
|
1267
1395
|
</div>
|
1268
1396
|
</div>
|
1269
1397
|
<div class="sect2">
|
1270
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1398
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_installing_phusion_passenger_for_nginx_manually"></span><h3 data-comment-topic="installing-phusion-passenger-for-nginx-manually-1qg1e2x" data-anchor="_installing_phusion_passenger_for_nginx_manually">2.4. Installing Phusion Passenger for Nginx manually</h3>
|
1271
1399
|
<div class="paragraph"><p>You can also install Phusion Passenger the way you install any other Nginx module.
|
1272
1400
|
To do this, run Nginx’s configure script with <span class="monospaced">--add-module=/path-to-passenger-root/ext/nginx</span>.</p></div>
|
1273
1401
|
<div class="paragraph"><p>If you installed Phusion Passenger via the gem, then <em>path-to-passenger-root</em>
|
@@ -1293,7 +1421,7 @@ line into your Nginx configuration file:</p></div>
|
|
1293
1421
|
<div class="paragraph"><p>After having done so, restart Nginx.</p></div>
|
1294
1422
|
</div>
|
1295
1423
|
<div class="sect2">
|
1296
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1424
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_upgrading_or_downgrading_phusion_passenger_or_nginx_itself"></span><h3 data-comment-topic="upgrading-or-downgrading-phusion-passenger-or-nginx-itself-8dulxz" data-anchor="_upgrading_or_downgrading_phusion_passenger_or_nginx_itself">2.5. Upgrading or downgrading Phusion Passenger or Nginx itself</h3>
|
1297
1425
|
<div class="paragraph"><p>Whether you’re upgrading/downgrading Phusion Passenger or Nginx itself (or perhaps both),
|
1298
1426
|
Nginx will have to be recompiled and reinstalled. The procedure is exactly the same as
|
1299
1427
|
a normal installation so just follow the instructions in section 2.3 or 2.4.</p></div>
|
@@ -1313,7 +1441,7 @@ removed, otherwise Phusion Passenger may malfunction.</p></div>
|
|
1313
1441
|
<div class="paragraph"><p>When you’re done, restart Nginx.</p></div>
|
1314
1442
|
</div>
|
1315
1443
|
<div class="sect2">
|
1316
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1444
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_unloading_disabling_phusion_passenger_from_nginx_without_uninstalling_it"></span><h3 data-comment-topic="unloading-disabling-phusion-passenger-from-nginx-without-uninstalling-it-v447e0" data-anchor="_unloading_disabling_phusion_passenger_from_nginx_without_uninstalling_it">2.6. Unloading (disabling) Phusion Passenger from Nginx without uninstalling it</h3>
|
1317
1445
|
<div class="paragraph"><p>You can temporarily unload (disable) Phusion Passenger from Nginx, without
|
1318
1446
|
uninstalling the Phusion Passenger files, so that Nginx behaves as if Phusion
|
1319
1447
|
Passenger was never installed in the first place. This might be useful to you if,
|
@@ -1371,11 +1499,11 @@ http {
|
|
1371
1499
|
<div class="paragraph"><p>After you’ve done this, save the file and restart Nginx.</p></div>
|
1372
1500
|
</div>
|
1373
1501
|
<div class="sect2">
|
1374
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1502
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_uninstalling_phusion_passenger"></span><h3 data-comment-topic="uninstalling-phusion-passenger-wuycvb" data-anchor="_uninstalling_phusion_passenger">2.7. Uninstalling Phusion Passenger</h3>
|
1375
1503
|
<div class="paragraph"><p>To uninstall Phusion Passenger, please first remove all Phusion Passenger
|
1376
1504
|
configuration directives from your Nginx configuration file(s). After you’ve
|
1377
1505
|
done this, you need to remove the Phusion Passenger files.</p></div>
|
1378
|
-
<div class="ulist"><ul>
|
1506
|
+
<div class="ulist"><ul>
|
1379
1507
|
<li>
|
1380
1508
|
<p>
|
1381
1509
|
If you installed Phusion Passenger via a gem, then type <span class="monospaced">gem uninstall passenger</span>.
|
@@ -1397,7 +1525,7 @@ Nginx binary.</p></div>
|
|
1397
1525
|
</div>
|
1398
1526
|
</div>
|
1399
1527
|
<div class="sect1">
|
1400
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1528
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="deploying_a_ror_app"></span><h2 data-comment-topic="deploying-a-ruby-on-rails-1-x-or-2-x-but-not-rails-3-application-b69gqa" data-anchor="deploying_a_ror_app">3. Deploying a Ruby on Rails 1.x or 2.x (but NOT Rails >= 3) application</h2>
|
1401
1529
|
<div class="sectionbody">
|
1402
1530
|
<div class="paragraph"><p>Suppose you have a Ruby on Rails application in <em>/webapps/mycook</em>, and you own
|
1403
1531
|
the domain <em>www.mycook.com</em>. You can either deploy your application to the
|
@@ -1405,17 +1533,17 @@ virtual host’s root (i.e. the application will be accessible from the root URL
|
|
1405
1533
|
<em>http://www.mycook.com/</em>), or in a sub URI (i.e. the application will be
|
1406
1534
|
accessible from a sub URL, such as <em>http://www.mycook.com/railsapplication</em>).</p></div>
|
1407
1535
|
<div class="admonitionblock">
|
1408
|
-
<table><tr>
|
1536
|
+
<table><tr>
|
1409
1537
|
<td class="icon">
|
1410
|
-
<img src="./images/icons/note.png" alt="Note">
|
1538
|
+
<img src="./images/icons/note.png" alt="Note">
|
1411
1539
|
</td>
|
1412
1540
|
<td class="content">The default <span class="monospaced">RAILS_ENV</span> environment in which deployed Rails applications
|
1413
1541
|
are run, is “production”. You can change this by changing the
|
1414
1542
|
<a href="#RailsEnv">rails_env</a> configuration option.</td>
|
1415
|
-
</tr></table>
|
1543
|
+
</tr></table>
|
1416
1544
|
</div>
|
1417
1545
|
<div class="sect2">
|
1418
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1546
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_deploying_to_a_virtual_host_8217_s_root"></span><h3 data-comment-topic="deploying-to-a-virtual-host-s-root-1mh24z5" data-anchor="_deploying_to_a_virtual_host_8217_s_root">3.1. Deploying to a virtual host’s root</h3>
|
1419
1547
|
<div class="paragraph"><p>Add a <em>server</em> virtual host entry to your Nginx configuration file. The virtual
|
1420
1548
|
host’s root must point to your Ruby on Rails application’s <em>public</em> folder.</p></div>
|
1421
1549
|
<div class="paragraph"><p>Inside the <em>server</em> block, set <em>passenger_enabled on</em>.</p></div>
|
@@ -1439,7 +1567,7 @@ host’s root must point to your Ruby on Rails application’s <em>public</em> f
|
|
1439
1567
|
<div class="paragraph"><p>Then restart Nginx. The application has now been deployed.</p></div>
|
1440
1568
|
</div>
|
1441
1569
|
<div class="sect2">
|
1442
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1570
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="deploying_rails_to_sub_uri"></span><h3 data-comment-topic="deploying-to-a-sub-uri-1il2qj7" data-anchor="deploying_rails_to_sub_uri">3.2. Deploying to a sub URI</h3>
|
1443
1571
|
<div class="paragraph"><p>Suppose that you already have a <em>server</em> virtual host entry:</p></div>
|
1444
1572
|
<div class="listingblock">
|
1445
1573
|
<div class="content monospaced">
|
@@ -1486,9 +1614,9 @@ option to the <em>server</em> block:</p></div>
|
|
1486
1614
|
</div>
|
1487
1615
|
<div class="paragraph"><p>Then restart Nginx. The application has now been deployed.</p></div>
|
1488
1616
|
<div class="admonitionblock">
|
1489
|
-
<table><tr>
|
1617
|
+
<table><tr>
|
1490
1618
|
<td class="icon">
|
1491
|
-
<img src="./images/icons/tip.png" alt="Tip">
|
1619
|
+
<img src="./images/icons/tip.png" alt="Tip">
|
1492
1620
|
</td>
|
1493
1621
|
<td class="content">
|
1494
1622
|
<div class="paragraph"><p>You can deploy multiple Rails applications under a virtual host, by specifying
|
@@ -1504,15 +1632,15 @@ option to the <em>server</em> block:</p></div>
|
|
1504
1632
|
</div>
|
1505
1633
|
</div>
|
1506
1634
|
</td>
|
1507
|
-
</tr></table>
|
1635
|
+
</tr></table>
|
1508
1636
|
</div>
|
1509
1637
|
</div>
|
1510
1638
|
<div class="sect2">
|
1511
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1639
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_redeploying_restarting_the_ruby_on_rails_application"></span><h3 data-comment-topic="redeploying-restarting-the-ruby-on-rails-application--1eso761" data-anchor="_redeploying_restarting_the_ruby_on_rails_application">3.3. Redeploying (restarting the Ruby on Rails application)</h3>
|
1512
1640
|
<div class="paragraph"><p>Deploying a new version of a Ruby on Rails application is as simple as
|
1513
1641
|
re-uploading the application files, and restarting the application.</p></div>
|
1514
1642
|
<div class="paragraph"><p>There are two ways to restart the application:</p></div>
|
1515
|
-
<div class="olist arabic"><ol class="arabic">
|
1643
|
+
<div class="olist arabic"><ol class="arabic">
|
1516
1644
|
<li>
|
1517
1645
|
<p>
|
1518
1646
|
By restarting Nginx.
|
@@ -1539,27 +1667,27 @@ of this file has changed in order to determine whether the application should
|
|
1539
1667
|
be restarted.</p></div>
|
1540
1668
|
</div>
|
1541
1669
|
<div class="sect2">
|
1542
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1670
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_migrations"></span><h3 data-comment-topic="migrations-9yyb8w" data-anchor="_migrations">3.4. Migrations</h3>
|
1543
1671
|
<div class="paragraph"><p>Phusion Passenger is not related to Ruby on Rails migrations in any way. To
|
1544
1672
|
run migrations on your deployment server, please login to your deployment
|
1545
1673
|
server (e.g. with <em>ssh</em>) and type <span class="monospaced">rake db:migrate RAILS_ENV=production</span> in
|
1546
1674
|
a shell console, just like one would normally run migrations.</p></div>
|
1547
1675
|
</div>
|
1548
1676
|
<div class="sect2">
|
1549
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1677
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_capistrano_integration"></span><h3 data-comment-topic="capistrano-integration-1ktunm6" data-anchor="_capistrano_integration">3.5. Capistrano integration</h3>
|
1550
1678
|
<div class="paragraph"><p>See <a href="#capistrano">Capistrano recipe</a>.</p></div>
|
1551
1679
|
</div>
|
1552
1680
|
</div>
|
1553
1681
|
</div>
|
1554
1682
|
<div class="sect1">
|
1555
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1683
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="deploying_a_rack_app"></span><h2 data-comment-topic="deploying-a-rack-based-ruby-application-including-rails-3--12benx3" data-anchor="deploying_a_rack_app">4. Deploying a Rack-based Ruby application (including Rails >= 3)</h2>
|
1556
1684
|
<div class="sectionbody">
|
1557
1685
|
<div class="paragraph"><p>Phusion Passenger supports arbitrary Ruby web applications that follow the
|
1558
1686
|
<a href="http://rack.rubyforge.org/">Rack</a> interface.</p></div>
|
1559
1687
|
<div class="paragraph"><p>Phusion Passenger assumes that Rack application directories have a certain layout.
|
1560
1688
|
Suppose that you have a Rack application in <em>/webapps/rackapp</em>. Then that
|
1561
1689
|
folder must contain at least three entries:</p></div>
|
1562
|
-
<div class="ulist"><ul>
|
1690
|
+
<div class="ulist"><ul>
|
1563
1691
|
<li>
|
1564
1692
|
<p>
|
1565
1693
|
<em>config.ru</em>, a Rackup file for starting the Rack application. This file must contain
|
@@ -1595,17 +1723,17 @@ to the virtual host’s root (i.e. the application will be accessible from the r
|
|
1595
1723
|
<em>http://www.rackapp.com/</em>), or in a sub URI (i.e. the application will be
|
1596
1724
|
accessible from a sub URL, such as <em>http://www.rackapp.com/rackapp</em>).</p></div>
|
1597
1725
|
<div class="admonitionblock">
|
1598
|
-
<table><tr>
|
1726
|
+
<table><tr>
|
1599
1727
|
<td class="icon">
|
1600
|
-
<img src="./images/icons/note.png" alt="Note">
|
1728
|
+
<img src="./images/icons/note.png" alt="Note">
|
1601
1729
|
</td>
|
1602
1730
|
<td class="content">The default <span class="monospaced">RACK_ENV</span> environment in which deployed Rack applications
|
1603
1731
|
are run, is “production”. You can change this by changing the
|
1604
1732
|
<a href="#RackEnv">rack_env</a> configuration option.</td>
|
1605
|
-
</tr></table>
|
1733
|
+
</tr></table>
|
1606
1734
|
</div>
|
1607
1735
|
<div class="sect2">
|
1608
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1736
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_tutorial_example_writing_and_deploying_a_hello_world_rack_application"></span><h3 data-comment-topic="tutorial-example-writing-and-deploying-a-hello-world-rack-application-1wstx99" data-anchor="_tutorial_example_writing_and_deploying_a_hello_world_rack_application">4.1. Tutorial/example: writing and deploying a Hello World Rack application</h3>
|
1609
1737
|
<div class="paragraph"><p>First we create a Phusion Passenger-compliant Rack directory structure:</p></div>
|
1610
1738
|
<div class="listingblock">
|
1611
1739
|
<div class="content monospaced">
|
@@ -1647,7 +1775,7 @@ the Nginx configuration file:</p></div>
|
|
1647
1775
|
under the URL <em>http://www.rackexample.com/</em>.</p></div>
|
1648
1776
|
</div>
|
1649
1777
|
<div class="sect2">
|
1650
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1778
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_deploying_to_a_virtual_host_8217_s_root_2"></span><h3 data-comment-topic="deploying-to-a-virtual-host-s-root-f02erj" data-anchor="_deploying_to_a_virtual_host_8217_s_root_2">4.2. Deploying to a virtual host’s root</h3>
|
1651
1779
|
<div class="paragraph"><p>Add a <em>server</em> virtual host entry to your Nginx configuration file. The virtual host’s
|
1652
1780
|
root must point to your Rack application’s <em>public</em> folder. You must also set
|
1653
1781
|
<em>passenger_enabled on</em> in the <em>server</em> block.</p></div>
|
@@ -1669,7 +1797,7 @@ root must point to your Rack application’s <em>public</em> folder. You must al
|
|
1669
1797
|
<div class="paragraph"><p>Then restart Nginx. The application has now been deployed.</p></div>
|
1670
1798
|
</div>
|
1671
1799
|
<div class="sect2">
|
1672
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1800
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="deploying_rack_to_sub_uri"></span><h3 data-comment-topic="deploying-to-a-sub-uri-37q0ou" data-anchor="deploying_rack_to_sub_uri">4.3. Deploying to a sub URI</h3>
|
1673
1801
|
<div class="paragraph"><p>Suppose that you already have a virtual host:</p></div>
|
1674
1802
|
<div class="listingblock">
|
1675
1803
|
<div class="content monospaced">
|
@@ -1717,9 +1845,9 @@ option to the <em>server</em> block:</p></div>
|
|
1717
1845
|
</div>
|
1718
1846
|
<div class="paragraph"><p>Then restart Nginx. The application has now been deployed.</p></div>
|
1719
1847
|
<div class="admonitionblock">
|
1720
|
-
<table><tr>
|
1848
|
+
<table><tr>
|
1721
1849
|
<td class="icon">
|
1722
|
-
<img src="./images/icons/tip.png" alt="Tip">
|
1850
|
+
<img src="./images/icons/tip.png" alt="Tip">
|
1723
1851
|
</td>
|
1724
1852
|
<td class="content">
|
1725
1853
|
<div class="paragraph"><p>You can deploy multiple Rack applications under a virtual host, by specifying
|
@@ -1735,15 +1863,15 @@ option to the <em>server</em> block:</p></div>
|
|
1735
1863
|
</div>
|
1736
1864
|
</div>
|
1737
1865
|
</td>
|
1738
|
-
</tr></table>
|
1866
|
+
</tr></table>
|
1739
1867
|
</div>
|
1740
1868
|
</div>
|
1741
1869
|
<div class="sect2">
|
1742
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1870
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_redeploying_restarting_the_rack_application"></span><h3 data-comment-topic="redeploying-restarting-the-rack-application--xnbfam" data-anchor="_redeploying_restarting_the_rack_application">4.4. Redeploying (restarting the Rack application)</h3>
|
1743
1871
|
<div class="paragraph"><p>Deploying a new version of a Rack application is as simple as
|
1744
1872
|
re-uploading the application files, and restarting the application.</p></div>
|
1745
1873
|
<div class="paragraph"><p>There are two ways to restart the application:</p></div>
|
1746
|
-
<div class="olist arabic"><ol class="arabic">
|
1874
|
+
<div class="olist arabic"><ol class="arabic">
|
1747
1875
|
<li>
|
1748
1876
|
<p>
|
1749
1877
|
By restarting Nginx.
|
@@ -1766,10 +1894,10 @@ command line:</p></div>
|
|
1766
1894
|
</div>
|
1767
1895
|
</div>
|
1768
1896
|
<div class="sect2">
|
1769
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1897
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_rackup_specifications_for_various_web_frameworks"></span><h3 data-comment-topic="rackup-specifications-for-various-web-frameworks-1a2cs41" data-anchor="_rackup_specifications_for_various_web_frameworks">4.5. Rackup specifications for various web frameworks</h3>
|
1770
1898
|
<div class="paragraph"><p>This subsection shows example <em>config.ru</em> files for various web frameworks.</p></div>
|
1771
1899
|
<div class="sect3">
|
1772
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1900
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_camping"></span><h4 data-comment-topic="camping-16vz2yb" data-anchor="_camping">4.5.1. Camping</h4>
|
1773
1901
|
<div class="listingblock">
|
1774
1902
|
<div class="content monospaced">
|
1775
1903
|
<pre>require 'rubygems'
|
@@ -1788,7 +1916,7 @@ run Rack::Adapter::Camping.new(Blog)</pre>
|
|
1788
1916
|
<div class="paragraph"><p>For Camping versions 2.0 and up, using <span class="monospaced">run Blog</span> as the final line will do.</p></div>
|
1789
1917
|
</div>
|
1790
1918
|
<div class="sect3">
|
1791
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1919
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_halcyon"></span><h4 data-comment-topic="halcyon-1benlfl" data-anchor="_halcyon">4.5.2. Halcyon</h4>
|
1792
1920
|
<div class="listingblock">
|
1793
1921
|
<div class="content monospaced">
|
1794
1922
|
<pre>require 'rubygems'
|
@@ -1800,7 +1928,7 @@ run Halcyon::Runner.new</pre>
|
|
1800
1928
|
</div>
|
1801
1929
|
</div>
|
1802
1930
|
<div class="sect3">
|
1803
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1931
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_mack"></span><h4 data-comment-topic="mack-1ezijq6" data-anchor="_mack">4.5.3. Mack</h4>
|
1804
1932
|
<div class="listingblock">
|
1805
1933
|
<div class="content monospaced">
|
1806
1934
|
<pre>ENV["MACK_ENV"] = ENV["RACK_ENV"]
|
@@ -1812,7 +1940,7 @@ run Mack::Utils::Server.build_app</pre>
|
|
1812
1940
|
</div>
|
1813
1941
|
</div>
|
1814
1942
|
<div class="sect3">
|
1815
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1943
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_merb"></span><h4 data-comment-topic="merb-ddsh55" data-anchor="_merb">4.5.4. Merb</h4>
|
1816
1944
|
<div class="listingblock">
|
1817
1945
|
<div class="content monospaced">
|
1818
1946
|
<pre>require 'rubygems'
|
@@ -1831,7 +1959,7 @@ run Merb::Rack::Application.new</pre>
|
|
1831
1959
|
</div>
|
1832
1960
|
</div>
|
1833
1961
|
<div class="sect3">
|
1834
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1962
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_ramaze"></span><h4 data-comment-topic="ramaze-1p2zod" data-anchor="_ramaze">4.5.5. Ramaze</h4>
|
1835
1963
|
<div class="listingblock">
|
1836
1964
|
<div class="content monospaced">
|
1837
1965
|
<pre>require "rubygems"
|
@@ -1844,7 +1972,7 @@ run Ramaze::Adapter::Base</pre>
|
|
1844
1972
|
</div>
|
1845
1973
|
</div>
|
1846
1974
|
<div class="sect3">
|
1847
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1975
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_sinatra"></span><h4 data-comment-topic="sinatra-a7u9ag" data-anchor="_sinatra">4.5.6. Sinatra</h4>
|
1848
1976
|
<div class="listingblock">
|
1849
1977
|
<div class="content monospaced">
|
1850
1978
|
<pre>require 'rubygems'
|
@@ -1859,14 +1987,14 @@ run Sinatra::Application</pre>
|
|
1859
1987
|
</div>
|
1860
1988
|
</div>
|
1861
1989
|
<div class="sect1">
|
1862
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1990
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_configuring_phusion_passenger"></span><h2 data-comment-topic="configuring-phusion-passenger-1g1svey" data-anchor="_configuring_phusion_passenger">5. Configuring Phusion Passenger</h2>
|
1863
1991
|
<div class="sectionbody">
|
1864
1992
|
<div class="paragraph"><p>After installation, Phusion Passenger does not need any further configurations.
|
1865
1993
|
Nevertheless, the system administrator may be interested in changing
|
1866
1994
|
Phusion Passenger’s behavior. Phusion Passenger supports the following configuration
|
1867
1995
|
options in the Nginx configuration file:</p></div>
|
1868
1996
|
<div class="sect2">
|
1869
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
1997
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_root_lt_directory_gt"></span><h3 data-comment-topic="passenger-root-directory--bqvhhz" data-anchor="_passenger_root_lt_directory_gt">5.1. passenger_root <directory></h3>
|
1870
1998
|
<div class="paragraph"><p>The location to the Phusion Passenger root directory. This configuration option
|
1871
1999
|
is essential to Phusion Passenger, and allows Phusion Passenger to locate its own
|
1872
2000
|
data files. The correct value is given by the installer.</p></div>
|
@@ -1876,17 +2004,17 @@ this option as well. Please read
|
|
1876
2004
|
<div class="paragraph"><p>This required option may only occur once, in the <em>http</em> configuration block.</p></div>
|
1877
2005
|
</div>
|
1878
2006
|
<div class="sect2">
|
1879
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2007
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_ruby_lt_filename_gt"></span><h3 data-comment-topic="passenger-ruby-filename--1gnok5k" data-anchor="_passenger_ruby_lt_filename_gt">5.2. passenger_ruby <filename></h3>
|
1880
2008
|
<div class="paragraph"><p>This option allows one to specify the Ruby interpreter to use.</p></div>
|
1881
2009
|
<div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration block.
|
1882
2010
|
The default is <em>ruby</em>.</p></div>
|
1883
2011
|
</div>
|
1884
2012
|
<div class="sect2">
|
1885
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2013
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerSpawnMethod"></span><h3 data-comment-topic="passenger-spawn-method-string--1sc6njl" data-anchor="PassengerSpawnMethod">5.3. passenger_spawn_method <string></h3>
|
1886
2014
|
<div class="admonitionblock">
|
1887
|
-
<table><tr>
|
2015
|
+
<table><tr>
|
1888
2016
|
<td class="icon">
|
1889
|
-
<img src="./images/icons/tip.png" alt="Tip">
|
2017
|
+
<img src="./images/icons/tip.png" alt="Tip">
|
1890
2018
|
</td>
|
1891
2019
|
<td class="content">
|
1892
2020
|
<div class="title">"What spawn method should I use?"</div>
|
@@ -1901,12 +2029,12 @@ understand it, as it’s mostly a technical detail. You can basically follow thi
|
|
1901
2029
|
<div class="paragraph"><p>However, we do recommend you to try to understand it. The <em>smart</em> and <em>smart-lv2</em> spawn
|
1902
2030
|
methods bring many benefits.</p></div>
|
1903
2031
|
</td>
|
1904
|
-
</tr></table>
|
2032
|
+
</tr></table>
|
1905
2033
|
</div>
|
1906
2034
|
<div class="paragraph"><p>Internally, Phusion Passenger spawns multiple Ruby application processes in order to handle
|
1907
2035
|
requests. But there are multiple ways with which processes can be spawned, each having
|
1908
2036
|
its own set of pros and cons. Supported spawn methods are:</p></div>
|
1909
|
-
<div class="dlist"><dl>
|
2037
|
+
<div class="dlist"><dl>
|
1910
2038
|
<dt class="hdlist1">
|
1911
2039
|
<em>smart</em>
|
1912
2040
|
</dt>
|
@@ -1964,7 +2092,7 @@ render <a href="#reducing_memory_usage">Ruby Enterprise Edition’s memory reduc
|
|
1964
2092
|
</dd>
|
1965
2093
|
</dl></div>
|
1966
2094
|
<div class="paragraph"><p>This option may occur in the following places:</p></div>
|
1967
|
-
<div class="ulist"><ul>
|
2095
|
+
<div class="ulist"><ul>
|
1968
2096
|
<li>
|
1969
2097
|
<p>
|
1970
2098
|
In the <em>http</em> configuration block.
|
@@ -1989,7 +2117,7 @@ In an <em>if</em> configuration scope.
|
|
1989
2117
|
<div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>smart-lv2</em>.</p></div>
|
1990
2118
|
</div>
|
1991
2119
|
<div class="sect2">
|
1992
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2120
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerRollingRestarts"></span><h3 data-comment-topic="passenger-rolling-restarts" data-anchor="PassengerRollingRestarts">5.4. passenger_rolling_restarts <on|off></h3>
|
1993
2121
|
<div class="paragraph"><p><strong>This feature is only available in <a href="https://www.phusionpassenger.com/enterprise">Phusion Passenger Enterprise</a>. It was introduced in version 3.0.0. <a href="https://www.phusionpassenger.com/download">Buy Phusion Passenger Enterprise here.</a></strong></p></div>
|
1994
2122
|
<div class="paragraph"><p>Enables or disables support for rolling restarts. Normally when you
|
1995
2123
|
restart an application (by touching restart.txt), Phusion Passenger would
|
@@ -1998,7 +2126,7 @@ of a new application process could take a while, and any requests that
|
|
1998
2126
|
come in during this time will be blocked until this first application
|
1999
2127
|
process has spawned.</p></div>
|
2000
2128
|
<div class="paragraph"><p>But when rolling restarts are enabled, Phusion Passenger Enterprise will:</p></div>
|
2001
|
-
<div class="olist arabic"><ol class="arabic">
|
2129
|
+
<div class="olist arabic"><ol class="arabic">
|
2002
2130
|
<li>
|
2003
2131
|
<p>
|
2004
2132
|
Spawn a new process in the background.
|
@@ -2017,7 +2145,7 @@ Step 1 and 2 are repeated until all processes have been replaced.
|
|
2017
2145
|
</ol></div>
|
2018
2146
|
<div class="paragraph"><p>This way, visitors will not experience any delays when you are restarting your application. This allows you to, for example, upgrade your application often without degrading user experience.</p></div>
|
2019
2147
|
<div class="paragraph"><p>Rolling restarts have a few caveat however that you should be aware of:</p></div>
|
2020
|
-
<div class="ulist"><ul>
|
2148
|
+
<div class="ulist"><ul>
|
2021
2149
|
<li>
|
2022
2150
|
<p>
|
2023
2151
|
Upgrading an application sometimes involves upgrading the database schema.
|
@@ -2037,7 +2165,7 @@ Because there’s no telling which process will serve a request, users may
|
|
2037
2165
|
</li>
|
2038
2166
|
</ul></div>
|
2039
2167
|
<div class="paragraph"><p>This option may occur in the following places:</p></div>
|
2040
|
-
<div class="ulist"><ul>
|
2168
|
+
<div class="ulist"><ul>
|
2041
2169
|
<li>
|
2042
2170
|
<p>
|
2043
2171
|
In the <em>http</em> configuration block.
|
@@ -2062,12 +2190,12 @@ In an <em>if</em> configuration scope.
|
|
2062
2190
|
<div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>off</em>.</p></div>
|
2063
2191
|
</div>
|
2064
2192
|
<div class="sect2">
|
2065
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2193
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_resist_deployment_errors_lt_on_off_gt"></span><h3 data-comment-topic="passenger-resist-deployment-errors-on-off--k9yf1" data-anchor="_passenger_resist_deployment_errors_lt_on_off_gt">5.5. passenger_resist_deployment_errors <on|off></h3>
|
2066
2194
|
<div class="paragraph"><p><strong>This feature is only available in <a href="https://www.phusionpassenger.com/enterprise">Phusion Passenger Enterprise</a>. It was introduced in version 3.0.0. <a href="https://www.phusionpassenger.com/download">Buy Phusion Passenger Enterprise here.</a></strong></p></div>
|
2067
2195
|
<div class="paragraph"><p>Enables or disables resistance against deployment errors.</p></div>
|
2068
2196
|
<div class="paragraph"><p>Suppose you’ve upgraded your application and you’ve issues a command to restart it (by touching restart.txt), but the application code contains an error that prevents Phusion Passenger from successfully spawning a process (e.g. a syntax error). Phusion Passenger would normally display an error message in response to this.</p></div>
|
2069
2197
|
<div class="paragraph"><p>By enabling deployment error resistance, Phusion Passenger Enterprise would instead do this:</p></div>
|
2070
|
-
<div class="ulist"><ul>
|
2198
|
+
<div class="ulist"><ul>
|
2071
2199
|
<li>
|
2072
2200
|
<p>
|
2073
2201
|
It passes the request to one of the existing application processes (that belong to the previous version of the application). The visitor will not see a Phusion Passenger process spawning error message.
|
@@ -2087,7 +2215,7 @@ It sets an internal flag so that no processes for this application will be spawn
|
|
2087
2215
|
<div class="paragraph"><p>This way, visitors will suffer minimally from deployment errors. Phusion Passenger will attempt to restart the application again next time restart.txt is touched.</p></div>
|
2088
2216
|
<div class="paragraph"><p>Enabling deployment error resistance only works if <a href="#PassengerRollingRestarts">rolling restart</a> is also enabled.</p></div>
|
2089
2217
|
<div class="paragraph"><p>This option may occur in the following places:</p></div>
|
2090
|
-
<div class="ulist"><ul>
|
2218
|
+
<div class="ulist"><ul>
|
2091
2219
|
<li>
|
2092
2220
|
<p>
|
2093
2221
|
In the <em>http</em> configuration block.
|
@@ -2112,9 +2240,9 @@ In an <em>if</em> configuration scope.
|
|
2112
2240
|
<div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>off</em>.</p></div>
|
2113
2241
|
</div>
|
2114
2242
|
<div class="sect2">
|
2115
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2243
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_important_deployment_options"></span><h3 data-comment-topic="important-deployment-options-av567" data-anchor="_important_deployment_options">5.6. Important deployment options</h3>
|
2116
2244
|
<div class="sect3">
|
2117
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2245
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_enabled_lt_on_off_gt"></span><h4 data-comment-topic="passenger-enabled-on-off--1rpb2t7" data-anchor="_passenger_enabled_lt_on_off_gt">5.6.1. passenger_enabled <on|off></h4>
|
2118
2246
|
<div class="paragraph"><p>This option may be specified in the <em>http</em> configuration block, a
|
2119
2247
|
<em>server</em> configuration block, a <em>location</em> configuration block or
|
2120
2248
|
an <em>if</em> configuration scope, to enable or disable Phusion Passenger
|
@@ -2126,7 +2254,7 @@ and <a href="#deploying_a_rack_app">Deploying a Rack-based Ruby application</a>
|
|
2126
2254
|
for examples.</p></div>
|
2127
2255
|
</div>
|
2128
2256
|
<div class="sect3">
|
2129
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2257
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerBaseURI"></span><h4 data-comment-topic="passenger-base-uri-uri--1xtuo50" data-anchor="PassengerBaseURI">5.6.2. passenger_base_uri <uri></h4>
|
2130
2258
|
<div class="paragraph"><p>Used to specify that the given URI is an distinct application that should
|
2131
2259
|
be served by Phusion Passenger. This option can be used for both Rails and
|
2132
2260
|
Rack applications. See <a href="#deploying_rails_to_sub_uri">Deploying Rails to a sub URI</a>
|
@@ -2134,7 +2262,7 @@ for an example.</p></div>
|
|
2134
2262
|
<div class="paragraph"><p>It is allowed to specify this option multiple times. Do this to deploy multiple
|
2135
2263
|
applications in different sub-URIs under the same virtual host.</p></div>
|
2136
2264
|
<div class="paragraph"><p>This option may occur in the following places:</p></div>
|
2137
|
-
<div class="ulist"><ul>
|
2265
|
+
<div class="ulist"><ul>
|
2138
2266
|
<li>
|
2139
2267
|
<p>
|
2140
2268
|
In the <em>http</em> configuration block.
|
@@ -2159,12 +2287,12 @@ In an <em>if</em> configuration scope.
|
|
2159
2287
|
</div>
|
2160
2288
|
</div>
|
2161
2289
|
<div class="sect2">
|
2162
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2290
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_connection_handling_options"></span><h3 data-comment-topic="connection-handling-options-8jgq90" data-anchor="_connection_handling_options">5.7. Connection handling options</h3>
|
2163
2291
|
<div class="sect3">
|
2164
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2292
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerUseGlobalQueue"></span><h4 data-comment-topic="passenger-use-global-queue-on-off--14h9n22" data-anchor="PassengerUseGlobalQueue">5.7.1. passenger_use_global_queue <on|off></h4>
|
2165
2293
|
<div class="paragraph"><p>Turns the use of global queuing on or off.</p></div>
|
2166
2294
|
<div class="paragraph"><p>This option may occur in the following places:</p></div>
|
2167
|
-
<div class="ulist"><ul>
|
2295
|
+
<div class="ulist"><ul>
|
2168
2296
|
<li>
|
2169
2297
|
<p>
|
2170
2298
|
In the <em>http</em> configuration block.
|
@@ -2213,7 +2341,7 @@ process.</p></div>
|
|
2213
2341
|
long-running requests.</p>
|
2214
2342
|
</div>
|
2215
2343
|
<div class="paragraph"><p>For example suppose that:</p></div>
|
2216
|
-
<div class="ulist"><ul>
|
2344
|
+
<div class="ulist"><ul>
|
2217
2345
|
<li>
|
2218
2346
|
<p>
|
2219
2347
|
global queuing is turned off.
|
@@ -2268,7 +2396,7 @@ process that becomes available will take from the queue, and so this
|
|
2268
2396
|
“queuing-behind-long-running-request” problem will never occur.</p></div>
|
2269
2397
|
</div>
|
2270
2398
|
<div class="sect3">
|
2271
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2399
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_ignore_client_abort_lt_on_off_gt"></span><h4 data-comment-topic="passenger-ignore-client-abort" data-anchor="_passenger_ignore_client_abort_lt_on_off_gt">5.7.2. passenger_ignore_client_abort <on|off></h4>
|
2272
2400
|
<div class="paragraph"><p>Normally, when the HTTP client aborts the connection (e.g. when the user clicked on "Stop"
|
2273
2401
|
in the browser), the connection with the application process will be closed too. If the
|
2274
2402
|
application process continues to send its response, then that will result in EPIPE errors
|
@@ -2279,7 +2407,7 @@ read the application process’s response while discarding all the read data. Th
|
|
2279
2407
|
EPIPE errors but it’ll also mean the backend process will be unavailable for new requests
|
2280
2408
|
until it is done sending its response.</p></div>
|
2281
2409
|
<div class="paragraph"><p>This option may occur in the following places:</p></div>
|
2282
|
-
<div class="ulist"><ul>
|
2410
|
+
<div class="ulist"><ul>
|
2283
2411
|
<li>
|
2284
2412
|
<p>
|
2285
2413
|
In the <em>http</em> configuration block.
|
@@ -2304,7 +2432,7 @@ In an <em>if</em> configuration scope.
|
|
2304
2432
|
<div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>off</em>.</p></div>
|
2305
2433
|
</div>
|
2306
2434
|
<div class="sect3">
|
2307
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2435
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_set_cgi_param_lt_cgi_environment_name_gt_lt_value_gt"></span><h4 data-comment-topic="passenger-set-cgi-param-cgi-environment-name-value--rx9gc0" data-anchor="_passenger_set_cgi_param_lt_cgi_environment_name_gt_lt_value_gt">5.7.3. passenger_set_cgi_param <CGI environment name> <value></h4>
|
2308
2436
|
<div class="paragraph"><p>Allows one to define additional CGI environment variables to pass to the backend
|
2309
2437
|
application. This is equivalent to ngx_http_fastcgi_module’s <em>fastcgi_param</em>
|
2310
2438
|
directive, and is comparable to ngx_http_proxy_module’s <em>proxy_set_header</em> option.
|
@@ -2331,7 +2459,7 @@ passenger_set_cgi_param HTTP_X_FORWARDED_FOR 127.0.0.2;</pre>
|
|
2331
2459
|
</div>
|
2332
2460
|
</div>
|
2333
2461
|
<div class="paragraph"><p>This option may occur in the following places:</p></div>
|
2334
|
-
<div class="ulist"><ul>
|
2462
|
+
<div class="ulist"><ul>
|
2335
2463
|
<li>
|
2336
2464
|
<p>
|
2337
2465
|
In the <em>http</em> configuration block.
|
@@ -2355,7 +2483,7 @@ In an <em>if</em> configuration scope.
|
|
2355
2483
|
</ul></div>
|
2356
2484
|
</div>
|
2357
2485
|
<div class="sect3">
|
2358
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2486
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_pass_header_lt_header_name_gt"></span><h4 data-comment-topic="passenger-pass-header-header-name--1cg31je" data-anchor="_passenger_pass_header_lt_header_name_gt">5.7.4. passenger_pass_header <header name></h4>
|
2359
2487
|
<div class="paragraph"><p>Some headers generated by backend applications are not forwarded to the HTTP client,
|
2360
2488
|
e.g. <em>X-Accel-Redirect</em> which is directly processed by Nginx and then discarded from
|
2361
2489
|
the final response. This directive allows one to force Nginx to pass those headers
|
@@ -2369,7 +2497,7 @@ anyway, similar to how <em>proxy_pass_header</em> works.</p></div>
|
|
2369
2497
|
</div>
|
2370
2498
|
</div>
|
2371
2499
|
<div class="paragraph"><p>This option may occur in the following places:</p></div>
|
2372
|
-
<div class="ulist"><ul>
|
2500
|
+
<div class="ulist"><ul>
|
2373
2501
|
<li>
|
2374
2502
|
<p>
|
2375
2503
|
In the <em>http</em> configuration block.
|
@@ -2393,7 +2521,7 @@ In an <em>if</em> configuration scope.
|
|
2393
2521
|
</ul></div>
|
2394
2522
|
</div>
|
2395
2523
|
<div class="sect3">
|
2396
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2524
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_buffer_response_lt_on_off_gt"></span><h4 data-comment-topic="passenger-buffer-response" data-anchor="_passenger_buffer_response_lt_on_off_gt">5.7.5. passenger_buffer_response <on|off></h4>
|
2397
2525
|
<div class="paragraph"><p>When turned on, application-generated responses are buffered in memory and also on
|
2398
2526
|
disk if the response is larger than a certain threshold. By buffering responses,
|
2399
2527
|
protection is provided against slow HTTP clients that can not read your response
|
@@ -2441,7 +2569,7 @@ after which it receives the entire response at once.
|
|
2441
2569
|
When response buffering is turned off, it works as expected: the client
|
2442
2570
|
receives an "entry X" message every second for 10 seconds.</p></div>
|
2443
2571
|
<div class="paragraph"><p>This option may occur in the following places:</p></div>
|
2444
|
-
<div class="ulist"><ul>
|
2572
|
+
<div class="ulist"><ul>
|
2445
2573
|
<li>
|
2446
2574
|
<p>
|
2447
2575
|
In the <em>http</em> configuration block.
|
@@ -2466,34 +2594,34 @@ In an <em>if</em> configuration scope.
|
|
2466
2594
|
<div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>on</em>.</p></div>
|
2467
2595
|
</div>
|
2468
2596
|
<div class="sect3">
|
2469
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2597
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_buffer_size"></span><h4 data-comment-topic="passenger-buffer-size-1jfkq87" data-anchor="_passenger_buffer_size">5.7.6. passenger_buffer_size</h4>
|
2470
2598
|
</div>
|
2471
2599
|
<div class="sect3">
|
2472
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2600
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_buffers"></span><h4 data-comment-topic="passenger-busy-buffers" data-anchor="_passenger_buffers">5.7.7. passenger_buffers</h4>
|
2473
2601
|
</div>
|
2474
2602
|
<div class="sect3">
|
2475
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2603
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_busy_buffer_size"></span><h4 data-comment-topic="passenger-busy-buffer-size-124sj61" data-anchor="_passenger_busy_buffer_size">5.7.8. passenger_busy_buffer_size</h4>
|
2476
2604
|
<div class="paragraph"><p>These options have the same effect as proxy_module’s similarly named options.
|
2477
2605
|
They can be used to modify the maximum allowed HTTP header size.</p></div>
|
2478
2606
|
</div>
|
2479
2607
|
</div>
|
2480
2608
|
<div class="sect2">
|
2481
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2609
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_security_options"></span><h3 data-comment-topic="security-options-1bv93g4" data-anchor="_security_options">5.8. Security options</h3>
|
2482
2610
|
<div class="sect3">
|
2483
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2611
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerUserSwitching"></span><h4 data-comment-topic="passenger-user-switching-on-off--1p37u3l" data-anchor="PassengerUserSwitching">5.8.1. passenger_user_switching <on|off></h4>
|
2484
2612
|
<div class="paragraph"><p>Whether to enable <a href="#user_switching">user switching support</a>.</p></div>
|
2485
2613
|
<div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration block.
|
2486
2614
|
The default value is <em>on</em>.</p></div>
|
2487
2615
|
</div>
|
2488
2616
|
<div class="sect3">
|
2489
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2617
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_user_lt_username_gt"></span><h4 data-comment-topic="passenger-user-username--b06ur7" data-anchor="_passenger_user_lt_username_gt">5.8.2. passenger_user <username></h4>
|
2490
2618
|
<div class="paragraph"><p>If <a href="#user_switching">user switching support</a> is enabled, then Phusion Passenger will
|
2491
2619
|
by default run the web application as the owner of the file <em>config/environment.rb</em>
|
2492
2620
|
(for Rails apps) or <em>config.ru</em> (for Rack apps). This option allows you to override
|
2493
2621
|
that behavior and explicitly set a user to run the web application as, regardless
|
2494
2622
|
of the ownership of <em>environment.rb</em>/<em>config.ru</em>.</p></div>
|
2495
2623
|
<div class="paragraph"><p>This option may occur in the following places:</p></div>
|
2496
|
-
<div class="ulist"><ul>
|
2624
|
+
<div class="ulist"><ul>
|
2497
2625
|
<li>
|
2498
2626
|
<p>
|
2499
2627
|
In the <em>http</em> configuration block.
|
@@ -2518,7 +2646,7 @@ In an <em>if</em> configuration scope.
|
|
2518
2646
|
<div class="paragraph"><p>In each place, it may be specified at most once.</p></div>
|
2519
2647
|
</div>
|
2520
2648
|
<div class="sect3">
|
2521
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2649
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_group_lt_group_name_gt"></span><h4 data-comment-topic="passenger-user-group-name--1fco4j7" data-anchor="_passenger_group_lt_group_name_gt">5.8.3. passenger_group <group name></h4>
|
2522
2650
|
<div class="paragraph"><p>If <a href="#user_switching">user switching support</a> is enabled, then Phusion Passenger will
|
2523
2651
|
by default run the web application as the primary group of the owner of the file
|
2524
2652
|
<em>config/environment.rb</em> (for Rails apps) or <em>config.ru</em> (for Rack apps). This option
|
@@ -2527,7 +2655,7 @@ as, regardless of the ownership of <em>environment.rb</em>/<em>config.ru</em>.</
|
|
2527
2655
|
<div class="paragraph"><p><em><group name></em> may also be set to the special value <em>!STARTUP_FILE!</em>, in which case
|
2528
2656
|
the web application’s group will be set to <em>environment.rb</em>/<em>config.ru</em>'s group.</p></div>
|
2529
2657
|
<div class="paragraph"><p>This option may occur in the following places:</p></div>
|
2530
|
-
<div class="ulist"><ul>
|
2658
|
+
<div class="ulist"><ul>
|
2531
2659
|
<li>
|
2532
2660
|
<p>
|
2533
2661
|
In the <em>http</em> configuration block.
|
@@ -2552,7 +2680,7 @@ In an <em>if</em> configuration scope.
|
|
2552
2680
|
<div class="paragraph"><p>In each place, it may be specified at most once.</p></div>
|
2553
2681
|
</div>
|
2554
2682
|
<div class="sect3">
|
2555
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2683
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerDefaultUser"></span><h4 data-comment-topic="passenger-default-user-username--1h6cdmf" data-anchor="PassengerDefaultUser">5.8.4. passenger_default_user <username></h4>
|
2556
2684
|
<div class="paragraph"><p>Phusion Passenger enables <a href="#user_switching">user switching support</a> by default.
|
2557
2685
|
This configuration option allows one to specify the user that applications must
|
2558
2686
|
run as, if user switching fails or is disabled.</p></div>
|
@@ -2560,7 +2688,7 @@ run as, if user switching fails or is disabled.</p></div>
|
|
2560
2688
|
The default value is <em>nobody</em>.</p></div>
|
2561
2689
|
</div>
|
2562
2690
|
<div class="sect3">
|
2563
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2691
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerDefaultGroup"></span><h4 data-comment-topic="passenger-default-group-group-name--1qxn2qa" data-anchor="PassengerDefaultGroup">5.8.5. Passenger_default_group <group name></h4>
|
2564
2692
|
<div class="paragraph"><p>Phusion Passenger enables <a href="#user_switching">user switching support</a> by default.
|
2565
2693
|
This configuration option allows one to specify the group that applications must
|
2566
2694
|
run as, if user switching fails or is disabled.</p></div>
|
@@ -2569,7 +2697,7 @@ The default value is the primary group of the user specifified by
|
|
2569
2697
|
<a href="#PassengerDefaultUser">passenger_default_user</a>.</p></div>
|
2570
2698
|
</div>
|
2571
2699
|
<div class="sect3">
|
2572
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2700
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_friendly_error_pages_lt_on_off_gt"></span><h4 data-comment-topic="passenger-friendly-error-pages-on-off--1ti1a0e" data-anchor="_passenger_friendly_error_pages_lt_on_off_gt">5.8.6. passenger_friendly_error_pages <on|off></h4>
|
2573
2701
|
<div class="paragraph"><p>Phusion Passenger can display friendly error pages whenever an application fails
|
2574
2702
|
to start. This friendly error page presents the startup error message, some
|
2575
2703
|
suggestions for solving the problem, and a backtrace. This feature is very useful
|
@@ -2578,7 +2706,7 @@ but the page might reveal potentially sensitive information, depending on the
|
|
2578
2706
|
application. Experienced system administrators who are using Phusion Passenger
|
2579
2707
|
on serious production servers should consider turning this feature off.</p></div>
|
2580
2708
|
<div class="paragraph"><p>This option may occur in the following places:</p></div>
|
2581
|
-
<div class="ulist"><ul>
|
2709
|
+
<div class="ulist"><ul>
|
2582
2710
|
<li>
|
2583
2711
|
<p>
|
2584
2712
|
In the <em>http</em> configuration block.
|
@@ -2604,9 +2732,9 @@ In an <em>if</em> configuration scope.
|
|
2604
2732
|
</div>
|
2605
2733
|
</div>
|
2606
2734
|
<div class="sect2">
|
2607
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2735
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_resource_control_and_optimization_options"></span><h3 data-comment-topic="resource-control-and-optimization-options-xd7evs" data-anchor="_resource_control_and_optimization_options">5.9. Resource control and optimization options</h3>
|
2608
2736
|
<div class="sect3">
|
2609
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2737
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerMaxPoolSize"></span><h4 data-comment-topic="passenger-max-pool-size-integer--3jzefs" data-anchor="PassengerMaxPoolSize">5.9.1. passenger_max_pool_size <integer></h4>
|
2610
2738
|
<div class="paragraph"><p>The maximum number of <a href="#application_process">application processes</a> that may
|
2611
2739
|
simultanously exist. A larger number results in higher memory usage,
|
2612
2740
|
but improved ability to handle concurrent HTTP clients.</p></div>
|
@@ -2623,24 +2751,24 @@ hardware or getting more servers.)</p></div>
|
|
2623
2751
|
<div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration bock.
|
2624
2752
|
The default value is <em>6</em>.</p></div>
|
2625
2753
|
<div class="admonitionblock">
|
2626
|
-
<table><tr>
|
2754
|
+
<table><tr>
|
2627
2755
|
<td class="icon">
|
2628
|
-
<img src="./images/icons/tip.png" alt="Tip">
|
2756
|
+
<img src="./images/icons/tip.png" alt="Tip">
|
2629
2757
|
</td>
|
2630
2758
|
<td class="content">We strongly recommend you to <a href="#reducing_memory_usage">use Ruby Enterprise Edition</a>. This allows you to reduce the memory usage of your Ruby on Rails applications
|
2631
2759
|
by about 33%, and it’s not hard to install.</td>
|
2632
|
-
</tr></table>
|
2760
|
+
</tr></table>
|
2633
2761
|
</div>
|
2634
2762
|
</div>
|
2635
2763
|
<div class="sect3">
|
2636
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2764
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerMinInstances"></span><h4 data-comment-topic="passenger-min-instances-integer--uclykt" data-anchor="PassengerMinInstances">5.9.2. passenger_min_instances <integer></h4>
|
2637
2765
|
<div class="paragraph"><p>This specifies the minimum number of application processes that should exist for a
|
2638
2766
|
given application. You should set this option to a
|
2639
2767
|
non-zero value if you want to avoid potentially long startup times after a website
|
2640
2768
|
has been <a href="#idle_process">idle</a> for an extended period.</p></div>
|
2641
2769
|
<div class="paragraph"><p>Please note that this option does <strong>not</strong> pre-start application processes during Nginx
|
2642
2770
|
startup. It just makes sure that when the application is first accessed:</p></div>
|
2643
|
-
<div class="olist arabic"><ol class="arabic">
|
2771
|
+
<div class="olist arabic"><ol class="arabic">
|
2644
2772
|
<li>
|
2645
2773
|
<p>
|
2646
2774
|
at least the given number of processes will be spawned.
|
@@ -2683,7 +2811,7 @@ simultanously. Phusion Passenger will start 12 more application processes. After
|
|
2683
2811
|
timeout of 10 seconds have passed, Phusion Passenger will clean up 12 application
|
2684
2812
|
processes, keeping 3 processes around.</p></div>
|
2685
2813
|
<div class="paragraph"><p>The passenger_min_instances option may occur in the following places:</p></div>
|
2686
|
-
<div class="ulist"><ul>
|
2814
|
+
<div class="ulist"><ul>
|
2687
2815
|
<li>
|
2688
2816
|
<p>
|
2689
2817
|
In the <em>http</em> configuration block.
|
@@ -2708,7 +2836,7 @@ In an <em>if</em> configuration scope.
|
|
2708
2836
|
<div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>1</em>.</p></div>
|
2709
2837
|
</div>
|
2710
2838
|
<div class="sect3">
|
2711
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2839
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_max_instances_lt_integer_gt"></span><h4 data-comment-topic="passenger-max-instances" data-anchor="_passenger_max_instances_lt_integer_gt">5.9.3. passenger_max_instances <integer></h4>
|
2712
2840
|
<div class="paragraph"><p><strong>This feature is only available in <a href="https://www.phusionpassenger.com/enterprise">Phusion Passenger Enterprise</a>. It was introduced in version 3.0.0. <a href="https://www.phusionpassenger.com/download">Buy Phusion Passenger Enterprise here.</a></strong></p></div>
|
2713
2841
|
<div class="paragraph"><p>The maximum number of application processes that may simultaneously exist
|
2714
2842
|
for an application. This helps to make sure that a single application
|
@@ -2718,7 +2846,7 @@ means that there is no limit placed on the number of processes a single applicat
|
|
2718
2846
|
may spawn, i.e. only the global limit of <a href="#PassengerMaxPoolSize">passenger_max_pool_size</a>
|
2719
2847
|
will be enforced.</p></div>
|
2720
2848
|
<div class="paragraph"><p>This option may occur in the following places:</p></div>
|
2721
|
-
<div class="ulist"><ul>
|
2849
|
+
<div class="ulist"><ul>
|
2722
2850
|
<li>
|
2723
2851
|
<p>
|
2724
2852
|
In the <em>http</em> configuration block.
|
@@ -2742,9 +2870,9 @@ In an <em>if</em> configuration scope.
|
|
2742
2870
|
</ul></div>
|
2743
2871
|
<div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>0</em>.</p></div>
|
2744
2872
|
<div class="admonitionblock">
|
2745
|
-
<table><tr>
|
2873
|
+
<table><tr>
|
2746
2874
|
<td class="icon">
|
2747
|
-
<img src="./images/icons/tip.png" alt="Tip">
|
2875
|
+
<img src="./images/icons/tip.png" alt="Tip">
|
2748
2876
|
</td>
|
2749
2877
|
<td class="content">
|
2750
2878
|
<div class="title">Practical usage example</div>
|
@@ -2755,11 +2883,11 @@ to 10. The e-commerce website is more important to you. You can then set
|
|
2755
2883
|
than 3 processes, even if it suddenly gets a lot of traffic. Your e-commerce website
|
2756
2884
|
on the other hand will be free to spawn up to 10 processes if it gets a lot of traffic.</p></div>
|
2757
2885
|
</td>
|
2758
|
-
</tr></table>
|
2886
|
+
</tr></table>
|
2759
2887
|
</div>
|
2760
2888
|
</div>
|
2761
2889
|
<div class="sect3">
|
2762
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2890
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_max_instances_per_app_lt_integer_gt"></span><h4 data-comment-topic="passenger-max-instances-per-app-integer--1xhbbne" data-anchor="_passenger_max_instances_per_app_lt_integer_gt">5.9.4. passenger_max_instances_per_app <integer></h4>
|
2763
2891
|
<div class="paragraph"><p>The maximum number of application processes that may simultaneously exist
|
2764
2892
|
for a single application. This helps to make sure that a single application
|
2765
2893
|
will not occupy all available slots in the application pool.</p></div>
|
@@ -2771,7 +2899,7 @@ will be enforced.</p></div>
|
|
2771
2899
|
The default value is <em>0</em>.</p></div>
|
2772
2900
|
</div>
|
2773
2901
|
<div class="sect3">
|
2774
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2902
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerPoolIdleTime"></span><h4 data-comment-topic="passenger-pool-idle-time-integer--xcw65o" data-anchor="PassengerPoolIdleTime">5.9.5. passenger_pool_idle_time <integer></h4>
|
2775
2903
|
<div class="paragraph"><p>The maximum number of seconds that an application process may be idle. That is,
|
2776
2904
|
if an application process hasn’t received any traffic after the given number of
|
2777
2905
|
seconds, then it will be shutdown in order to conserve memory.</p></div>
|
@@ -2793,7 +2921,7 @@ applications, each which must be available at all times.</p></div>
|
|
2793
2921
|
The default value is <em>300</em>.</p></div>
|
2794
2922
|
</div>
|
2795
2923
|
<div class="sect3">
|
2796
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2924
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerMaxRequests"></span><h4 data-comment-topic="passenger-max-requests" data-anchor="PassengerMaxRequests">5.9.6. passenger_max_requests <integer></h4>
|
2797
2925
|
<div class="paragraph"><p>The maximum number of requests an application process will process. After
|
2798
2926
|
serving that many requests, the application process will be shut down and
|
2799
2927
|
Phusion Passenger will restart it. A value of 0 means that there is no maximum:
|
@@ -2803,7 +2931,7 @@ reached.</p></div>
|
|
2803
2931
|
it down after a certain number of requests, all of its memory is guaranteed
|
2804
2932
|
to be freed by the operating system.</p></div>
|
2805
2933
|
<div class="paragraph"><p>This option may occur in the following places:</p></div>
|
2806
|
-
<div class="ulist"><ul>
|
2934
|
+
<div class="ulist"><ul>
|
2807
2935
|
<li>
|
2808
2936
|
<p>
|
2809
2937
|
In the <em>http</em> configuration block.
|
@@ -2827,9 +2955,9 @@ In an <em>if</em> configuration scope.
|
|
2827
2955
|
</ul></div>
|
2828
2956
|
<div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>0</em>.</p></div>
|
2829
2957
|
<div class="admonitionblock">
|
2830
|
-
<table><tr>
|
2958
|
+
<table><tr>
|
2831
2959
|
<td class="icon">
|
2832
|
-
<img src="./images/icons/caution.png" alt="Caution">
|
2960
|
+
<img src="./images/icons/caution.png" alt="Caution">
|
2833
2961
|
</td>
|
2834
2962
|
<td class="content">
|
2835
2963
|
<div class="paragraph"><p>The <a href="#PassengerMaxRequests">passenger_max_requests</a> directive should be considered
|
@@ -2837,11 +2965,11 @@ as a workaround for misbehaving applications. It is advised that you fix the
|
|
2837
2965
|
problem in your application rather than relying on these directives as a
|
2838
2966
|
measure to avoid memory leaks.</p></div>
|
2839
2967
|
</td>
|
2840
|
-
</tr></table>
|
2968
|
+
</tr></table>
|
2841
2969
|
</div>
|
2842
2970
|
</div>
|
2843
2971
|
<div class="sect3">
|
2844
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
2972
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerMaxRequestTime"></span><h4 data-comment-topic="passenger-max-request-time-seconds--1qod9kg" data-anchor="PassengerMaxRequestTime">5.9.7. passenger_max_request_time <seconds></h4>
|
2845
2973
|
<div class="paragraph"><p><strong>This feature is only available in <a href="https://www.phusionpassenger.com/enterprise">Phusion Passenger Enterprise</a>. It was introduced in version 3.0.0. <a href="https://www.phusionpassenger.com/download">Buy Phusion Passenger Enterprise here.</a></strong></p></div>
|
2846
2974
|
<div class="paragraph"><p>The maximum amount of time, in seconds, that an application process may take
|
2847
2975
|
to process a request. If the request takes longer than this amount of time,
|
@@ -2850,7 +2978,7 @@ restarted upon the next request. A value of 0 means that there is no time limit.
|
|
2850
2978
|
<div class="paragraph"><p>This option is useful for preventing your application from freezing for an
|
2851
2979
|
indefinite period of time.</p></div>
|
2852
2980
|
<div class="paragraph"><p>This option may occur in the following places:</p></div>
|
2853
|
-
<div class="ulist"><ul>
|
2981
|
+
<div class="ulist"><ul>
|
2854
2982
|
<li>
|
2855
2983
|
<p>
|
2856
2984
|
In the <em>http</em> configuration block.
|
@@ -2898,9 +3026,9 @@ to 10 seconds. You can then configure Phusion Passenger as follows:</p>
|
|
2898
3026
|
or if a request to any other URI takes more than 2 seconds,
|
2899
3027
|
then the corresponding application process will be forced to shutdown.</p></div>
|
2900
3028
|
<div class="admonitionblock">
|
2901
|
-
<table><tr>
|
3029
|
+
<table><tr>
|
2902
3030
|
<td class="icon">
|
2903
|
-
<img src="./images/icons/caution.png" alt="Caution">
|
3031
|
+
<img src="./images/icons/caution.png" alt="Caution">
|
2904
3032
|
</td>
|
2905
3033
|
<td class="content">
|
2906
3034
|
<div class="paragraph"><p>The <a href="#PassengerMaxRequestTime">passenger_max_request_time</a> directive should be
|
@@ -2908,11 +3036,11 @@ considered as a workaround for misbehaving applications. It is advised that you
|
|
2908
3036
|
fix the problem in your application rather than relying on these directives as a
|
2909
3037
|
measure to avoid freezing applications.</p></div>
|
2910
3038
|
</td>
|
2911
|
-
</tr></table>
|
3039
|
+
</tr></table>
|
2912
3040
|
</div>
|
2913
3041
|
</div>
|
2914
3042
|
<div class="sect3">
|
2915
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3043
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerMemoryLimit"></span><h4 data-comment-topic="passenger-memory-limit-integer--1ry7dwx" data-anchor="PassengerMemoryLimit">5.9.8. passenger_memory_limit <integer></h4>
|
2916
3044
|
<div class="paragraph"><p><strong>This feature is only available in <a href="https://www.phusionpassenger.com/enterprise">Phusion Passenger Enterprise</a>. It was introduced in version 3.0.0. <a href="https://www.phusionpassenger.com/download">Buy Phusion Passenger Enterprise here.</a></strong></p></div>
|
2917
3045
|
<div class="paragraph"><p>The maximum amount of memory that an application process may use, in megabytes.
|
2918
3046
|
Once an application process has surpassed its memory limit, it will process
|
@@ -2922,7 +3050,7 @@ will not be checked.</p></div>
|
|
2922
3050
|
<div class="paragraph"><p>This option is useful if your application is leaking memory. By shutting
|
2923
3051
|
it down, all of its memory is guaranteed to be freed by the operating system.</p></div>
|
2924
3052
|
<div class="paragraph"><p>This option may occur in the following places:</p></div>
|
2925
|
-
<div class="ulist"><ul>
|
3053
|
+
<div class="ulist"><ul>
|
2926
3054
|
<li>
|
2927
3055
|
<p>
|
2928
3056
|
In the <em>http</em> configuration block.
|
@@ -2946,9 +3074,9 @@ In an <em>if</em> configuration scope.
|
|
2946
3074
|
</ul></div>
|
2947
3075
|
<div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>200</em>.</p></div>
|
2948
3076
|
<div class="admonitionblock">
|
2949
|
-
<table><tr>
|
3077
|
+
<table><tr>
|
2950
3078
|
<td class="icon">
|
2951
|
-
<img src="./images/icons/note.png" alt="Note">
|
3079
|
+
<img src="./images/icons/note.png" alt="Note">
|
2952
3080
|
</td>
|
2953
3081
|
<td class="content">
|
2954
3082
|
<div class="title">A word about permissions</div>
|
@@ -2961,12 +3089,12 @@ tight permissions on <span class="monospaced">/proc</span>, this directive may n
|
|
2961
3089
|
this directive and your <span class="monospaced">/proc</span> permissions are too tight, then please consider
|
2962
3090
|
untightening the permissions.</p></div>
|
2963
3091
|
</td>
|
2964
|
-
</tr></table>
|
3092
|
+
</tr></table>
|
2965
3093
|
</div>
|
2966
3094
|
<div class="admonitionblock">
|
2967
|
-
<table><tr>
|
3095
|
+
<table><tr>
|
2968
3096
|
<td class="icon">
|
2969
|
-
<img src="./images/icons/tip.png" alt="Tip">
|
3097
|
+
<img src="./images/icons/tip.png" alt="Tip">
|
2970
3098
|
</td>
|
2971
3099
|
<td class="content">
|
2972
3100
|
<div class="title">FreeBSD and <span class="monospaced">/proc</span>
|
@@ -2980,12 +3108,12 @@ which is very fast. If you mount <span class="monospaced">/proc</span> with a di
|
|
2980
3108
|
Phusion Passenger must resort to querying memory information from the <span class="monospaced">ps</span> command,
|
2981
3109
|
which is a lot slower.</p></div>
|
2982
3110
|
</td>
|
2983
|
-
</tr></table>
|
3111
|
+
</tr></table>
|
2984
3112
|
</div>
|
2985
3113
|
<div class="admonitionblock">
|
2986
|
-
<table><tr>
|
3114
|
+
<table><tr>
|
2987
3115
|
<td class="icon">
|
2988
|
-
<img src="./images/icons/caution.png" alt="Caution">
|
3116
|
+
<img src="./images/icons/caution.png" alt="Caution">
|
2989
3117
|
</td>
|
2990
3118
|
<td class="content">
|
2991
3119
|
<div class="paragraph"><p>The <a href="#PassengerMaxRequests">passenger_max_requests</a> and
|
@@ -2994,25 +3122,25 @@ as workarounds for misbehaving applications. It is advised that you fix the
|
|
2994
3122
|
problem in your application rather than relying on these directives as a
|
2995
3123
|
measure to avoid memory leaks.</p></div>
|
2996
3124
|
</td>
|
2997
|
-
</tr></table>
|
3125
|
+
</tr></table>
|
2998
3126
|
</div>
|
2999
3127
|
</div>
|
3000
3128
|
<div class="sect3">
|
3001
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3129
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerPreStart"></span><h4 data-comment-topic="passenger-pre-start-url--1f2phk7" data-anchor="PassengerPreStart">5.9.9. passenger_pre_start <url></h4>
|
3002
3130
|
<div class="paragraph"><p>By default, Phusion Passenger does not start any application processes until said
|
3003
3131
|
web application is first accessed. The result is that the first visitor of said
|
3004
3132
|
web application might experience a small delay as Phusion Passenger is starting
|
3005
3133
|
the web application on demand. If that is undesirable, then this directive can be
|
3006
3134
|
used to pre-started application processes during Nginx startup.</p></div>
|
3007
3135
|
<div class="paragraph"><p>A few things to be careful of:</p></div>
|
3008
|
-
<div class="ulist"><ul>
|
3136
|
+
<div class="ulist"><ul>
|
3009
3137
|
<li>
|
3010
3138
|
<p>
|
3011
3139
|
This directive accepts the <strong>URL</strong> of the web application you want to pre-start,
|
3012
3140
|
not a on/off value! This might seem a bit weird, but read on for rationale. As
|
3013
3141
|
for the specifics of the URL:
|
3014
3142
|
</p>
|
3015
|
-
<div class="ulist"><ul>
|
3143
|
+
<div class="ulist"><ul>
|
3016
3144
|
<li>
|
3017
3145
|
<p>
|
3018
3146
|
The domain part of the URL must be equal to the value of the <em>server_name</em>
|
@@ -3213,14 +3341,14 @@ the request ending up at a different web server in the cluster.</p></div>
|
|
3213
3341
|
</div>
|
3214
3342
|
</div>
|
3215
3343
|
<div class="sect2">
|
3216
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3344
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_logging_and_debugging_options"></span><h3 data-comment-topic="logging-and-debugging-options-14e91ni" data-anchor="_logging_and_debugging_options">5.10. Logging and debugging options</h3>
|
3217
3345
|
<div class="sect3">
|
3218
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3346
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_log_level_lt_integer_gt"></span><h4 data-comment-topic="passenger-log-level-integer--17snhon" data-anchor="_passenger_log_level_lt_integer_gt">5.10.1. passenger_log_level <integer></h4>
|
3219
3347
|
<div class="paragraph"><p>This option allows one to specify how much information Phusion Passenger should
|
3220
3348
|
write to the Nginx error log file. A higher log level value means that more
|
3221
3349
|
information will be logged.</p></div>
|
3222
3350
|
<div class="paragraph"><p>Possible values are:</p></div>
|
3223
|
-
<div class="ulist"><ul>
|
3351
|
+
<div class="ulist"><ul>
|
3224
3352
|
<li>
|
3225
3353
|
<p>
|
3226
3354
|
<em>0</em>: Show only errors and warnings.
|
@@ -3248,14 +3376,14 @@ information will be logged.</p></div>
|
|
3248
3376
|
The default is <em>0</em>.</p></div>
|
3249
3377
|
</div>
|
3250
3378
|
<div class="sect3">
|
3251
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3379
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_debug_log_file_lt_filename_gt"></span><h4 data-comment-topic="passenger-debug-log-file-filename--21ubaj" data-anchor="_passenger_debug_log_file_lt_filename_gt">5.10.2. passenger_debug_log_file <filename></h4>
|
3252
3380
|
<div class="paragraph"><p>By default Phusion Passenger debugging and error messages are written to the global
|
3253
3381
|
web server error log. This option allows one to specify the file that debugging and
|
3254
3382
|
error messages should be written to instead.</p></div>
|
3255
3383
|
<div class="paragraph"><p>This option may only occur once, in the <em>http</em> configuration block.</p></div>
|
3256
3384
|
</div>
|
3257
3385
|
<div class="sect3">
|
3258
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3386
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_passenger_debugger_lt_on_off_gt"></span><h4 data-comment-topic="passenger-debugger-on-off--1wkuq85" data-anchor="_passenger_debugger_lt_on_off_gt">5.10.3. passenger_debugger <on|off></h4>
|
3259
3387
|
<div class="paragraph"><p><strong>This feature is only available in <a href="https://www.phusionpassenger.com/enterprise">Phusion Passenger Enterprise</a>. It was introduced in version 3.0.0. <a href="https://www.phusionpassenger.com/download">Buy Phusion Passenger Enterprise here.</a></strong></p></div>
|
3260
3388
|
<div class="paragraph"><p>Turns support for application debugging on or off. In case of Ruby applications,
|
3261
3389
|
turning this option on will cause them to load the <span class="monospaced">ruby-debug</span> gem (when on Ruby 1.8)
|
@@ -3269,7 +3397,7 @@ gem 'debugger', :platforms => :ruby_19</pre>
|
|
3269
3397
|
</div>
|
3270
3398
|
<div class="paragraph"><p>Once debugging is turned on, you can use the command <span class="monospaced">passenger-irb --debug <PID></span> to attach an rdebug console to the application process with the given PID. Attaching will succeed once the application process executes a <span class="monospaced">debugger</span> command.</p></div>
|
3271
3399
|
<div class="paragraph"><p>This option may occur in the following places:</p></div>
|
3272
|
-
<div class="ulist"><ul>
|
3400
|
+
<div class="ulist"><ul>
|
3273
3401
|
<li>
|
3274
3402
|
<p>
|
3275
3403
|
In the <em>http</em> configuration block.
|
@@ -3295,12 +3423,12 @@ In an <em>if</em> configuration scope.
|
|
3295
3423
|
</div>
|
3296
3424
|
</div>
|
3297
3425
|
<div class="sect2">
|
3298
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3426
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_ruby_on_rails_specific_options"></span><h3 data-comment-topic="ruby-on-rails-specific-options-12vfokt" data-anchor="_ruby_on_rails_specific_options">5.11. Ruby on Rails-specific options</h3>
|
3299
3427
|
<div class="sect3">
|
3300
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3428
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="RailsEnv"></span><h4 data-comment-topic="rails-env-string--jlh7v9" data-anchor="RailsEnv">5.11.1. rails_env <string></h4>
|
3301
3429
|
<div class="paragraph"><p>This option allows one to specify the default <span class="monospaced">RAILS_ENV</span> value.</p></div>
|
3302
3430
|
<div class="paragraph"><p>This option may occur in the following places:</p></div>
|
3303
|
-
<div class="ulist"><ul>
|
3431
|
+
<div class="ulist"><ul>
|
3304
3432
|
<li>
|
3305
3433
|
<p>
|
3306
3434
|
In the <em>http</em> configuration block.
|
@@ -3325,7 +3453,7 @@ In an <em>if</em> configuration scope.
|
|
3325
3453
|
<div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>production</em>.</p></div>
|
3326
3454
|
</div>
|
3327
3455
|
<div class="sect3">
|
3328
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3456
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_rails_framework_spawner_idle_time_lt_integer_gt"></span><h4 data-comment-topic="rails-framework-spawner-idle-time-integer--q5ljd5" data-anchor="_rails_framework_spawner_idle_time_lt_integer_gt">5.11.2. rails_framework_spawner_idle_time <integer></h4>
|
3329
3457
|
<div class="paragraph"><p>The FrameworkSpawner server (explained in <a href="#spawning_methods_explained">Spawning methods explained</a>) has an idle timeout, just like the backend processes spawned by
|
3330
3458
|
Phusion Passenger do. That is, it will automatically shutdown if it hasn’t done
|
3331
3459
|
anything for a given period.</p></div>
|
@@ -3339,7 +3467,7 @@ you’re using the <em>smart</em> <a href="#RailsSpawnMethod">spawning method</a
|
|
3339
3467
|
system has enough memory, is it recommended that you set this option to a high
|
3340
3468
|
value or to <em>0</em>.</p></div>
|
3341
3469
|
<div class="paragraph"><p>This option may occur in the following places:</p></div>
|
3342
|
-
<div class="ulist"><ul>
|
3470
|
+
<div class="ulist"><ul>
|
3343
3471
|
<li>
|
3344
3472
|
<p>
|
3345
3473
|
In the <em>http</em> configuration block.
|
@@ -3364,7 +3492,7 @@ In an <em>if</em> configuration scope.
|
|
3364
3492
|
<div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>1800</em> (30 minutes).</p></div>
|
3365
3493
|
</div>
|
3366
3494
|
<div class="sect3">
|
3367
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3495
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_rails_app_spawner_idle_time_lt_integer_gt"></span><h4 data-comment-topic="rails-app-spawner-idle-time-integer--1xjqe4b" data-anchor="_rails_app_spawner_idle_time_lt_integer_gt">5.11.3. rails_app_spawner_idle_time <integer></h4>
|
3368
3496
|
<div class="paragraph"><p>The ApplicationSpawner server (explained in <a href="#spawning_methods_explained">Spawning methods explained</a>) has an idle timeout, just like the backend processes spawned by
|
3369
3497
|
Phusion Passenger do. That is, it will automatically shutdown if it hasn’t done
|
3370
3498
|
anything for a given period.</p></div>
|
@@ -3378,7 +3506,7 @@ you’re using the <em>smart</em> or <em>smart-lv2</em> <a href="#RailsSpawnMeth
|
|
3378
3506
|
system has enough memory, is it recommended that you set this option to a high
|
3379
3507
|
value or to <em>0</em>.</p></div>
|
3380
3508
|
<div class="paragraph"><p>This option may occur in the following places:</p></div>
|
3381
|
-
<div class="ulist"><ul>
|
3509
|
+
<div class="ulist"><ul>
|
3382
3510
|
<li>
|
3383
3511
|
<p>
|
3384
3512
|
In the <em>http</em> configuration block.
|
@@ -3404,12 +3532,12 @@ In an <em>if</em> configuration scope.
|
|
3404
3532
|
</div>
|
3405
3533
|
</div>
|
3406
3534
|
<div class="sect2">
|
3407
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3535
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_rack_and_rails_gt_3_specific_options"></span><h3 data-comment-topic="rack-specific-options-13yvdxs" data-anchor="_rack_and_rails_gt_3_specific_options">5.12. Rack and Rails >= 3 specific options</h3>
|
3408
3536
|
<div class="sect3">
|
3409
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3537
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="RackEnv"></span><h4 data-comment-topic="rack-env-string--tqmrt0" data-anchor="RackEnv">5.12.1. rack_env <string></h4>
|
3410
3538
|
<div class="paragraph"><p>This option allows one to specify the default <span class="monospaced">RACK_ENV</span> value.</p></div>
|
3411
3539
|
<div class="paragraph"><p>This option may occur in the following places:</p></div>
|
3412
|
-
<div class="ulist"><ul>
|
3540
|
+
<div class="ulist"><ul>
|
3413
3541
|
<li>
|
3414
3542
|
<p>
|
3415
3543
|
In the <em>http</em> configuration block.
|
@@ -3435,23 +3563,23 @@ In an <em>if</em> configuration scope.
|
|
3435
3563
|
</div>
|
3436
3564
|
</div>
|
3437
3565
|
<div class="sect2">
|
3438
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3566
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_deprecated_options"></span><h3 data-comment-topic="deprecated-options-1dtzo0g" data-anchor="_deprecated_options">5.13. Deprecated options</h3>
|
3439
3567
|
<div class="paragraph"><p>The following options have been deprecated, but are still supported for backwards
|
3440
3568
|
compatibility reasons.</p></div>
|
3441
3569
|
<div class="sect3">
|
3442
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3570
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_rails_spawn_method"></span><h4 data-comment-topic="rails-spawn-method-17vdnpt" data-anchor="_rails_spawn_method">5.13.1. rails_spawn_method</h4>
|
3443
3571
|
<div class="paragraph"><p>Deprecated in favor of <a href="#PassengerSpawnMethod">passenger_spawn_method</a>.</p></div>
|
3444
3572
|
</div>
|
3445
3573
|
</div>
|
3446
3574
|
</div>
|
3447
3575
|
</div>
|
3448
3576
|
<div class="sect1">
|
3449
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3577
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_analysis_and_system_maintenance"></span><h2 data-comment-topic="analysis-and-system-maintenance-1nnlnj8" data-anchor="_analysis_and_system_maintenance">6. Analysis and system maintenance</h2>
|
3450
3578
|
<div class="sectionbody">
|
3451
3579
|
<div class="paragraph"><p>Phusion Passenger provides a set of tools, which are useful for system analysis,
|
3452
3580
|
maintenance and troubleshooting.</p></div>
|
3453
3581
|
<div class="sect2">
|
3454
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3582
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_inspecting_memory_usage"></span><h3 data-comment-topic="inspecting-memory-usage-1k6y8v0" data-anchor="_inspecting_memory_usage">6.1. Inspecting memory usage</h3>
|
3455
3583
|
<div class="paragraph"><p>Process inspection tools such as <span class="monospaced">ps</span> and <span class="monospaced">top</span> are useful, but they
|
3456
3584
|
<a href="http://groups.google.com/group/phusion-passenger/msg/1fd1c233456d3180">rarely show the correct memory usage</a>.
|
3457
3585
|
The real memory usage is usually lower than what <span class="monospaced">ps</span> and <span class="monospaced">top</span> report.</p></div>
|
@@ -3493,18 +3621,18 @@ we see that all the Apache worker processes only take less than 1 MB memory each
|
|
3493
3621
|
This is a lot less than the 50 MB-ish memory usage as shown in the <em>VMSize</em> column
|
3494
3622
|
(which is what a lot of people think is the real memory usage, but is actually not).</p></div>
|
3495
3623
|
<div class="admonitionblock">
|
3496
|
-
<table><tr>
|
3624
|
+
<table><tr>
|
3497
3625
|
<td class="icon">
|
3498
|
-
<img src="./images/icons/note.png" alt="Note">
|
3626
|
+
<img src="./images/icons/note.png" alt="Note">
|
3499
3627
|
</td>
|
3500
3628
|
<td class="content">Private dirty RSS reporting only works on Linux. Unfortunately other operating systems
|
3501
3629
|
don’t provide facilities for determining processes' private dirty RSS. On non-Linux systems,
|
3502
3630
|
the Resident Set Size is reported instead.</td>
|
3503
|
-
</tr></table>
|
3631
|
+
</tr></table>
|
3504
3632
|
</div>
|
3505
3633
|
</div>
|
3506
3634
|
<div class="sect2">
|
3507
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3635
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_inspecting_phusion_passenger_8217_s_internal_status"></span><h3 data-comment-topic="inspecting-phusion-passenger-s-internal-status-v36wbc" data-anchor="_inspecting_phusion_passenger_8217_s_internal_status">6.2. Inspecting Phusion Passenger’s internal status</h3>
|
3508
3636
|
<div class="paragraph"><p>One can inspect Phusion Passenger’s internal status with the tool <span class="monospaced">passenger-status</span>.
|
3509
3637
|
This tool must typically be run as root. For example:</p></div>
|
3510
3638
|
<div class="listingblock">
|
@@ -3522,7 +3650,7 @@ inactive = 1
|
|
3522
3650
|
</div>
|
3523
3651
|
</div>
|
3524
3652
|
<div class="paragraph"><p>The <em>general information</em> section shows the following information:</p></div>
|
3525
|
-
<div class="dlist"><dl>
|
3653
|
+
<div class="dlist"><dl>
|
3526
3654
|
<dt class="hdlist1">
|
3527
3655
|
max
|
3528
3656
|
</dt>
|
@@ -3566,7 +3694,7 @@ time). The value of <em>inactive</em> equals <span class="monospaced">count - ac
|
|
3566
3694
|
</dl></div>
|
3567
3695
|
<div class="paragraph"><p>The <em>domains</em> section shows, for each application directory, information about running
|
3568
3696
|
application instances:</p></div>
|
3569
|
-
<div class="dlist"><dl>
|
3697
|
+
<div class="dlist"><dl>
|
3570
3698
|
<dt class="hdlist1">
|
3571
3699
|
Sessions
|
3572
3700
|
</dt>
|
@@ -3619,7 +3747,7 @@ sessions compared to the others, then there might be a problem:</p></div>
|
|
3619
3747
|
</div>
|
3620
3748
|
</div>
|
3621
3749
|
<div class="paragraph"><p>Possible reasons why spikes can occur:</p></div>
|
3622
|
-
<div class="olist arabic"><ol class="arabic">
|
3750
|
+
<div class="olist arabic"><ol class="arabic">
|
3623
3751
|
<li>
|
3624
3752
|
<p>
|
3625
3753
|
Your application is busy processing a request that takes a very long time.
|
@@ -3636,7 +3764,7 @@ Your application is frozen, i.e. has stopped responding. See
|
|
3636
3764
|
</ol></div>
|
3637
3765
|
</div>
|
3638
3766
|
<div class="sect2">
|
3639
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3767
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="debugging_frozen"></span><h3 data-comment-topic="debugging-frozen-applications-qoctl8" data-anchor="debugging_frozen">6.3. Debugging frozen applications</h3>
|
3640
3768
|
<div class="paragraph"><p>If one of your application instances is frozen (stopped responding), then you
|
3641
3769
|
can figure out where it is frozen by killing it with <em>SIGABRT</em>. This will cause the
|
3642
3770
|
application to raise an exception, with a backtrace.</p></div>
|
@@ -3648,22 +3776,22 @@ This is the case with Ruby on Rails. So if you kill a Ruby on Rails application
|
|
3648
3776
|
running it in a <em>production</em> environment). If you don’t see a backtrace there, check
|
3649
3777
|
the Apache error log.</p></div>
|
3650
3778
|
<div class="admonitionblock">
|
3651
|
-
<table><tr>
|
3779
|
+
<table><tr>
|
3652
3780
|
<td class="icon">
|
3653
|
-
<img src="./images/icons/note.png" alt="Note">
|
3781
|
+
<img src="./images/icons/note.png" alt="Note">
|
3654
3782
|
</td>
|
3655
3783
|
<td class="content">It is safe to kill application instances, even in live environments. Phusion Passenger
|
3656
3784
|
will restart killed application instances, as if nothing bad happened.</td>
|
3657
|
-
</tr></table>
|
3785
|
+
</tr></table>
|
3658
3786
|
</div>
|
3659
3787
|
</div>
|
3660
3788
|
<div class="sect2">
|
3661
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3789
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_accessing_individual_application_processes"></span><h3 data-comment-topic="accessing-individual-application-processes-1qe4fqk" data-anchor="_accessing_individual_application_processes">6.4. Accessing individual application processes</h3>
|
3662
3790
|
<div class="paragraph"><p>When a request is sent to the web server, Phusion Passenger will automatically forward
|
3663
3791
|
the request to the most suitable application process, but sometimes it is desirable to
|
3664
3792
|
be able to directly access the individual application processes. Use cases include, but
|
3665
3793
|
are not limited to:</p></div>
|
3666
|
-
<div class="ulist"><ul>
|
3794
|
+
<div class="ulist"><ul>
|
3667
3795
|
<li>
|
3668
3796
|
<p>
|
3669
3797
|
One wants to debug a memory leak or memory bloat problem that only seems to appear on
|
@@ -3724,17 +3852,17 @@ through the <em>X-Passenger-Connect-Password</em> HTTP header, like this:</p></d
|
|
3724
3852
|
</div>
|
3725
3853
|
</div>
|
3726
3854
|
<div class="sect2">
|
3727
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3855
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_attaching_an_irb_console_to_an_application_process"></span><h3 data-comment-topic="attaching-an-irb-console-to-an-application-process-d36enw" data-anchor="_attaching_an_irb_console_to_an_application_process">6.5. Attaching an IRB console to an application process</h3>
|
3728
3856
|
<div class="paragraph"><p><strong>Available in Phusion Passenger Enterprise since version 3.0.0.</strong></p></div>
|
3729
3857
|
<div class="paragraph"><p>You can attach an IRB console to any application process and inspect its state by executing arbitrary Ruby code. Do this by invoking <span class="monospaced">passenger-irb <PID></span> where <em><PID></em> is the PID of the application process you wish to inspect. Note that the IRB console is currently only available for Ruby apps, not for apps in any other languages.</p></div>
|
3730
3858
|
</div>
|
3731
3859
|
</div>
|
3732
3860
|
</div>
|
3733
3861
|
<div class="sect1">
|
3734
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3862
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_tips"></span><h2 data-comment-topic="tips-n4c22d" data-anchor="_tips">7. Tips</h2>
|
3735
3863
|
<div class="sectionbody">
|
3736
3864
|
<div class="sect2">
|
3737
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3865
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="user_switching"></span><h3 data-comment-topic="user-switching-security--zmsy9o" data-anchor="user_switching">7.1. User switching (security)</h3>
|
3738
3866
|
<div class="paragraph"><p>There is a problem that plagues most PHP web hosts, namely the fact that all PHP
|
3739
3867
|
applications are run in the same user context as the web server. So for
|
3740
3868
|
example, Joe’s PHP application will be able to read Jane’s PHP application’s
|
@@ -3746,7 +3874,7 @@ So if <em>/home/webapps/foo/config/environment.rb</em> is owned by <em>joe</em>,
|
|
3746
3874
|
Passenger will launch the corresponding Rails application as <em>joe</em> as well.</p></div>
|
3747
3875
|
<div class="paragraph"><p>This behavior is the default, and you don’t need to configure anything. But
|
3748
3876
|
there are things that you should keep in mind:</p></div>
|
3749
|
-
<div class="ulist"><ul>
|
3877
|
+
<div class="ulist"><ul>
|
3750
3878
|
<li>
|
3751
3879
|
<p>
|
3752
3880
|
The owner of <em>environment.rb</em>/<em>config.ru</em> must have read access to the application’s
|
@@ -3774,14 +3902,14 @@ Under no circumstances will applications be run as <em>root</em>. If
|
|
3774
3902
|
option.</p></div>
|
3775
3903
|
</div>
|
3776
3904
|
<div class="sect2">
|
3777
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3905
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="reducing_memory_usage"></span><h3 data-comment-topic="reducing-memory-consumption-of-ruby-on-rails-applications-by-33--1o3z66q" data-anchor="reducing_memory_usage">7.2. Reducing memory consumption of Ruby on Rails applications by 33%</h3>
|
3778
3906
|
<div class="paragraph"><p>Is it possible to reduce memory consumption of your Rails applications by 33% on average,
|
3779
3907
|
by using <a href="http://www.rubyenterpriseedition.com/">Ruby Enterprise Edition</a>.
|
3780
3908
|
Please visit the website for details.</p></div>
|
3781
3909
|
<div class="paragraph"><p>Note that this feature does not apply to Rack applications.</p></div>
|
3782
3910
|
</div>
|
3783
3911
|
<div class="sect2">
|
3784
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3912
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="capistrano"></span><h3 data-comment-topic="capistrano-recipe-pfn4qu" data-anchor="capistrano">7.3. Capistrano recipe</h3>
|
3785
3913
|
<div class="paragraph"><p>Phusion Passenger can be combined with <a href="http://capify.org/">Capistrano</a>.
|
3786
3914
|
The following Capistrano recipe demonstrates Phusion Passenger support.
|
3787
3915
|
It assumes that you’re using Git as version control system.</p></div>
|
@@ -3816,10 +3944,10 @@ end</pre>
|
|
3816
3944
|
</div>
|
3817
3945
|
</div>
|
3818
3946
|
<div class="sect2">
|
3819
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3947
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="bundler_support"></span><h3 data-comment-topic="bundler-support-19v1h43" data-anchor="bundler_support">7.4. Bundler support</h3>
|
3820
3948
|
<div class="paragraph"><p>Phusion Passenger has automatic support for <a href="http://gembundler.com/git.html">Bundler</a>.
|
3821
3949
|
It works as follows:</p></div>
|
3822
|
-
<div class="ulist"><ul>
|
3950
|
+
<div class="ulist"><ul>
|
3823
3951
|
<li>
|
3824
3952
|
<p>
|
3825
3953
|
If you have a <em>.bundle/environment.rb</em> in your application root, then Phusion
|
@@ -3849,10 +3977,10 @@ the application startup file. In this file you can do whatever you need to setup
|
|
3849
3977
|
or a similar system.</p></div>
|
3850
3978
|
</div>
|
3851
3979
|
<div class="sect2">
|
3852
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
3980
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="moving_phusion_passenger"></span><h3 data-comment-topic="moving-phusion-passenger-to-a-different-directory-1hel5cp" data-anchor="moving_phusion_passenger">7.5. Moving Phusion Passenger to a different directory</h3>
|
3853
3981
|
<div class="paragraph"><p>It is possible to relocate the Phusion Passenger files to a different directory. It
|
3854
3982
|
involves two steps:</p></div>
|
3855
|
-
<div class="olist arabic"><ol class="arabic">
|
3983
|
+
<div class="olist arabic"><ol class="arabic">
|
3856
3984
|
<li>
|
3857
3985
|
<p>
|
3858
3986
|
Moving the directory.
|
@@ -3866,7 +3994,7 @@ Updating the “PassengerRoot” configuration option in Apache.
|
|
3866
3994
|
</ol></div>
|
3867
3995
|
<div class="paragraph"><p>For example, if Phusion Passenger is located in <em>/opt/passenger/</em>, and you’d like to
|
3868
3996
|
move it to <em>/usr/local/passenger/</em>, then do this:</p></div>
|
3869
|
-
<div class="olist arabic"><ol class="arabic">
|
3997
|
+
<div class="olist arabic"><ol class="arabic">
|
3870
3998
|
<li>
|
3871
3999
|
<p>
|
3872
4000
|
Run the following command:
|
@@ -3890,7 +4018,7 @@ Edit your Apache configuration file, and set:
|
|
3890
4018
|
</ol></div>
|
3891
4019
|
</div>
|
3892
4020
|
<div class="sect2">
|
3893
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
4021
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_installing_multiple_ruby_on_rails_versions"></span><h3 data-comment-topic="installing-multiple-ruby-on-rails-versions-1bp1fff" data-anchor="_installing_multiple_ruby_on_rails_versions">7.6. Installing multiple Ruby on Rails versions</h3>
|
3894
4022
|
<div class="paragraph"><p>Each Ruby on Rails applications that are going to be deployed may require a
|
3895
4023
|
specific Ruby on Rails version. You can install a specific version with
|
3896
4024
|
this command:</p></div>
|
@@ -3904,7 +4032,7 @@ this command:</p></div>
|
|
3904
4032
|
other. Phusion Passenger will automatically make use of the correct version.</p></div>
|
3905
4033
|
</div>
|
3906
4034
|
<div class="sect2">
|
3907
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
4035
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_making_the_application_restart_after_each_request"></span><h3 data-comment-topic="making-the-application-restart-after-each-request-vimy48" data-anchor="_making_the_application_restart_after_each_request">7.7. Making the application restart after each request</h3>
|
3908
4036
|
<div class="paragraph"><p>In some situations it might be desirable to restart the web application after
|
3909
4037
|
each request, for example when developing a non-Rails application that doesn’t
|
3910
4038
|
support code reloading, or when developing a web framework.</p></div>
|
@@ -3913,9 +4041,9 @@ application’s root folder. Unlike <em>restart.txt</em>, Phusion Passenger does
|
|
3913
4041
|
check for this file’s timestamp: Phusion Passenger will always restart the
|
3914
4042
|
application, as long as <em>always_restart.txt</em> exists.</p></div>
|
3915
4043
|
<div class="admonitionblock">
|
3916
|
-
<table><tr>
|
4044
|
+
<table><tr>
|
3917
4045
|
<td class="icon">
|
3918
|
-
<img src="./images/icons/note.png" alt="Note">
|
4046
|
+
<img src="./images/icons/note.png" alt="Note">
|
3919
4047
|
</td>
|
3920
4048
|
<td class="content">If you’re just developing a Rails application then you probably don’t need
|
3921
4049
|
this feature. If you set <em>RailsEnv development</em> in your Apache configuration,
|
@@ -3923,11 +4051,11 @@ then Rails will automatically reload your application code after each request.
|
|
3923
4051
|
<em>always_restart.txt</em> is only useful if you’re working on Ruby on Rails itself,
|
3924
4052
|
or when you’re not developing a Rails application and your web framework
|
3925
4053
|
does not support code reloading.</td>
|
3926
|
-
</tr></table>
|
4054
|
+
</tr></table>
|
3927
4055
|
</div>
|
3928
4056
|
</div>
|
3929
4057
|
<div class="sect2">
|
3930
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
4058
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="sub_uri_deployment_uri_fix"></span><h3 data-comment-topic="how-to-fix-broken-images-css-javascript-uris-in-sub-uri-deployments-11mzwt6" data-anchor="sub_uri_deployment_uri_fix">7.8. How to fix broken images/CSS/JavaScript URIs in sub-URI deployments</h3>
|
3931
4059
|
<div class="paragraph"><p>Some people experience broken images and other broken static assets when they
|
3932
4060
|
deploy their application to a sub-URI (i.e. <em>http://mysite.com/railsapp/</em>).
|
3933
4061
|
The reason for this usually is that you used a
|
@@ -3967,13 +4095,13 @@ please refer to
|
|
3967
4095
|
</div>
|
3968
4096
|
</div>
|
3969
4097
|
<div class="sect1">
|
3970
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
4098
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_under_the_hood"></span><h2 data-comment-topic="under-the-hood-8uney" data-anchor="_under_the_hood">8. Under the hood</h2>
|
3971
4099
|
<div class="sectionbody">
|
3972
4100
|
<div class="paragraph"><p>Phusion Passenger hides a lot of complexity for the end user (i.e. the web server
|
3973
4101
|
system administrator), but sometimes it is desirable to know what is going on.
|
3974
4102
|
This section describes a few things that Phusion Passenger does under the hood.</p></div>
|
3975
4103
|
<div class="sect2">
|
3976
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
4104
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_page_caching_support"></span><h3 data-comment-topic="page-caching-support-nafhf6" data-anchor="_page_caching_support">8.1. Page caching support</h3>
|
3977
4105
|
<div class="paragraph"><p>For each HTTP request, Phusion Passenger will automatically look for a corresponding
|
3978
4106
|
page cache file, and serve that if it exists. It does this by appending ".html" to
|
3979
4107
|
the filename that the URI normally maps to, and checking whether that file exists.
|
@@ -3981,7 +4109,7 @@ This check occurs after checking whether the original mapped filename exists (as
|
|
3981
4109
|
of static asset serving). All this is done without the need for special mod_rewrite
|
3982
4110
|
rules.</p></div>
|
3983
4111
|
<div class="paragraph"><p>For example, suppose that the browser requests <em>/foo/bar</em>.</p></div>
|
3984
|
-
<div class="olist arabic"><ol class="arabic">
|
4112
|
+
<div class="olist arabic"><ol class="arabic">
|
3985
4113
|
<li>
|
3986
4114
|
<p>
|
3987
4115
|
Phusion Passenger will first check whether this URI maps to a static file, i.e.
|
@@ -4009,7 +4137,7 @@ the <em>public</em> directory. In that case you’ll need to use mod_rewrite to
|
|
4009
4137
|
page cache files.</p></div>
|
4010
4138
|
</div>
|
4011
4139
|
<div class="sect2">
|
4012
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
4140
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="application_detection"></span><h3 data-comment-topic="how-phusion-passenger-detects-whether-a-virtual-host-is-a-web-application-13qbmhn" data-anchor="application_detection">8.2. How Phusion Passenger detects whether a virtual host is a web application</h3>
|
4013
4141
|
<div class="paragraph"><p>After you’ve read the deployment instructions you might wonder how Phusion Passenger
|
4014
4142
|
knows that the server root points to a web application that Phusion Passenger is
|
4015
4143
|
able to serve, and how it knows what kind of web application it is (e.g. Rails or Rack).</p></div>
|
@@ -4022,7 +4150,7 @@ whether the following file exists:</p></div>
|
|
4022
4150
|
</div>
|
4023
4151
|
<div class="paragraph"><p>If you’re not a programmer and don’t understand the above pseudo-code snippet, it means
|
4024
4152
|
that Phusion Passenger will:</p></div>
|
4025
|
-
<div class="olist arabic"><ol class="arabic">
|
4153
|
+
<div class="olist arabic"><ol class="arabic">
|
4026
4154
|
<li>
|
4027
4155
|
<p>
|
4028
4156
|
Extract the parent directory filename from the value of the “root” directive.
|
@@ -4050,28 +4178,30 @@ Phusion Passenger will look for <em>config.ru</em> instead of <em>config/environ
|
|
4050
4178
|
</div>
|
4051
4179
|
</div>
|
4052
4180
|
<div class="sect1">
|
4053
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
4181
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_appendix_a_about_this_document"></span><h2 data-comment-topic="appendix-a-about-this-document-zfvixm" data-anchor="_appendix_a_about_this_document">9. Appendix A: About this document</h2>
|
4054
4182
|
<div class="sectionbody">
|
4055
4183
|
<div class="paragraph"><p>The text of this document is licensed under the
|
4056
4184
|
<a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons
|
4057
4185
|
Attribution-Share Alike 3.0 Unported License</a>.</p></div>
|
4058
4186
|
<div class="paragraph"><p><span class="image">
|
4059
4187
|
<a class="image" href="http://creativecommons.org/licenses/by-sa/3.0/">
|
4060
|
-
<img src="images/by_sa.png" alt="images/by_sa.png"
|
4188
|
+
<img src="images/by_sa.png" alt="images/by_sa.png">
|
4189
|
+
</a>
|
4061
4190
|
</span></p></div>
|
4062
4191
|
<div class="paragraph"><p>Phusion Passenger is brought to you by <a href="http://www.phusion.nl/">Phusion</a>.</p></div>
|
4063
4192
|
<div class="paragraph"><p><span class="image">
|
4064
4193
|
<a class="image" href="http://www.phusion.nl/">
|
4065
|
-
<img src="images/phusion_banner.png" alt="images/phusion_banner.png"
|
4194
|
+
<img src="images/phusion_banner.png" alt="images/phusion_banner.png">
|
4195
|
+
</a>
|
4066
4196
|
</span></p></div>
|
4067
4197
|
<div class="paragraph"><p>Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.</p></div>
|
4068
4198
|
</div>
|
4069
4199
|
</div>
|
4070
4200
|
<div class="sect1">
|
4071
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
4201
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_appendix_b_terminology"></span><h2 data-comment-topic="appendix-b-terminology-wzv5ro" data-anchor="_appendix_b_terminology">10. Appendix B: Terminology</h2>
|
4072
4202
|
<div class="sectionbody">
|
4073
4203
|
<div class="sect2">
|
4074
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
4204
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="application_root"></span><h3 data-comment-topic="application-root-1fd6bqv" data-anchor="application_root">10.1. Application root</h3>
|
4075
4205
|
<div class="paragraph"><p>The root directory of an application that’s served by Phusion Passenger.</p></div>
|
4076
4206
|
<div class="paragraph"><p>In case of Ruby on Rails applications, this is the directory that contains
|
4077
4207
|
<em>Rakefile</em>, <em>app/</em>, <em>config/</em>, <em>public/</em>, etc. In other words, the directory
|
@@ -4133,17 +4263,17 @@ For example, take the following directory structure:</p></div>
|
|
4133
4263
|
</div>
|
4134
4264
|
</div>
|
4135
4265
|
<div class="sect2">
|
4136
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
4266
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="idle_process"></span><h3 data-comment-topic="idle-process-13byfw9" data-anchor="idle_process">10.2. Idle process</h3>
|
4137
4267
|
<div class="paragraph"><p>An "idle process" refers to a process that hasn’t processed any requests for a while.</p></div>
|
4138
4268
|
</div>
|
4139
4269
|
<div class="sect2">
|
4140
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
4270
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="inactive_process"></span><h3 data-comment-topic="inactive-process-1d2h0po" data-anchor="inactive_process">10.3. Inactive process</h3>
|
4141
4271
|
<div class="paragraph"><p>An "inactive process" refers to a process that’s current not processing any requests. An idle process is always inactive, but an inactive process is not always considered idle.</p></div>
|
4142
4272
|
</div>
|
4143
4273
|
</div>
|
4144
4274
|
</div>
|
4145
4275
|
<div class="sect1">
|
4146
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
4276
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="spawning_methods_explained"></span><h2 data-comment-topic="appendix-c-spawning-methods-explained-tcp8e6" data-anchor="spawning_methods_explained">11. Appendix C: Spawning methods explained</h2>
|
4147
4277
|
<div class="sectionbody">
|
4148
4278
|
<div class="paragraph"><p>At its core, Phusion Passenger is an HTTP proxy and process manager. It spawns
|
4149
4279
|
Ruby on Rails/Rack/WSGI worker processes (which may also be referred to as
|
@@ -4153,7 +4283,7 @@ processes.</p></div>
|
|
4153
4283
|
Let’s go over the different spawning methods. For simplicity’s sake, let’s
|
4154
4284
|
assume that we’re only talking about Ruby on Rails applications.</p></div>
|
4155
4285
|
<div class="sect2">
|
4156
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
4286
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_the_most_straightforward_and_traditional_way_conservative_spawning"></span><h3 data-comment-topic="the-most-straightforward-and-traditional-way-conservative-spawning-civ29z" data-anchor="_the_most_straightforward_and_traditional_way_conservative_spawning">11.1. The most straightforward and traditional way: conservative spawning</h3>
|
4157
4287
|
<div class="paragraph"><p>Phusion Passenger could create a new Ruby process, which will then load the
|
4158
4288
|
Rails application along with the entire Rails framework. This process will then
|
4159
4289
|
enter an request handling main loop.</p></div>
|
@@ -4170,20 +4300,22 @@ other hand creates processes that reuse the already loaded Ruby interpreter. In
|
|
4170
4300
|
programmers jargon, Phusion Passenger calls fork(), but not exec().</p></div>
|
4171
4301
|
</div>
|
4172
4302
|
<div class="sect2">
|
4173
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
4303
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_the_smart_spawning_method"></span><h3 data-comment-topic="the-smart-spawning-method-7nhgtj" data-anchor="_the_smart_spawning_method">11.2. The smart spawning method</h3>
|
4174
4304
|
<div class="admonitionblock">
|
4175
|
-
<table><tr>
|
4305
|
+
<table><tr>
|
4176
4306
|
<td class="icon">
|
4177
|
-
<img src="./images/icons/note.png" alt="Note">
|
4307
|
+
<img src="./images/icons/note.png" alt="Note">
|
4178
4308
|
</td>
|
4179
4309
|
<td class="content">Smart spawning is supported for all Ruby applications but not for WSGI applications.</td>
|
4180
|
-
</tr></table>
|
4310
|
+
</tr></table>
|
4181
4311
|
</div>
|
4182
4312
|
<div class="paragraph"><p>While conservative spawning works well, it’s not as efficient as it could be
|
4183
4313
|
because each worker process has its own private copy of the Rails application
|
4184
4314
|
as well as the Rails framework. This wastes memory as well as startup time.</p></div>
|
4185
4315
|
<div class="paragraph"><p><span class="image">
|
4186
|
-
<img src="images/conservative_spawning.png" alt="Worker processes and conservative spawning"
|
4316
|
+
<img src="images/conservative_spawning.png" alt="Worker processes and conservative spawning">
|
4317
|
+
</span><br>
|
4318
|
+
<em>Figure: Worker processes and conservative spawning. Each worker process has its
|
4187
4319
|
own private copy of the application code and Rails framework code.</em></p></div>
|
4188
4320
|
<div class="paragraph"><p>It is possible to make the different worker processes share the memory occupied
|
4189
4321
|
by application and Rails framework code, by utilizing so-called
|
@@ -4191,7 +4323,7 @@ copy-on-write semantics of the virtual memory system on modern operating
|
|
4191
4323
|
systems. As a side effect, the startup time is also reduced. This is technique
|
4192
4324
|
is exploited by Phusion Passenger’s <em>smart</em> and <em>smart-lv2</em> spawn methods.</p></div>
|
4193
4325
|
<div class="sect3">
|
4194
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
4326
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_how_it_works"></span><h4 data-comment-topic="how-it-works-f9umga" data-anchor="_how_it_works">11.2.1. How it works</h4>
|
4195
4327
|
<div class="paragraph"><p>When the <em>smart-lv2</em> spawn method is being used, Phusion Passenger will first
|
4196
4328
|
create a so-called <em>ApplicationSpawner server</em> process. This process loads the
|
4197
4329
|
entire Rails application along with the Rails framework, by loading
|
@@ -4207,7 +4339,9 @@ processes will share as much common
|
|
4207
4339
|
memory as possible. That is, they will all share the same application and Rails
|
4208
4340
|
framework code.</p></div>
|
4209
4341
|
<div class="paragraph"><p><span class="image">
|
4210
|
-
<img src="images/smart-lv2.png" alt="images/smart-lv2.png"
|
4342
|
+
<img src="images/smart-lv2.png" alt="images/smart-lv2.png">
|
4343
|
+
</span><br>
|
4344
|
+
<em>Figure: Worker processes and the smart-lv2 spawn method. All worker processes,
|
4211
4345
|
as well as the ApplicationSpawner, share the same application code and Rails
|
4212
4346
|
framework code.</em></p></div>
|
4213
4347
|
<div class="paragraph"><p>The <em>smart</em> spawn method goes even further, by caching the Rails framework in
|
@@ -4222,7 +4356,7 @@ application to share memory. The <em>smart</em> method allows different worker
|
|
4222
4356
|
processes - that happen to use the same Rails version - to share memory, even if
|
4223
4357
|
they don’t belong to the same application.</p></div>
|
4224
4358
|
<div class="paragraph"><p>Notes:</p></div>
|
4225
|
-
<div class="ulist"><ul>
|
4359
|
+
<div class="ulist"><ul>
|
4226
4360
|
<li>
|
4227
4361
|
<p>
|
4228
4362
|
Vendored Rails frameworks cannot be shared by different applications, even if
|
@@ -4241,10 +4375,10 @@ ApplicationSpawner and FrameworkSpawner servers have an idle timeout just
|
|
4241
4375
|
</ul></div>
|
4242
4376
|
</div>
|
4243
4377
|
<div class="sect3">
|
4244
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
4378
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_summary_of_benefits"></span><h4 data-comment-topic="summary-of-benefits-qovyvk" data-anchor="_summary_of_benefits">11.2.2. Summary of benefits</h4>
|
4245
4379
|
<div class="paragraph"><p>Suppose that Phusion Passenger needs a new worker process for an application
|
4246
4380
|
that uses Rails 2.2.1.</p></div>
|
4247
|
-
<div class="ulist"><ul>
|
4381
|
+
<div class="ulist"><ul>
|
4248
4382
|
<li>
|
4249
4383
|
<p>
|
4250
4384
|
If the <em>smart-lv2</em> spawning method is used, and an ApplicationSpawner server
|
@@ -4278,7 +4412,7 @@ gotchas you can easily reap the benefits of smart spawning.</p></div>
|
|
4278
4412
|
</div>
|
4279
4413
|
</div>
|
4280
4414
|
<div class="sect2">
|
4281
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
4415
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_smart_spawning_gotcha_1_unintentional_file_descriptor_sharing"></span><h3 data-comment-topic="smart-spawning-gotcha-1-unintentional-file-descriptor-sharing-cebw6q" data-anchor="_smart_spawning_gotcha_1_unintentional_file_descriptor_sharing">11.3. Smart spawning gotcha #1: unintentional file descriptor sharing</h3>
|
4282
4416
|
<div class="paragraph"><p>Because worker processes are created by forking from an ApplicationSpawner
|
4283
4417
|
server, it will share all file descriptors that are opened by the
|
4284
4418
|
ApplicationSpawner server. (This is part of the semantics of the Unix
|
@@ -4314,7 +4448,7 @@ http://www.gnu.org/software/src-highlite -->
|
|
4314
4448
|
database upon creating a new worker process, which is why you normally do not
|
4315
4449
|
encounter any database issues when using smart spawning mode.</p></div>
|
4316
4450
|
<div class="sect3">
|
4317
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
4451
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_example_1_memcached_connection_sharing_harmful"></span><h4 data-comment-topic="example-1-memcached-connection-sharing-harmful--1wfs3ad" data-anchor="_example_1_memcached_connection_sharing_harmful">11.3.1. Example 1: Memcached connection sharing (harmful)</h4>
|
4318
4452
|
<div class="paragraph"><p>Suppose we have a Rails application that connects to a Memcached server in
|
4319
4453
|
<em>environment.rb</em>. This causes the ApplicationSpawner to have a socket connection
|
4320
4454
|
(file descriptor) to the Memcached server, as shown in the following figure:</p></div>
|
@@ -4413,7 +4547,7 @@ http://www.gnu.org/software/src-highlite -->
|
|
4413
4547
|
</div>
|
4414
4548
|
</div>
|
4415
4549
|
<div class="sect3">
|
4416
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
4550
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_example_2_log_file_sharing_not_harmful"></span><h4 data-comment-topic="example-2-log-file-sharing-not-harmful--ox4yfy" data-anchor="_example_2_log_file_sharing_not_harmful">11.3.2. Example 2: Log file sharing (not harmful)</h4>
|
4417
4551
|
<div class="paragraph"><p>There are also cases in which unintentional file descriptor sharing is not harmful.
|
4418
4552
|
One such case is log file file descriptor sharing. Even if two processes write
|
4419
4553
|
to the log file at the same time, the worst thing that can happen is that the
|
@@ -4425,7 +4559,7 @@ Memcached example, doesn’t help.</p></div>
|
|
4425
4559
|
</div>
|
4426
4560
|
</div>
|
4427
4561
|
<div class="sect2">
|
4428
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
4562
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_smart_spawning_gotcha_2_the_need_to_revive_threads"></span><h3 data-comment-topic="smart-spawning-gotcha-2-the-need-to-revive-threads-1ey176o" data-anchor="_smart_spawning_gotcha_2_the_need_to_revive_threads">11.4. Smart spawning gotcha #2: the need to revive threads</h3>
|
4429
4563
|
<div class="paragraph"><p>Another part of the <em>fork()</em> system call’s semantics is the fact that threads
|
4430
4564
|
disappear after a fork call. So if you’ve created any threads in environment.rb,
|
4431
4565
|
then those threads will no longer be running in newly created worker process.
|
@@ -4451,7 +4585,7 @@ http://www.gnu.org/software/src-highlite -->
|
|
4451
4585
|
</div>
|
4452
4586
|
</div>
|
4453
4587
|
<div class="sect2">
|
4454
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><
|
4588
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_smart_spawning_gotcha_3_code_load_order"></span><h3 data-comment-topic="smart-spawning-gotcha-3-code-load-order-12ydsn8" data-anchor="_smart_spawning_gotcha_3_code_load_order">11.5. Smart spawning gotcha #3: code load order</h3>
|
4455
4589
|
<div class="paragraph"><p>This gotcha is only applicable to the <em>smart</em> spawn method, not the <em>smart-lv2</em>
|
4456
4590
|
spawn method.</p></div>
|
4457
4591
|
<div class="paragraph"><p>If your application expects the Rails framework to be not loaded during the
|
@@ -4473,9 +4607,7 @@ has no effect.</p></div>
|
|
4473
4607
|
</div>
|
4474
4608
|
<div id="footnotes"><hr></div>
|
4475
4609
|
<div id="footer">
|
4476
|
-
|
4477
|
-
Last updated 2013-01-08 23:47:06 CET
|
4478
|
-
</div>
|
4610
|
+
|
4479
4611
|
</div>
|
4480
4612
|
<script>/*! jQuery v1.7.1 jquery.com | jquery.org/license */
|
4481
4613
|
(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function cb(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function ca(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bE.test(a)?d(a,e):ca(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)ca(a+"["+e+"]",b[e],c,d);else d(a,b)}function b_(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function b$(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bT,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=b$(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=b$(a,c,d,e,"*",g));return l}function bZ(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bP),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bC(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bx:by,g=0,h=e.length;if(d>0){if(c!=="border")for(;g<h;g++)c||(d-=parseFloat(f.css(a,"padding"+e[g]))||0),c==="margin"?d+=parseFloat(f.css(a,c+e[g]))||0:d-=parseFloat(f.css(a,"border"+e[g]+"Width"))||0;return d+"px"}d=bz(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0;if(c)for(;g<h;g++)d+=parseFloat(f.css(a,"padding"+e[g]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+e[g]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+e[g]))||0);return d+"px"}function bp(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c+(i[c][d].namespace?".":"")+i[c][d].namespace,i[c][d],i[c][d].data)}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?m(g):h==="function"&&(!a.unique||!o.has(g))&&c.push(g)},n=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,l=j||0,j=0,k=c.length;for(;c&&l<k;l++)if(c[l].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}i=!1,c&&(a.once?e===!0?o.disable():c=[]:d&&d.length&&(e=d.shift(),o.fireWith(e[0],e[1])))},o={add:function(){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){i&&f<=k&&(k--,f<=l&&l--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&o.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(i?a.once||d.push([b,c]):(!a.once||!e)&&n(b,c));return this},fire:function(){o.fireWith(this,arguments);return this},fired:function(){return!!e}};return o};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p,q=c.createElement("div"),r=c.documentElement;q.setAttribute("className","t"),q.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="<div "+n+"><div></div></div>"+"<table "+n+" cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="<div style='width:4px;'></div>",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h=null;if(typeof a=="undefined"){if(this.length){h=f.data(this[0]);if(this[0].nodeType===1&&!f._data(this[0],"parsedAttrs")){e=this[0].attributes;for(var i=0,j=e.length;i<j;i++)g=e[i].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),l(this[0],g,h[g]));f._data(this[0],"parsedAttrs",!0)}}return h}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split("."),d[1]=d[1]?"."+d[1]:"";if(c===b){h=this.triggerHandler("getData"+d[1]+"!",[d[0]]),h===b&&this.length&&(h=f.data(this[0],a),h=l(this[0],a,h));return h===b&&d[1]?this.data(d[0]):h}return this.each(function(){var b=f(this),e=[d[0],c];b.triggerHandler("setData"+d[1]+"!",e),f.data(this,a,c),b.triggerHandler("changeData"+d[1]+"!",e)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise()}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h<g;h++)e=d[h],e&&(c=f.propFix[e]||e,f.attr(a,e,""),a.removeAttribute(v?e:c),u.test(e)&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};
|
@@ -4812,6 +4944,7 @@ Mizuho.initializeTopBar = $.proxy(function() {
|
|
4812
4944
|
var isMobileDevice = this.isMobileDevice();
|
4813
4945
|
var timerId;
|
4814
4946
|
|
4947
|
+
// Create the floating table of contents used in the top bar.
|
4815
4948
|
var $floattoc = $('<div id="floattoc"></div>').html($('#toc').html());
|
4816
4949
|
$floattoc.find('#toctitle').remove();
|
4817
4950
|
$floattoc.find('.comments').remove();
|
@@ -4830,6 +4963,8 @@ Mizuho.initializeTopBar = $.proxy(function() {
|
|
4830
4963
|
self.internalLinkClicked(this, event);
|
4831
4964
|
});
|
4832
4965
|
|
4966
|
+
// Callback for when the user clicks on the Table of Contents
|
4967
|
+
// button on the top bar.
|
4833
4968
|
function showFloatingToc() {
|
4834
4969
|
var scrollUpdateTimerId;
|
4835
4970
|
|
@@ -4922,6 +5057,9 @@ Mizuho.initializeTopBar = $.proxy(function() {
|
|
4922
5057
|
$window.bind('scroll', onScroll);
|
4923
5058
|
}
|
4924
5059
|
|
5060
|
+
// Called whenever the user scrolls. Updates the title of the
|
5061
|
+
// Table of Contents button in the top bar to the section that
|
5062
|
+
// the user is currently reading.
|
4925
5063
|
function update() {
|
4926
5064
|
if ($title.offset().top + $title.height() < $document.scrollTop()) {
|
4927
5065
|
if (!$topbar.is(':visible')) {
|
@@ -4965,6 +5103,7 @@ Mizuho.initializeTopBar = $.proxy(function() {
|
|
4965
5103
|
}, 100);
|
4966
5104
|
}
|
4967
5105
|
|
5106
|
+
|
4968
5107
|
if (isMobileDevice) {
|
4969
5108
|
// Mobile devices don't support position fixed.
|
4970
5109
|
$topbar.css('position', 'absolute');
|
@@ -5148,5 +5287,5 @@ Mizuho.topicListReceived = $.proxy(function(result) {
|
|
5148
5287
|
$(document).ready(Mizuho.initializeCommenting);
|
5149
5288
|
|
5150
5289
|
</script>
|
5151
|
-
</body>
|
5290
|
+
</body>
|
5152
5291
|
</html>
|