~ubuntu-branches/ubuntu/wily/ruby-passenger/wily-proposed

« back to all changes in this revision

Viewing changes to doc/Users guide Standalone.html

  • Committer: Package Import Robot
  • Author(s): Felix Geyer
  • Date: 2013-11-23 23:50:02 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20131123235002-8fdhsq7afj15o2z2
Tags: 4.0.25-1
* New upstream release.
* Refresh fix_install_path.patch.
* Build for Ruby 2.0 instead of 1.8. (Closes: #725591)
* Add fix_ftbfs_fortify_source.patch.
* Install passenger template files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 Standalone users guide</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 Standalone users guide</title>
7
7
<style type="text/css">
8
8
/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
9
9
 
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.
797
797
}
798
798
asciidoc.install();
799
799
/*]]>*/
800
 
</script>
801
 
<style type="text/css">
 
800
</script><style type="text/css">
802
801
body {
803
802
        margin: 1em auto 1em auto;
804
803
        padding: 0 1em 0 1em;
1055
1054
}
1056
1055
 
1057
1056
</style>
1058
 
</head>
 
1057
</head>
1059
1058
<body class="article">
1060
1059
<div id="topbar" style="display: none">
1061
1060
        <div class="title">
1062
 
                <!-- Don't put a space between the img and a. That will break the hover layout. -->
1063
1061
                <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAKCAYAAAEV95QVAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sGCRMSACDxkZwAAAAidEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVAgb24gYSBNYWOHqHdDAAAAZUlEQVQY032PSxbAIAjEIlfygL6ePF3UUvpzNjgSYWwqAMEhUQnANnsC7TQPeJpsVWzMuh2sog4vDTUbqP081zECrW4dtdaQGSIKlWluPyjK+VXxAz5XfcKufCzA130AfQHWB30HZxlPaP080xsAAAAASUVORK5CYII=" width="11" height="10" alt=""><a href="javascript:void(Mizuho.smoothlyScrollToToc())">Phusion Passenger Standalone users guide</a>
1064
1062
        </div>
1065
1063
        <a href="javascript:void(0)" id="current_section"></a>
1070
1068
<div class="sectionbody">
1071
1069
<div class="paragraph"><p><span class="image">
1072
1070
<a class="image" href="http://www.phusion.nl/">
1073
 
<img src="images/phusion_banner.png" alt="images/phusion_banner.png">
1074
 
</a>
 
1071
<img src="images/phusion_banner.png" alt="images/phusion_banner.png"></a>
1075
1072
</span></p></div>
1076
 
<div class="paragraph"><p>Phusion Passenger Standalone is a web server that allows one to run Ruby web applications.
1077
 
Here are some of the highlights:</p></div>
1078
 
<div class="ulist"><ul>
1079
 
<li>
1080
 
<p>
1081
 
Unlike Phusion Passenger for Apache and Phusion Passenger for Nginx, Phusion Passenger
1082
 
  Standalone does not require an external web server, it is its own and therefore
1083
 
  extremely easy to get started.
1084
 
</p>
1085
 
</li>
1086
 
<li>
1087
 
<p>
1088
 
It is powered by an Nginx core. This allows it to serve static files at blazing speeds,
1089
 
  makes it secure enough to be directly attached to port 80, and allows it to handle slow
1090
 
  clients. You don’t need to have Nginx already installed.
1091
 
</p>
1092
 
</li>
1093
 
<li>
1094
 
<p>
1095
 
Automatically spawns and shuts down application processes. One Phusion Passenger
1096
 
  Standalone instance can therefore handle multiple simultaneous connections and handles
1097
 
  resource management for you. Crashing application processes are automatically restarted.
1098
 
</p>
1099
 
</li>
1100
 
<li>
1101
 
<p>
1102
 
Can listen on a Unix socket, for use in reverse proxy setups.
 
1073
<div class="paragraph"><p><a href="https://www.phusionpassenger.com/">Phusion Passenger</a> is a web server and application server, designed to be fast, robust and lightweight. It runs your web apps with the least amount of hassle by taking care of almost all administrative heavy lifting for you. Advanced administration tools allow you to gain deep insight into your web applications' operations and to keep your servers healthy. Phusion Passenger is polyglot by design, and currently supports Ruby (Rack), Python (WSGI) and Node.js.</p></div>
 
1074
<div class="paragraph"><p>In the Standalone mode, Phusion Passenger operates as a fully-featured, secure standalone HTTP server. You do not need to have an existing web server like Apache or Nginx. This mode is ideal…</p></div>
 
1075
<div class="ulist"><ul>
 
1076
<li>
 
1077
<p>
 
1078
…if you are not familiar with Apache or Nginx
 
1079
</p>
 
1080
</li>
 
1081
<li>
 
1082
<p>
 
1083
…when you want to quickly start up a server without editing configuration files (e.g. during development)
 
1084
</p>
 
1085
</li>
 
1086
<li>
 
1087
<p>
 
1088
…or when you want to decouple the web server from the application server, by setting up reverse proxies.
1103
1089
</p>
1104
1090
</li>
1105
1091
</ul></div>
1109
1095
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><div id="toctitle">Table of Contents</div>
1110
1096
<div class="foo toclevel2"><a href="#_support_information">1. Support information</a></div>
1111
1097
<div class="foo toclevel3"><a href="#_supported_operating_systems">1.1. Supported operating systems</a></div>
1112
 
<div class="foo toclevel3"><a href="#_where_to_get_support">1.2. Where to get support</a></div>
1113
 
<div class="foo toclevel2"><a href="#_installation">2. Installation</a></div>
 
1098
<div class="foo toclevel3"><a href="#where_to_get_support">1.2. Where to get support</a></div>
 
1099
<div class="foo toclevel2"><a href="#installation">2. Installation</a></div>
 
1100
<div class="foo toclevel3"><a href="#_synopsis">2.1. Synopsis</a></div>
 
1101
<div class="foo toclevel3"><a href="#install_osx_homebrew">2.2. Installing or upgrading on Mac OS X with Homebrew</a></div>
 
1102
<div class="foo toclevel3"><a href="#install_on_debian_ubuntu">2.3. Installing or upgrading on Debian or Ubuntu</a></div>
 
1103
<div class="foo toclevel4"><a href="#install_add_apt_repo">2.3.1. Adding our APT repository</a></div>
 
1104
<div class="foo toclevel4"><a href="#_installing_packages">2.3.2. Installing packages</a></div>
 
1105
<div class="foo toclevel3"><a href="#_installing_or_upgrading_on_red_hat_fedora_centos_or_scientificlinux">2.4. Installing or upgrading on Red Hat, Fedora, CentOS or ScientificLinux</a></div>
 
1106
<div class="foo toclevel3"><a href="#rubygems_generic_install">2.5. Generic installation, upgrade and downgrade method: via RubyGems</a></div>
 
1107
<div class="foo toclevel3"><a href="#tarball_generic_install">2.6. Generic installation, upgrade and downgrade method: via tarball</a></div>
 
1108
<div class="foo toclevel3"><a href="#_upgrading_from_open_source_to_enterprise">2.7. Upgrading from open source to Enterprise</a></div>
 
1109
<div class="foo toclevel3"><a href="#_cryptographic_verification_of_installation_files">2.8. Cryptographic verification of installation files</a></div>
 
1110
<div class="foo toclevel4"><a href="#_synopsis_2">2.8.1. Synopsis</a></div>
 
1111
<div class="foo toclevel4"><a href="#_importing_the_phusion_software_signing_key">2.8.2. Importing the Phusion Software Signing key</a></div>
 
1112
<div class="foo toclevel4"><a href="#_verifying_the_phusion_software_signing_key">2.8.3. Verifying the Phusion Software Signing key</a></div>
 
1113
<div class="foo toclevel4"><a href="#_verifying_the_gem_and_tarball">2.8.4. Verifying the gem and tarball</a></div>
 
1114
<div class="foo toclevel4"><a href="#_verifying_git_signatures">2.8.5. Verifying Git signatures</a></div>
 
1115
<div class="foo toclevel4"><a href="#_verifying_deb_and_rpm_packages">2.8.6. Verifying DEB and RPM packages</a></div>
 
1116
<div class="foo toclevel4"><a href="#_revocation">2.8.7. Revocation</a></div>
 
1117
<div class="foo toclevel3"><a href="#_customizing_the_compilation_process">2.9. Customizing the compilation process</a></div>
 
1118
<div class="foo toclevel4"><a href="#_setting_the_compiler">2.9.1. Setting the compiler</a></div>
 
1119
<div class="foo toclevel4"><a href="#_adding_additional_compiler_or_linker_flags">2.9.2. Adding additional compiler or linker flags</a></div>
 
1120
<div class="foo toclevel4"><a href="#_forcing_location_of_command_line_tools_and_dependencies">2.9.3. Forcing location of command line tools and dependencies</a></div>
 
1121
<div class="foo toclevel3"><a href="#uninstalling">2.10. Uninstalling</a></div>
 
1122
<div class="foo toclevel3"><a href="#moving_phusion_passenger">2.11. Moving to a different directory</a></div>
1114
1123
<div class="foo toclevel2"><a href="#_usage">3. Usage</a></div>
 
1124
<div class="foo toclevel2"><a href="#_configuration">4. Configuration</a></div>
 
1125
<div class="foo toclevel3"><a href="#_command_line_options">4.1. Command line options</a></div>
 
1126
<div class="foo toclevel3"><a href="#config_file">4.2. Configuration file</a></div>
 
1127
<div class="foo toclevel3"><a href="#_advanced_configuration">4.3. Advanced configuration</a></div>
 
1128
<div class="foo toclevel2"><a href="#_using_passenger_standalone_in_production">5. Using Passenger Standalone in production</a></div>
 
1129
<div class="foo toclevel3"><a href="#starting_at_system_boot">5.1. Starting Passenger Standalone at system boot</a></div>
 
1130
<div class="foo toclevel2"><a href="#mass_deployment">6. Mass deployment</a></div>
 
1131
<div class="foo toclevel2"><a href="#troubleshooting">7. Troubleshooting</a></div>
 
1132
<div class="foo toclevel3"><a href="#_generic_troubleshooting_tips">7.1. Generic troubleshooting tips</a></div>
 
1133
<div class="foo toclevel3"><a href="#_upon_uploading_a_file_phusion_passenger_reports_client_body_temp_00000000xx_failed_2_no_such_file_or_directory">7.2. Upon uploading a file, Phusion Passenger reports "client_body_temp/00000000xx failed (2: No such file or directory)"</a></div>
 
1134
<div class="foo toclevel2"><a href="#about_environment_variables">8. Appendix: About environment variables</a></div>
 
1135
<div class="foo toclevel3"><a href="#_working_with_environment_variables">8.1. Working with environment variables</a></div>
 
1136
<div class="foo toclevel3"><a href="#_the_path_environment_variable">8.2. The PATH environment variable</a></div>
 
1137
<div class="foo toclevel4"><a href="#_adding_phusion_passenger_8217_s_administration_tools_to_path">8.2.1. Adding Phusion Passenger’s administration tools to PATH</a></div>
 
1138
<div class="foo toclevel3"><a href="#_making_environment_variables_permanent">8.3. Making environment variables permanent</a></div>
 
1139
<div class="foo toclevel4"><a href="#_bash">8.3.1. bash</a></div>
 
1140
<div class="foo toclevel4"><a href="#_apache">8.3.2. Apache</a></div>
 
1141
<div class="foo toclevel4"><a href="#_nginx">8.3.3. Nginx</a></div>
 
1142
<div class="foo toclevel4"><a href="#_cron">8.3.4. cron</a></div>
 
1143
<div class="foo toclevel4"><a href="#env_vars_passenger_apps">8.3.5. Phusion Passenger-served apps</a></div>
 
1144
<div class="foo toclevel3"><a href="#env_vars_and_sudo">8.4. Environment variables and sudo</a></div>
1115
1145
</div>
1116
1146
</div>
1117
1147
<div id="content">
1134
1164
if it doesn’t work on your POSIX-compliant operating system.</p></div>
1135
1165
</div>
1136
1166
<div class="sect2">
1137
 
<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-xkx7rx" data-anchor="_where_to_get_support">1.2. Where to get support</h3>
1138
 
<div class="ulist"><ul>
 
1167
<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-xkx7rx" data-anchor="where_to_get_support">1.2. Where to get support</h3>
 
1168
<div class="ulist"><ul>
1139
1169
<li>
1140
1170
<p>
1141
 
<a href="http://groups.google.com/group/phusion-passenger">Discussion forum</a> - post a
 
1171
<a href="http://groups.google.com/group/phusion-passenger">Community discussion forum</a> - post a
1142
1172
  message here if you’re experiencing problems. Support on this forum is provided by the community on a best-effort basis, so a (timely) response is not guaranteed.
1143
1173
</p>
1144
1174
</li>
1169
1199
</div>
1170
1200
</div>
1171
1201
<div class="sect1">
1172
 
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_installation"></span><h2 data-comment-topic="installation-2vrmef" data-anchor="_installation">2. Installation</h2>
 
1202
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="installation"></span><h2 data-comment-topic="installation-2vrmef" data-anchor="installation">2. Installation</h2>
1173
1203
<div class="sectionbody">
 
1204
<div class="sect2">
 
1205
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_synopsis"></span><h3 data-comment-topic="synopsis-92sr34" data-anchor="_synopsis">2.1. Synopsis</h3>
 
1206
<div class="paragraph"><p>Because Phusion Passenger is designed to run in a wide variety of operating systems and configurations, there are multiple ways to install it. Most users  — especially first-time users — will prefer <em>OS-specific installation instructions</em>. These are not only the easiest, but also allow Phusion Passenger to integrate into the operating system in the best way possible. Other users should consult the <em>generic installation instructions</em>.</p></div>
 
1207
<div class="paragraph"><p>The steps for upgrading or downgrading Phusion Passenger is almost the same as the steps for installing. All the installation guides in this section will also teach you how to upgrade and downgrade.</p></div>
 
1208
</div>
 
1209
<div class="sect2">
 
1210
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="install_osx_homebrew"></span><h3 data-comment-topic="installing-or-upgrading-on-mac-os-x-with-homebrew-fxjdi1" data-anchor="install_osx_homebrew">2.2. Installing or upgrading on Mac OS X with Homebrew</h3>
 
1211
<div class="dlist"><dl>
 
1212
<dt class="hdlist1">
 
1213
<strong>Open source</strong>
 
1214
</dt>
 
1215
<dd>
 
1216
<p>
 
1217
        Every time we release a new Phusion Passenger version, we make it available through <a href="http://brew.sh/">Homebrew</a>. Please note that the Homebrew maintainers have to merge our pull requests manually, so it may take a day or two before a new version shows up in the official Homebrew repository.
 
1218
</p>
 
1219
<div class="olist arabic"><ol class="arabic">
 
1220
<li>
 
1221
<p>
 
1222
Update the Homebrew recipes:
 
1223
</p>
 
1224
<div class="listingblock">
 
1225
<div class="content monospaced">
 
1226
<pre>brew update</pre>
 
1227
</div>
 
1228
</div>
 
1229
</li>
 
1230
<li>
 
1231
<p>
 
1232
Run one of the following, and follow the instructions:
 
1233
</p>
 
1234
<div class="listingblock">
 
1235
<div class="content monospaced">
 
1236
<pre>brew install passenger
 
1237
-OR-
 
1238
brew upgrade passenger</pre>
 
1239
</div>
 
1240
</div>
 
1241
</li>
 
1242
</ol></div>
 
1243
</dd>
 
1244
<dt class="hdlist1">
 
1245
<strong>Enterprise</strong>
 
1246
</dt>
 
1247
<dd>
 
1248
<p>
 
1249
        <a href="https://www.phusionpassenger.com/enterprise">Phusion Passenger Enterprise</a> is currently not available through Homebrew. Please try one of the other installation methods instead.
 
1250
</p>
 
1251
</dd>
 
1252
</dl></div>
 
1253
</div>
 
1254
<div class="sect2">
 
1255
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="install_on_debian_ubuntu"></span><h3 data-comment-topic="installing-or-upgrading-on-debian-or-ubuntu-gme2a9" data-anchor="install_on_debian_ubuntu">2.3. Installing or upgrading on Debian or Ubuntu</h3>
 
1256
<div class="paragraph"><p>We provide and official Phusion Passenger APT repository. This APT repository contains Phusion Passenger packages for multiple versions of Debian and Ubuntu. These packages are automatically built by our build server after we push out a source release, and thus are always up to date with the official source releases.</p></div>
 
1257
<div class="paragraph"><p>If you use these packages to install Phusion Passenger then you do not need to run <span class="monospaced">passenger-install-apache2-module</span> or <span class="monospaced">passenger-install-nginx-module</span>. These packages contain all the binaries that you need.</p></div>
 
1258
<div class="paragraph"><p>Packages are available for the x86 and x86_64 architectures. Our policy is to support all Ubuntu LTS releases that are still supported by Canonical, plus the latest non-LTS Ubuntu release, plus all Debian releases that are still supported by Debian.</p></div>
 
1259
<div class="sect3">
 
1260
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="install_add_apt_repo"></span><h4 data-comment-topic="adding-our-apt-repository-1qu2se8" data-anchor="install_add_apt_repo">2.3.1. Adding our APT repository</h4>
 
1261
<div class="olist arabic"><ol class="arabic">
 
1262
<li>
 
1263
<p>
 
1264
Install our PGP key. Packages are signed by "Phusion Automated Software Signing (<a href="mailto:auto-software-signing@phusion.nl">auto-software-signing@phusion.nl</a>)", fingerprint 1637 8A33 A6EF 1676 2922 526E 561F 9B9C AC40 B2F7.
 
1265
</p>
 
1266
<div class="listingblock">
 
1267
<div class="content monospaced">
 
1268
<pre>sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7</pre>
 
1269
</div>
 
1270
</div>
 
1271
</li>
 
1272
<li>
 
1273
<p>
 
1274
Add HTTPS support for APT. Our APT repository is stored on an HTTPS server.
 
1275
</p>
 
1276
<div class="listingblock">
 
1277
<div class="content monospaced">
 
1278
<pre>sudo apt-get install apt-transport-https</pre>
 
1279
</div>
 
1280
</div>
 
1281
</li>
 
1282
<li>
 
1283
<p>
 
1284
Create a file <span class="monospaced">/etc/apt/sources.list.d/passenger.list</span> and insert one of the following lines, depending on your distribution.
 
1285
</p>
 
1286
<div class="dlist"><dl>
 
1287
<dt class="hdlist1">
 
1288
<strong>Open source</strong>
 
1289
</dt>
 
1290
<dd>
 
1291
<div class="listingblock">
 
1292
<div class="content">
 
1293
<!-- Generator: GNU source-highlight 2.11.1
 
1294
by Lorenzo Bettini
 
1295
http://www.lorenzobettini.it
 
1296
http://www.gnu.org/software/src-highlite -->
 
1297
<pre><tt><span style="font-style: italic"><span style="color: #9A1900"># Ubuntu 13.10</span></span>
 
1298
deb https<span style="color: #990000">:</span>//oss-binaries<span style="color: #990000">.</span>phusionpassenger<span style="color: #990000">.</span>com/apt/passenger saucy main
 
1299
<span style="font-style: italic"><span style="color: #9A1900"># Ubuntu 12.04</span></span>
 
1300
deb https<span style="color: #990000">:</span>//oss-binaries<span style="color: #990000">.</span>phusionpassenger<span style="color: #990000">.</span>com/apt/passenger precise main
 
1301
<span style="font-style: italic"><span style="color: #9A1900"># Ubuntu 10.04</span></span>
 
1302
deb https<span style="color: #990000">:</span>//oss-binaries<span style="color: #990000">.</span>phusionpassenger<span style="color: #990000">.</span>com/apt/passenger lucid main
 
1303
<span style="font-style: italic"><span style="color: #9A1900"># Debian 7</span></span>
 
1304
deb https<span style="color: #990000">:</span>//oss-binaries<span style="color: #990000">.</span>phusionpassenger<span style="color: #990000">.</span>com/apt/passenger wheezy main
 
1305
<span style="font-style: italic"><span style="color: #9A1900"># Debian 6</span></span>
 
1306
deb https<span style="color: #990000">:</span>//oss-binaries<span style="color: #990000">.</span>phusionpassenger<span style="color: #990000">.</span>com/apt/passenger squeeze main</tt></pre>
 
1307
</div>
 
1308
</div>
 
1309
</dd>
 
1310
<dt class="hdlist1">
 
1311
<strong>Enterprise</strong>
 
1312
</dt>
 
1313
<dd>
 
1314
<div class="listingblock">
 
1315
<div class="content">
 
1316
<!-- Generator: GNU source-highlight 2.11.1
 
1317
by Lorenzo Bettini
 
1318
http://www.lorenzobettini.it
 
1319
http://www.gnu.org/software/src-highlite -->
 
1320
<pre><tt><span style="font-style: italic"><span style="color: #9A1900"># Ubuntu 13.10</span></span>
 
1321
deb https<span style="color: #990000">:</span>//download<span style="color: #990000">:</span>YOUR_DOWNLOAD_TOKEN@www<span style="color: #990000">.</span>phusionpassenger<span style="color: #990000">.</span>com/enterprise_apt saucy main
 
1322
<span style="font-style: italic"><span style="color: #9A1900"># Ubuntu 12.04</span></span>
 
1323
deb https<span style="color: #990000">:</span>//download<span style="color: #990000">:</span>YOUR_DOWNLOAD_TOKEN@www<span style="color: #990000">.</span>phusionpassenger<span style="color: #990000">.</span>com/enterprise_apt precise main
 
1324
<span style="font-style: italic"><span style="color: #9A1900"># Ubuntu 10.04</span></span>
 
1325
deb https<span style="color: #990000">:</span>//download<span style="color: #990000">:</span>YOUR_DOWNLOAD_TOKEN@www<span style="color: #990000">.</span>phusionpassenger<span style="color: #990000">.</span>com/enterprise_apt lucid main
 
1326
<span style="font-style: italic"><span style="color: #9A1900"># Debian 7</span></span>
 
1327
deb https<span style="color: #990000">:</span>//download<span style="color: #990000">:</span>YOUR_DOWNLOAD_TOKEN@www<span style="color: #990000">.</span>phusionpassenger<span style="color: #990000">.</span>com/enterprise_apt wheezy main
 
1328
<span style="font-style: italic"><span style="color: #9A1900"># Debian 6</span></span>
 
1329
deb https<span style="color: #990000">:</span>//download<span style="color: #990000">:</span>YOUR_DOWNLOAD_TOKEN@www<span style="color: #990000">.</span>phusionpassenger<span style="color: #990000">.</span>com/enterprise_apt squeeze main</tt></pre>
 
1330
</div>
 
1331
</div>
 
1332
<div class="paragraph"><p>You can find the correct value for <em>YOUR_DOWNLOAD_TOKEN</em> in the <a href="https://www.phusionpassenger.com/orders">Customer Area</a>.</p></div>
 
1333
</dd>
 
1334
</dl></div>
 
1335
</li>
 
1336
<li>
 
1337
<p>
 
1338
Secure <span class="monospaced">passenger.list</span> and update your APT cache:
 
1339
</p>
 
1340
<div class="listingblock">
 
1341
<div class="content monospaced">
 
1342
<pre>sudo chown root: /etc/apt/sources.list.d/passenger.list
 
1343
sudo chmod 600 /etc/apt/sources.list.d/passenger.list
 
1344
sudo apt-get update</pre>
 
1345
</div>
 
1346
</div>
 
1347
</li>
 
1348
</ol></div>
 
1349
</div>
 
1350
<div class="sect3">
 
1351
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_installing_packages"></span><h4 data-comment-topic="installing-packages-k1zxbg" data-anchor="_installing_packages">2.3.2. Installing packages</h4>
 
1352
<div class="dlist"><dl>
 
1353
<dt class="hdlist1">
 
1354
<strong>Open source</strong>
 
1355
</dt>
 
1356
<dd>
 
1357
<div class="olist arabic"><ol class="arabic">
 
1358
<li>
 
1359
<p>
 
1360
<a href="#install_add_apt_repo">Add our APT repository.</a>
 
1361
</p>
 
1362
</li>
 
1363
<li>
 
1364
<p>
 
1365
Install the package:
 
1366
</p>
 
1367
<div class="listingblock">
 
1368
<div class="content monospaced">
 
1369
<pre>sudo apt-get install passenger</pre>
 
1370
</div>
 
1371
</div>
 
1372
</li>
 
1373
</ol></div>
 
1374
</dd>
 
1375
<dt class="hdlist1">
 
1376
<strong>Enterprise</strong>
 
1377
</dt>
 
1378
<dd>
 
1379
<div class="olist arabic"><ol class="arabic">
 
1380
<li>
 
1381
<p>
 
1382
Download your license key from the <a href="https://www.phusionpassenger.com/orders">Customer Area</a> and save it as <span class="monospaced">/etc/passenger-enterprise-license</span>.
 
1383
</p>
 
1384
</li>
 
1385
<li>
 
1386
<p>
 
1387
<a href="#install_add_apt_repo">Add our APT repository.</a>
 
1388
</p>
 
1389
</li>
 
1390
<li>
 
1391
<p>
 
1392
Install the packages:
 
1393
</p>
 
1394
<div class="listingblock">
 
1395
<div class="content monospaced">
 
1396
<pre>sudo apt-get install passenger-enterprise</pre>
 
1397
</div>
 
1398
</div>
 
1399
</li>
 
1400
</ol></div>
 
1401
</dd>
 
1402
</dl></div>
 
1403
</div>
 
1404
</div>
 
1405
<div class="sect2">
 
1406
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_installing_or_upgrading_on_red_hat_fedora_centos_or_scientificlinux"></span><h3 data-comment-topic="installing-or-upgrading-on-red-hat-fedora-centos-or-scientificlinux-16cek45" data-anchor="_installing_or_upgrading_on_red_hat_fedora_centos_or_scientificlinux">2.4. Installing or upgrading on Red Hat, Fedora, CentOS or ScientificLinux</h3>
 
1407
<div class="paragraph"><p>YUM repositories with RPMs are maintained by <a href="https://github.com/erikogan/passenger">Erik Ogan</a> and <a href="http://stealthymonkeys.com/">Stealthy Monkeys Consulting</a>. Only packages for the open source version of Phusion Passenger are provided. <a href="https://www.phusionpassenger.com/enterprise">Phusion Passenger Enterprise</a> customers should use the <a href="#rubygems_generic_install">generic RubyGems installation method</a> or <a href="#tarball_generic_install">the generic tarball installation method</a> instead.</p></div>
 
1408
<div class="paragraph"><p>If you use YUM to install Phusion Passenger then you do not need to run <span class="monospaced">passenger-install-apache2-module</span> or <span class="monospaced">passenger-install-nginx-module</span>. The YUM packages contain all the binaries that you need. You also don’t need to modify any Apache or Nginx configuration to get them to load Phusion Passenger, the packages provide configuration snippets for you as well.</p></div>
 
1409
<span class="anchor_helper" id="_step_1_import_the_stealthy_monkeys_consulting_8217_s_gpg_key"></span><h4 class="float" data-anchor="_step_1_import_the_stealthy_monkeys_consulting_8217_s_gpg_key">Step 1: Import the Stealthy Monkeys Consulting’s GPG key</h4>
 
1410
<div class="listingblock">
 
1411
<div class="content monospaced">
 
1412
<pre>rpm --import http://passenger.stealthymonkeys.com/RPM-GPG-KEY-stealthymonkeys.asc</pre>
 
1413
</div>
 
1414
</div>
 
1415
<span class="anchor_helper" id="_step_2_install_the_release_package"></span><h4 class="float" data-anchor="_step_2_install_the_release_package">Step 2: Install the release package</h4>
 
1416
<div class="paragraph"><p>Install the passenger-release package from the <a href="http://passenger.stealthymonkeys.com/">main repository</a>.</p></div>
 
1417
<div class="paragraph"><p>Fedora Core 17:</p></div>
 
1418
<div class="listingblock">
 
1419
<div class="content monospaced">
 
1420
<pre>yum install http://passenger.stealthymonkeys.com/fedora/17/passenger-release.noarch.rpm</pre>
 
1421
</div>
 
1422
</div>
 
1423
<div class="paragraph"><p>Fedora Core 16:</p></div>
 
1424
<div class="listingblock">
 
1425
<div class="content monospaced">
 
1426
<pre>yum install http://passenger.stealthymonkeys.com/fedora/16/passenger-release.noarch.rpm</pre>
 
1427
</div>
 
1428
</div>
 
1429
<div class="paragraph"><p>Fedora Core 15:</p></div>
 
1430
<div class="listingblock">
 
1431
<div class="content monospaced">
 
1432
<pre>yum install http://passenger.stealthymonkeys.com/fedora/15/passenger-release.noarch.rpm</pre>
 
1433
</div>
 
1434
</div>
 
1435
<div class="paragraph"><p>Fedora Core 14:</p></div>
 
1436
<div class="listingblock">
 
1437
<div class="content monospaced">
 
1438
<pre>yum install http://passenger.stealthymonkeys.com/fedora/14/passenger-release.noarch.rpm</pre>
 
1439
</div>
 
1440
</div>
 
1441
<div class="paragraph"><p>RHEL 6 / CentOS 6 / ScientificLinux 6: (Note: these packages depend on <a href="http://fedoraproject.org/wiki/EPEL">EPEL</a>.)</p></div>
 
1442
<div class="listingblock">
 
1443
<div class="content monospaced">
 
1444
<pre>yum install http://passenger.stealthymonkeys.com/rhel/6/passenger-release.noarch.rpm</pre>
 
1445
</div>
 
1446
</div>
 
1447
<div class="paragraph"><p>RHEL 5 / CentOS 5 / ScientificLinux 5: (Note: these packages depend on <a href="http://fedoraproject.org/wiki/EPEL">EPEL</a>.)</p></div>
 
1448
<div class="listingblock">
 
1449
<div class="content monospaced">
 
1450
<pre>rpm -Uvh http://passenger.stealthymonkeys.com/rhel/5/passenger-release.noarch.rpm</pre>
 
1451
</div>
 
1452
</div>
 
1453
<span class="anchor_helper" id="_step_3_install_the_right_phusion_passenger_package"></span><h4 class="float" data-anchor="_step_3_install_the_right_phusion_passenger_package">Step 3: Install the right Phusion Passenger package</h4>
 
1454
<div class="paragraph"><p>From there you can use <a href="http://prefetch.net/articles/yum.html">YUM</a> to install packages. For example, try one of these:</p></div>
 
1455
<div class="paragraph"><p>Phusion Passenger for Apache:</p></div>
 
1456
<div class="listingblock">
 
1457
<div class="content monospaced">
 
1458
<pre>yum install mod_passenger</pre>
 
1459
</div>
 
1460
</div>
 
1461
<div class="paragraph"><p>Phusion Passenger for Nginx:</p></div>
 
1462
<div class="listingblock">
 
1463
<div class="content monospaced">
 
1464
<pre>yum install nginx-passenger</pre>
 
1465
</div>
 
1466
</div>
 
1467
<div class="paragraph"><p>Phusion Passenger Standalone:</p></div>
 
1468
<div class="listingblock">
 
1469
<div class="content monospaced">
 
1470
<pre>yum install passenger-standalone</pre>
 
1471
</div>
 
1472
</div>
 
1473
<span class="anchor_helper" id="_building_your_own_packages"></span><h4 class="float" data-anchor="_building_your_own_packages">Building your own packages</h4>
 
1474
<div class="paragraph"><p>There are instructions for building your own packages and Yum repositories in the <a href="https://github.com/phusion/passenger/tree/master/rpm#readme">rpm directory ReadMe</a> within the <a href="https://github.com/phusion/passenger">GitHub repository</a>.</p></div>
 
1475
</div>
 
1476
<div class="sect2">
 
1477
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="rubygems_generic_install"></span><h3 data-comment-topic="generic-installation-upgrade-and-downgrade-method-via-rubygems-1229ugi" data-anchor="rubygems_generic_install">2.5. Generic installation, upgrade and downgrade method: via RubyGems</h3>
 
1478
<div class="paragraph"><p>RubyGems is only used as a method to obtain the Phusion Passenger files, so in case you have multiple Ruby versions it does not matter which Ruby’s RubyGems you use for installation. Once installed, Phusion Passenger can work with all other Ruby versions on your system. This is explained in <a href="#relationship_with_ruby">Phusion Passenger and its relationship with Ruby</a>.</p></div>
 
1479
<span class="anchor_helper" id="is_ruby_home_or_system_wide_installed"></span><h4 class="float" data-anchor="is_ruby_home_or_system_wide_installed">Step 1: figuring out whether your Ruby is installed in the home directory or system-wide</h4>
 
1480
<div class="paragraph"><p>Ruby may either be installed in the home directory, or system-wide. If it’s installed system-wide then we will want to install gems system-wide as well, so you need to switch to a root prompt first. If Ruby is installed in the home directory then we will want to install gems to the home directory as well, as a normal user.</p></div>
 
1481
<div class="paragraph"><p>To find out which case applies, run the following command to find out where the <span class="monospaced">ruby</span> command is:</p></div>
 
1482
<div class="listingblock">
 
1483
<div class="content monospaced">
 
1484
<pre>which ruby</pre>
 
1485
</div>
 
1486
</div>
 
1487
<div class="paragraph"><p>Do you see a filename that references <em>/home</em> or <em>/Users</em>? If so then your Ruby interpreter is installed in your home directory and you can proceed to step 2. Otherwise, you need to switch to a root prompt by running one of the following commands:</p></div>
 
1488
<div class="ulist"><ul>
 
1489
<li>
 
1490
<p>
 
1491
Are you using RVM? Run <span class="monospaced">rvmsudo -s</span>
 
1492
</p>
 
1493
</li>
 
1494
<li>
 
1495
<p>
 
1496
Are you not using RVM, or do you not know what RVM is? Run <span class="monospaced">sudo -s</span>
 
1497
</p>
 
1498
</li>
 
1499
<li>
 
1500
<p>
 
1501
Is <em>sudo</em> not installed on your system? Run <span class="monospaced">su -c bash</span>
 
1502
</p>
 
1503
</li>
 
1504
</ul></div>
 
1505
<div class="paragraph"><p>You must maintain this root prompt throughout this installation guide.</p></div>
 
1506
<span class="anchor_helper" id="_step_2_install_the_gem"></span><h4 class="float" data-anchor="_step_2_install_the_gem">Step 2: install the gem</h4>
 
1507
<div class="dlist"><dl>
 
1508
<dt class="hdlist1">
 
1509
<strong>Open Source</strong>
 
1510
</dt>
 
1511
<dd>
 
1512
<p>
 
1513
        Install the latest gem to obtain the files for the latest stable version of the open source Phusion Passenger:
 
1514
</p>
1174
1515
<div class="listingblock">
1175
1516
<div class="content monospaced">
1176
1517
<pre>gem install passenger</pre>
1177
1518
</div>
1178
1519
</div>
 
1520
<div class="sidebarblock">
 
1521
<div class="content">
 
1522
<div class="title">Previous versions and beta versions</div>
 
1523
<div class="paragraph"><p>Sometimes you will want to obtain the latest beta version of Phusion Passenger. Beta versions are not normally selected by <span class="monospaced">gem install</span>, so to opt-in for beta versions you have to add the <span class="monospaced">--pre</span> argument:</p></div>
 
1524
<div class="listingblock">
 
1525
<div class="content monospaced">
 
1526
<pre>gem install passenger --pre</pre>
 
1527
</div>
 
1528
</div>
 
1529
<div class="paragraph"><p>If you want to obtain a specific version of Phusion Passenger, e.g. because you are downgrading, then specify the version number with <span class="monospaced">--version</span>:</p></div>
 
1530
<div class="listingblock">
 
1531
<div class="content monospaced">
 
1532
<pre>gem install passenger --version 3.0.0</pre>
 
1533
</div>
 
1534
</div>
 
1535
<div class="paragraph"><p>If you want to obtain a specific <strong>beta</strong> version of Phusion Passenger then you must also pass <span class="monospaced">--pre</span>:</p></div>
 
1536
<div class="listingblock">
 
1537
<div class="content monospaced">
 
1538
<pre>gem install passenger --version 3.9.1.beta --pre</pre>
 
1539
</div>
 
1540
</div>
 
1541
</div>
 
1542
</div>
 
1543
</dd>
 
1544
<dt class="hdlist1">
 
1545
<strong>Enterprise</strong>
 
1546
</dt>
 
1547
<dd>
 
1548
<p>
 
1549
First, download the <strong>license key</strong> from the <a href="https://www.phusionpassenger.com/orders">Customer Area</a> and save it as <span class="monospaced">/etc/passenger-enterprise-license</span>.
 
1550
</p>
 
1551
<div class="paragraph"><p>Next, add the Phusion Passenger Enterprise gem server to your RubyGems source list:</p></div>
 
1552
<div class="listingblock">
 
1553
<div class="content monospaced">
 
1554
<pre>gem source --add https://download:YOUR_DOWNLOAD_TOKEN@www.phusionpassenger.com/enterprise_gems/</pre>
 
1555
</div>
 
1556
</div>
 
1557
<div class="paragraph"><p>Substitute <em>YOUR_DOWNLOAD_TOKEN</em> with the one you find in the <a href="https://www.phusionpassenger.com/orders">Customer Area</a>. And notice the <strong>trailing slash</strong> in the URL! It is very important.</p></div>
 
1558
<div class="paragraph"><p>Finally, install the latest gem to obtain the files for the latest stable version of the open source Phusion Passenger:</p></div>
 
1559
<div class="listingblock">
 
1560
<div class="content monospaced">
 
1561
<pre>gem install passenger-enterprise-server</pre>
 
1562
</div>
 
1563
</div>
 
1564
<div class="sidebarblock">
 
1565
<div class="content">
 
1566
<div class="title">Previous versions and beta versions</div>
 
1567
<div class="paragraph"><p>Sometimes you will want to obtain the latest beta version of Phusion Passenger Enterprise. Beta versions are not normally selected by <span class="monospaced">gem install</span>, so to opt-in for beta versions you have to add the <span class="monospaced">--pre</span> argument:</p></div>
 
1568
<div class="listingblock">
 
1569
<div class="content monospaced">
 
1570
<pre>gem install passenger-enterprise-server --pre</pre>
 
1571
</div>
 
1572
</div>
 
1573
<div class="paragraph"><p>If you want to obtain a specific version of Phusion Passenger Enterprise, e.g. because you are downgrading, then specify the version number with <span class="monospaced">--version</span>:</p></div>
 
1574
<div class="listingblock">
 
1575
<div class="content monospaced">
 
1576
<pre>gem install passenger-enterprise-server --version 3.0.0</pre>
 
1577
</div>
 
1578
</div>
 
1579
<div class="paragraph"><p>If you want to obtain a specific <strong>beta</strong> version of Phusion Passenger then you must also pass <span class="monospaced">--pre</span>:</p></div>
 
1580
<div class="listingblock">
 
1581
<div class="content monospaced">
 
1582
<pre>gem install passenger-enterprise-server --version 3.9.1.beta --pre</pre>
 
1583
</div>
 
1584
</div>
 
1585
</div>
 
1586
</div>
 
1587
</dd>
 
1588
</dl></div>
 
1589
</div>
 
1590
<div class="sect2">
 
1591
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="tarball_generic_install"></span><h3 data-comment-topic="generic-installation-upgrade-and-downgrade-method-via-tarball-1rwvasy" data-anchor="tarball_generic_install">2.6. Generic installation, upgrade and downgrade method: via tarball</h3>
 
1592
<span class="anchor_helper" id="_step_1_installing_ruby"></span><h4 class="float" data-anchor="_step_1_installing_ruby">Step 1: installing Ruby</h4>
 
1593
<div class="paragraph"><p>Phusion Passenger supports multiple languages and its core is written in C++, but its installer and administration tools are written in Ruby, so you must install Ruby.</p></div>
 
1594
<div class="paragraph"><p>Even though Ruby is required, Ruby will normally not be loaded during normal operation unless you deploy a Ruby web application on Phusion Passenger. Phusion Passenger’s dependency on Ruby is very minimal. See <a href="#relationship_with_ruby">Phusion Passenger and its relationship with Ruby</a> for details.</p></div>
 
1595
<table class="tableblock frame-all grid-all" style="
 
1596
width:100%;
 
1597
">
 
1598
<col style="width:50%;">
 
1599
<col style="width:50%;">
 
1600
<tbody>
 
1601
<tr>
 
1602
<td class="tableblock halign-left valign-top"><p class="tableblock">Debian, Ubuntu</p></td>
 
1603
<td class="tableblock halign-left valign-top"><p class="tableblock"><span class="monospaced">sudo apt-get update</span><br><span class="monospaced">sudo apt-get install ruby rake</span></p></td>
 
1604
</tr>
 
1605
<tr>
 
1606
<td class="tableblock halign-left valign-top"><p class="tableblock">Red Hat, CentOS, ScientificLinux, Amazon Linux</p></td>
 
1607
<td class="tableblock halign-left valign-top"><p class="tableblock">Enable <a href="http://fedoraproject.org/wiki/EPEL">EPEL</a>, then run as root:<br><span class="monospaced">yum install ruby rubygem-rake</span></p></td>
 
1608
</tr>
 
1609
<tr>
 
1610
<td class="tableblock halign-left valign-top"><p class="tableblock">Mac OS X</p></td>
 
1611
<td class="tableblock halign-left valign-top"><p class="tableblock">No action needed. Ruby is installed by default.</p></td>
 
1612
</tr>
 
1613
<tr>
 
1614
<td class="tableblock halign-left valign-top"><p class="tableblock">Other operating systems</p></td>
 
1615
<td class="tableblock halign-left valign-top"><p class="tableblock">Install Ruby from <a href="http://www.ruby-lang.org/">the Ruby website</a>.</p></td>
 
1616
</tr>
 
1617
</tbody>
 
1618
</table>
 
1619
<span class="anchor_helper" id="_step_2_download_and_extract_the_tarball"></span><h4 class="float" data-anchor="_step_2_download_and_extract_the_tarball">Step 2: download and extract the tarball</h4>
 
1620
<div class="dlist"><dl>
 
1621
<dt class="hdlist1">
 
1622
<strong>Open Source</strong>
 
1623
</dt>
 
1624
<dd>
 
1625
<p>
 
1626
        Download the open source Phusion Passenger tarball from <a href="https://www.phusionpassenger.com/download#open_source">the Phusion Passenger website</a>.
 
1627
</p>
 
1628
<div class="paragraph"><p>Older versions can be found in <a href="https://www.phusionpassenger.com/file_releases">the release archive</a>.</p></div>
 
1629
</dd>
 
1630
<dt class="hdlist1">
 
1631
<strong>Enterprise</strong>
 
1632
</dt>
 
1633
<dd>
 
1634
<p>
 
1635
        <a href="https://www.phusionpassenger.com/enterprise">Phusion Passenger Enterprise</a> customers can download the Phusion Passenger Enterprise tarball from the <a href="https://www.phusionpassenger.com/orders">Customer Area</a>.
 
1636
</p>
 
1637
<div class="paragraph"><p>Also be sure to download the <strong>license key</strong> and save it as <span class="monospaced">/etc/passenger-enterprise-license</span>.</p></div>
 
1638
</dd>
 
1639
</dl></div>
 
1640
<div class="paragraph"><p>Once you have downloaded the tarball, pick a location to extract it to. You can pick any location. A good location is <em>/opt/passenger</em>. Create this directory and extract the tarball as follows:</p></div>
 
1641
<div class="listingblock">
 
1642
<div class="content monospaced">
 
1643
<pre>mkdir /opt/passenger
 
1644
cd /opt/passenger
 
1645
tar xzvf /location-to/passenger-x.x.x.tar.gz
 
1646
cd /opt/passenger/passenger-x.x.x</pre>
 
1647
</div>
 
1648
</div>
 
1649
<div class="paragraph"><p>Note that <span class="monospaced">passenger-x.x.x</span> should be <span class="monospaced">passenger-enterprise-server-x.x.x</span> if you’re using Phusion Passenger Enterprise.</p></div>
 
1650
<span class="anchor_helper" id="_step_3_adding_the_phusion_passenger_tools_to_path"></span><h4 class="float" data-anchor="_step_3_adding_the_phusion_passenger_tools_to_path">Step 3: adding the Phusion Passenger tools to PATH</h4>
 
1651
<div class="paragraph"><p>Edit <span class="monospaced">/etc/bashrc</span> (or <span class="monospaced">/etc/bash.bashrc</span> on some systems) and append the following to the end of the file:</p></div>
 
1652
<div class="listingblock">
 
1653
<div class="content monospaced">
 
1654
<pre>export PATH=/opt/passenger/passenger-x.x.x/bin:$PATH</pre>
 
1655
</div>
 
1656
</div>
 
1657
<div class="paragraph"><p>Finally, restart all your shell sessions in order to activate this change. The installation is now complete.</p></div>
 
1658
</div>
 
1659
<div class="sect2">
 
1660
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_upgrading_from_open_source_to_enterprise"></span><h3 data-comment-topic="upgrading-from-open-source-to-enterprise-1kezors" data-anchor="_upgrading_from_open_source_to_enterprise">2.7. Upgrading from open source to Enterprise</h3>
 
1661
<div class="paragraph"><p>Phusion Passenger comes in two variants: an open source version, as well as an <a href="https://www.phusionpassenger.com/enterprise">Enterprise version</a> which introduces a myriad of useful features that can improve stability and performance and efficiency.</p></div>
 
1662
<div class="paragraph"><p>Customers who have bought Phusion Passenger Enterprise can upgrade their open source installation to Enterprise as follows:</p></div>
 
1663
<div class="olist arabic"><ol class="arabic">
 
1664
<li>
 
1665
<p>
 
1666
<a href="#uninstalling">Uninstall the open source Phusion Passenger</a>.
 
1667
</p>
 
1668
</li>
 
1669
<li>
 
1670
<p>
 
1671
Install the Enterprise version by following one of the installation guides in this section (e.g. <a href="#rubygems_generic_install">RubyGems generic installation</a> or <a href="#tarball_generic_install">tarball generic installation</a>).
 
1672
</p>
 
1673
</li>
 
1674
</ol></div>
 
1675
<div class="paragraph"><p>The uninstallation is necessary because the Enterprise Ruby gem has a different gem name (<em>passenger-enterprise-server</em> instead of <em>passenger</em>), but the same administration command names (e.g. <span class="monospaced">passenger-status</span>). Uninstalling the open source version avoids any conflicts.</p></div>
 
1676
</div>
 
1677
<div class="sect2">
 
1678
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_cryptographic_verification_of_installation_files"></span><h3 data-comment-topic="cryptographic-verification-of-installation-files-85nwoi" data-anchor="_cryptographic_verification_of_installation_files">2.8. Cryptographic verification of installation files</h3>
 
1679
<div class="sect3">
 
1680
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_synopsis_2"></span><h4 data-comment-topic="synopsis-1ij8j9r" data-anchor="_synopsis_2">2.8.1. Synopsis</h4>
 
1681
<div class="paragraph"><p>We digitally sign various files with our GPG key so that you can check whether they’re legit, i.e. whether they really came from Phusion and haven’t been tampered with by a third party. We apply signing since the open source version 4.0.0 RC 4, or the Enterprise version 4.0.0 RC 1.</p></div>
 
1682
</div>
 
1683
<div class="sect3">
 
1684
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_importing_the_phusion_software_signing_key"></span><h4 data-comment-topic="importing-the-phusion-software-signing-key-1u5hkcr" data-anchor="_importing_the_phusion_software_signing_key">2.8.2. Importing the Phusion Software Signing key</h4>
 
1685
<div class="paragraph"><p>Phusion’s GPG key for signing software is as follows:</p></div>
 
1686
<div class="literalblock">
 
1687
<div class="content monospaced">
 
1688
<pre>Phusion Software Signing (software-signing@phusion.nl)
 
1689
Short key ID: 0x0A212A8C
 
1690
Long key ID: 0x2AC745A50A212A8C
 
1691
Fingerprint: D5F0 8514 2693 9232 F437  AB72 2AC7 45A5 0A21 2A8C</pre>
 
1692
</div>
 
1693
</div>
 
1694
<div class="paragraph"><p>This key is stored at <a href="http://www.phusion.nl/about/gpg">the Phusion website</a> and at the key servers <a href="http://pool.sks-keyservers.net/pks/lookup?op=get&amp;search=0x2AC745A50A212A8C">sks-keyservers.net</a> and <a href="http://keyserver.ubuntu.com/pks/lookup?op=get&amp;search=0x2AC745A50A212A8C">keyserver.ubuntu.com</a>. You can import it to your keyring with one of these command:</p></div>
 
1695
<div class="listingblock">
 
1696
<div class="content monospaced">
 
1697
<pre>gpg --keyserver pool.sks-keyservers.net --search-keys 0x2AC745A50A212A8C
 
1698
# -OR-
 
1699
gpg --keyserver keyserver.ubuntu.com --search-keys 0x2AC745A50A212A8C</pre>
 
1700
</div>
 
1701
</div>
 
1702
<div class="paragraph"><p>The Phusion Software Signing key is only used for signing software. It’s never used for signing emails or for encrypting files, so please be suspicious if you encounter usage of this key outside the context of signing software, and alert us at <a href="mailto:support@phusion.nl">support@phusion.nl</a>. Include "notspam" in the message to bypass our spam filter.</p></div>
 
1703
<div class="paragraph"><p>The email address <a href="mailto:software-signing@phusion.nl">software-signing@phusion.nl</a> redirects to <a href="mailto:info@phusion.nl">info@phusion.nl</a> so it’s safe to send email there.</p></div>
 
1704
</div>
 
1705
<div class="sect3">
 
1706
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_verifying_the_phusion_software_signing_key"></span><h4 data-comment-topic="verifying-the-phusion-software-signing-key-qor1n1" data-anchor="_verifying_the_phusion_software_signing_key">2.8.3. Verifying the Phusion Software Signing key</h4>
 
1707
<div class="paragraph"><p>The Phusion Software Signing key is also <strong>signed by the Phusion founders</strong>. Their keys are as follows:</p></div>
 
1708
<div class="literalblock">
 
1709
<div class="content monospaced">
 
1710
<pre>Hongli Lai (hongli@phusion.nl)
 
1711
Short key ID: 4B6F4332
 
1712
Long key ID: 06A131094B6F4332
 
1713
Fingerprint: 64E8 0420 FC6A 499F 9E1F  81FA 06A1 3109 4B6F 4332</pre>
 
1714
</div>
 
1715
</div>
 
1716
<div class="literalblock">
 
1717
<div class="content monospaced">
 
1718
<pre>Ninh Bui (ninh@phusion.nl)
 
1719
Short key ID: 6FAF3782
 
1720
Long key ID: BA8DA3F46FAF3782
 
1721
Fingerprint: 353A 398C 49AF 5CD5 74A0  656C BA8D A3F4 6FAF 3782</pre>
 
1722
</div>
 
1723
</div>
 
1724
<div class="paragraph"><p>Both keys are stored at both sks-servers.net and keyserver.ubuntu.com. Import them with:</p></div>
 
1725
<div class="listingblock">
 
1726
<div class="content monospaced">
 
1727
<pre>gpg --keyserver pool.sks-servers.net --search-keys 0x06A131094B6F4332
 
1728
gpg --keyserver pool.sks-servers.net --search-keys 0xBA8DA3F46FAF3782
 
1729
# -OR-
 
1730
gpg --keyserver keyserver.ubuntu.com --search-keys 0x06A131094B6F4332
 
1731
gpg --keyserver keyserver.ubuntu.com --search-keys 0xBA8DA3F46FAF3782</pre>
 
1732
</div>
 
1733
</div>
 
1734
</div>
 
1735
<div class="sect3">
 
1736
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_verifying_the_gem_and_tarball"></span><h4 data-comment-topic="verifying-the-gem-and-tarball-i7tj7a" data-anchor="_verifying_the_gem_and_tarball">2.8.4. Verifying the gem and tarball</h4>
 
1737
<div class="paragraph"><p>You can find the open source version’s gem and tarball GPG signatures at <a href="https://www.phusionpassenger.com/file_releases">https://www.phusionpassenger.com/file_releases</a>. The Enterprise version’s GPG signatures can be found in the <a href="https://www.phusionpassenger.com/orders">Customer Area</a>. All signatures have the <em>.asc</em> extension. Once you have imported our key, you can verify the validity of a file against its signature as follows:</p></div>
 
1738
<div class="listingblock">
 
1739
<div class="content monospaced">
 
1740
<pre>$ gpg --verify passenger-x.x.x.tar.gz.asc passenger-x.x.x.tar.gz
 
1741
gpg: Signature made Mon Mar 11 09:45:46 2013 CET using RSA key ID 0A212A8C
 
1742
gpg: Good signature from "Phusion Software Signing &lt;software-signing@phusion.nl&gt;"</pre>
 
1743
</div>
 
1744
</div>
 
1745
</div>
 
1746
<div class="sect3">
 
1747
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_verifying_git_signatures"></span><h4 data-comment-topic="verifying-git-signatures-dltpan" data-anchor="_verifying_git_signatures">2.8.5. Verifying Git signatures</h4>
 
1748
<div class="paragraph"><p>Tags in the <a href="https://github.com/phusion/passenger">Git repository for the open source version</a> are also tagged. You can verify a Git tag as follows:</p></div>
 
1749
<div class="listingblock">
 
1750
<div class="content monospaced">
 
1751
<pre>$ git tag --verify release-x.x.x
 
1752
object d886f34b5705e4314feccaf0d77b9a38416e15e0
 
1753
type commit
 
1754
tag release-4.0.0.rc5
 
1755
tagger Hongli Lai (Phusion) &lt;hongli@phusion.nl&gt; 1362993117 +0100
 
1756
 
 
1757
This is a tag message.
 
1758
gpg: Signature made Mon Mar 11 10:12:02 2013 CET using RSA key ID 0A212A8C
 
1759
gpg: Good signature from "Phusion Software Signing &lt;software-signing@phusion.nl&gt;"</pre>
 
1760
</div>
 
1761
</div>
 
1762
</div>
 
1763
<div class="sect3">
 
1764
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_verifying_deb_and_rpm_packages"></span><h4 data-comment-topic="verifying-deb-and-rpm-packages-uga0ho" data-anchor="_verifying_deb_and_rpm_packages">2.8.6. Verifying DEB and RPM packages</h4>
 
1765
<div class="paragraph"><p>The DEB and RPM packages are signed with the signatures of the respective packagers. They are automatically checked upon installation.</p></div>
 
1766
</div>
 
1767
<div class="sect3">
 
1768
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_revocation"></span><h4 data-comment-topic="revocation-ukzeg9" data-anchor="_revocation">2.8.7. Revocation</h4>
 
1769
<div class="paragraph"><p>In the event our key is compromised, we will revoke the key and upload the revocation information to sks-servers.net and keyserver.ubuntu.com. However your system will not know about the revocation until you update the keys from the keyservers. You should update your keys regularly (e.g. once a week) by invoking:</p></div>
 
1770
<div class="listingblock">
 
1771
<div class="content monospaced">
 
1772
<pre>gpg --refresh-keys --keyserver pool.sks-servers.net
 
1773
# -OR-
 
1774
gpg --refresh-keys --keyserver keyserver.ubuntu.com</pre>
 
1775
</div>
 
1776
</div>
 
1777
<div class="paragraph"><p>If you installed Phusion Passenger through our APT repository, then you should update APT’s keyring from time to time as well:</p></div>
 
1778
<div class="listingblock">
 
1779
<div class="content monospaced">
 
1780
<pre>sudo apt-key adv --refresh-keys --keyserver keyserver.ubuntu.com</pre>
 
1781
</div>
 
1782
</div>
 
1783
</div>
 
1784
</div>
 
1785
<div class="sect2">
 
1786
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_customizing_the_compilation_process"></span><h3 data-comment-topic="customizing-the-compilation-process-j4xj2t" data-anchor="_customizing_the_compilation_process">2.9. Customizing the compilation process</h3>
 
1787
<div class="paragraph"><p>The Phusion Passenger compilation process can be customized with environment variables. You can learn more about environment variables in <a href="#about_environment_variables">About environment variables</a>.</p></div>
 
1788
<div class="sect3">
 
1789
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_setting_the_compiler"></span><h4 data-comment-topic="setting-the-compiler-1fxfulc" data-anchor="_setting_the_compiler">2.9.1. Setting the compiler</h4>
 
1790
<div class="paragraph"><p>You can force the Phusion Passenger build system to use a specific C or C++ compiler by setting the <span class="monospaced">CC</span> and <span class="monospaced">CXX</span> environment variables. These may be set to any arbitrary shell commands.</p></div>
 
1791
<div class="paragraph"><p>For example, contributors who want to hack on Phusion Passenger may want to use Clang for faster compilation and <a href="http://ccache.samba.org/">ccache</a> for faster recompilation, and may want to enable more error-catching compilation flags:</p></div>
 
1792
<div class="listingblock">
 
1793
<div class="content">
 
1794
<!-- Generator: GNU source-highlight 2.11.1
 
1795
by Lorenzo Bettini
 
1796
http://www.lorenzobettini.it
 
1797
http://www.gnu.org/software/src-highlite -->
 
1798
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">export</span></span> <span style="color: #009900">CC</span><span style="color: #990000">=</span><span style="color: #FF0000">'ccache clang -fcolor-diagnostics -Qunused-arguments -fcatch-undefined-behavior -ftrapv'</span>
 
1799
<span style="font-weight: bold"><span style="color: #0000FF">export</span></span> <span style="color: #009900">CXX</span><span style="color: #990000">=</span><span style="color: #FF0000">'ccache clang++ -fcolor-diagnostics -Qunused-arguments -fcatch-undefined-behavior -ftrapv'</span></tt></pre>
 
1800
</div>
 
1801
</div>
 
1802
<div class="admonitionblock">
 
1803
<table><tr>
 
1804
<td class="icon">
 
1805
<img src="./images/icons/note.png" alt="Note">
 
1806
</td>
 
1807
<td class="content">If you run the installer with <span class="monospaced">sudo</span> then environment variables may not be passed properly. Learn more at <a href="#env_vars_and_sudo">Environment variables and sudo</a>.</td>
 
1808
</tr></table>
 
1809
</div>
 
1810
</div>
 
1811
<div class="sect3">
 
1812
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_adding_additional_compiler_or_linker_flags"></span><h4 data-comment-topic="adding-additional-compiler-or-linker-flags-nxfour" data-anchor="_adding_additional_compiler_or_linker_flags">2.9.2. Adding additional compiler or linker flags</h4>
 
1813
<div class="paragraph"><p>On some systems, C/C++ libraries and headers that Phusion Passenger requires may be located in a non-standard directory. You can force the Phusion Passenger build system to look in those locations by injecting compiler and linker flags using the following environment variables:</p></div>
 
1814
<div class="dlist"><dl>
 
1815
<dt class="hdlist1">
 
1816
<span class="monospaced">EXTRA_PRE_CFLAGS</span>
 
1817
</dt>
 
1818
<dd>
 
1819
<p>
 
1820
        These flags are injected into all C compiler invocations that involve compiling C or C++ source files. This includes compiler invocations that compile <strong>and</strong> link. The flags are injected at the beginning of the command string, even before <span class="monospaced">EXTRA_PRE_LDFLAGS</span>.
 
1821
</p>
 
1822
</dd>
 
1823
<dt class="hdlist1">
 
1824
<span class="monospaced">EXTRA_CFLAGS</span>
 
1825
</dt>
 
1826
<dd>
 
1827
<p>
 
1828
        Similar to <span class="monospaced">EXTRA_PRE_CFLAGS</span>, but injected at the end of the command string, before <span class="monospaced">EXTRA_LDFLAGS</span>.
 
1829
</p>
 
1830
</dd>
 
1831
<dt class="hdlist1">
 
1832
<span class="monospaced">EXTRA_PRE_CXXFLAGS</span>
 
1833
</dt>
 
1834
<dd>
 
1835
<p>
 
1836
        Similar to <span class="monospaced">EXTRA_PRE_CFLAGS</span>, but for C++ compiler invocations.
 
1837
</p>
 
1838
</dd>
 
1839
<dt class="hdlist1">
 
1840
<span class="monospaced">EXTRA_CXXFLAGS</span>
 
1841
</dt>
 
1842
<dd>
 
1843
<p>
 
1844
        Similar to <span class="monospaced">EXTRA_CFLAGS</span>, but for C++ compiler invocations.
 
1845
</p>
 
1846
</dd>
 
1847
<dt class="hdlist1">
 
1848
<span class="monospaced">EXTRA_PRE_LDFLAGS</span>
 
1849
</dt>
 
1850
<dd>
 
1851
<p>
 
1852
        These flags are injected into all C/C++ compiler invocations that involve linking. This includes compiler invocations that compile <strong>and</strong> link. The flags are injected at the beginning of the command string, but after <span class="monospaced">EXTRA_PRE_CFLAGS</span> and <span class="monospaced">EXTRA_PRE_CXXFLAGS</span>.
 
1853
</p>
 
1854
</dd>
 
1855
<dt class="hdlist1">
 
1856
<span class="monospaced">EXTRA_LDFLAGS</span>
 
1857
</dt>
 
1858
<dd>
 
1859
<p>
 
1860
        Similar to <span class="monospaced">EXTRA_PRE_LDFLAGS</span>, but injected at the very end of the command string, even after <span class="monospaced">EXTRA_CFLAGS</span> and <span class="monospaced">EXTRA_CXXFLAGS</span>.
 
1861
</p>
 
1862
</dd>
 
1863
<dt class="hdlist1">
 
1864
<span class="monospaced">EXTRA_C_LDFLAGS</span>
 
1865
</dt>
 
1866
<dd>
 
1867
<p>
 
1868
        Similar to <span class="monospaced">EXTRA_LDFLAGS</span>, but only injected for C executable linking commands. Injected right after <span class="monospaced">EXTRA_LDFLAGS</span>.
 
1869
</p>
 
1870
</dd>
 
1871
<dt class="hdlist1">
 
1872
<span class="monospaced">EXTRA_CXX_LDFLAGS</span>
 
1873
</dt>
 
1874
<dd>
 
1875
<p>
 
1876
        Similar to <span class="monospaced">EXTRA_LDFLAGS</span>, but only injected for C++ executable linking commands. Injected right after <span class="monospaced">EXTRA_LDFLAGS</span>.
 
1877
</p>
 
1878
</dd>
 
1879
<dt class="hdlist1">
 
1880
<span class="monospaced">PASSENGER_THREAD_LOCAL_STORAGE</span>
 
1881
</dt>
 
1882
<dd>
 
1883
<p>
 
1884
        Setting this to 1 will enable the <span class="monospaced">PASSENGER_THREAD_LOCAL_STORAGE</span> macro, which forcefully disables the use of thread-local storage inside the Phusion Passenger codebase. Setting this environment variable is useful on systems that have broken support for thread-local storage, despite passing our build system’s check for proper thread-local storage support. At the time of writing, one user has reported that Ubuntu 12.04 32-bit has broken thread-local storage report although neither the reporter nor us were able to reproduce the problem on any other systems running Ubuntu 12.04 32-bit. Note that this flag has no effect on non-Phusion Passenger code.
 
1885
</p>
 
1886
</dd>
 
1887
</dl></div>
 
1888
<div class="admonitionblock">
 
1889
<table><tr>
 
1890
<td class="icon">
 
1891
<img src="./images/icons/note.png" alt="Note">
 
1892
</td>
 
1893
<td class="content">If you run the installer with <span class="monospaced">sudo</span> then environment variables may not be passed properly. Learn more at <a href="#env_vars_and_sudo">Environment variables and sudo</a>.</td>
 
1894
</tr></table>
 
1895
</div>
 
1896
</div>
 
1897
<div class="sect3">
 
1898
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_forcing_location_of_command_line_tools_and_dependencies"></span><h4 data-comment-topic="forcing-location-of-command-line-tools-and-dependencies-xajpg1" data-anchor="_forcing_location_of_command_line_tools_and_dependencies">2.9.3. Forcing location of command line tools and dependencies</h4>
 
1899
<div class="paragraph"><p>The Phusion Passenger build system attempts to autodetect many things by locating relevant helper tools. For example, to find out which compiler flags it should use for compiling Apache modules, it locates the <span class="monospaced">apxs2</span> command and queries it. To find out which compiler flags it should use for libcurl, it queries the <span class="monospaced">curl-config</span> command. These commands may not be in <span class="monospaced">$PATH</span>, or even when they are you may want to use a different one.</p></div>
 
1900
<div class="paragraph"><p>You can force the build to find certain command line tools at certain locations by using the following environment variables:</p></div>
 
1901
<div class="dlist"><dl>
 
1902
<dt class="hdlist1">
 
1903
<span class="monospaced">HTTPD</span>
 
1904
</dt>
 
1905
<dd>
 
1906
<p>
 
1907
        The location of the <span class="monospaced">httpd</span> executable (the Apache server executable).
 
1908
</p>
 
1909
</dd>
 
1910
<dt class="hdlist1">
 
1911
<span class="monospaced">APXS2</span>
 
1912
</dt>
 
1913
<dd>
 
1914
<p>
 
1915
        The location of the <span class="monospaced">apxs2</span> executable (the Apache module developer tool). Only used by <span class="monospaced">passenger-install-apache2-module</span>.
 
1916
</p>
 
1917
<div class="paragraph"><p>This environment variable, together with <span class="monospaced">HTTPD</span>, are what you need to customize if you have multiple Apache installations on your system, or if your Apache is located in a non-standard location which Phusion Passenger cannot detect. By setting <span class="monospaced">APXS2</span> and <span class="monospaced">HTTP</span> to the right paths, you can force Phusion Passenger to be compiled against that specific Apache installation.</p></div>
 
1918
<div class="paragraph"><p>For example, if your Apache installation is located in <span class="monospaced">/opt/lamp/apache2</span>, then you can run the installer as follows:</p></div>
 
1919
<div class="listingblock">
 
1920
<div class="content monospaced">
 
1921
<pre>$ sudo bash
 
1922
# export HTTPD=/opt/lampp/apache2/bin/apache
 
1923
# export APXS2=/opt/lampp/apache2/bin/apxs
 
1924
# passenger-install-apache2-module</pre>
 
1925
</div>
 
1926
</div>
 
1927
</dd>
 
1928
<dt class="hdlist1">
 
1929
<span class="monospaced">APR_CONFIG</span>
 
1930
</dt>
 
1931
<dd>
 
1932
<p>
 
1933
        The location of the <span class="monospaced">apr-config</span> executable (the Apache Portable Runtime developer tool).
 
1934
</p>
 
1935
</dd>
 
1936
<dt class="hdlist1">
 
1937
<span class="monospaced">APU_CONFIG</span>
 
1938
</dt>
 
1939
<dd>
 
1940
<p>
 
1941
        The location of the <span class="monospaced">apu-config</span> executable (the Apache Portable Runtime Utility developer tool).
 
1942
</p>
 
1943
</dd>
 
1944
<dt class="hdlist1">
 
1945
<span class="monospaced">MAKE</span>
 
1946
</dt>
 
1947
<dd>
 
1948
<p>
 
1949
        The location of a <span class="monospaced">make</span> tool. It does not matter which implementation of <span class="monospaced">make</span> this is.
 
1950
</p>
 
1951
</dd>
 
1952
<dt class="hdlist1">
 
1953
<span class="monospaced">GMAKE</span>
 
1954
</dt>
 
1955
<dd>
 
1956
<p>
 
1957
        The location of the GNU-compatible <span class="monospaced">make</span> tool.
 
1958
</p>
 
1959
</dd>
 
1960
</dl></div>
 
1961
<div class="admonitionblock">
 
1962
<table><tr>
 
1963
<td class="icon">
 
1964
<img src="./images/icons/tip.png" alt="Tip">
 
1965
</td>
 
1966
<td class="content">If you do not know what environment variables are, or how to use them, then please read <a href="#env_vars_and_sudo">Environment variables and sudo</a>.
 
1967
NOTE: If you run the installer with <span class="monospaced">sudo</span> then environment variables may not be passed properly. Learn more at <a href="#env_vars_and_sudo">Environment variables and sudo</a>.</td>
 
1968
</tr></table>
 
1969
</div>
 
1970
</div>
 
1971
</div>
 
1972
<div class="sect2">
 
1973
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="uninstalling"></span><h3 data-comment-topic="uninstalling-3hpprb" data-anchor="uninstalling">2.10. Uninstalling</h3>
 
1974
<div class="ulist"><ul>
 
1975
<li>
 
1976
<p>
 
1977
If you installed Phusion Passenger via a Ruby gem, then run <span class="monospaced">gem uninstall passenger</span> (or, if you’re a <a href="https://www.phusionpassenger.com/enterprise">Phusion Passenger Enterprise</a> user, <span class="monospaced">gem uninstall passenger-enterprise-server</span>).
 
1978
  You <a href="#is_ruby_home_or_system_wide_installed">might have to run this as root</a>.
 
1979
</p>
 
1980
</li>
 
1981
<li>
 
1982
<p>
 
1983
If you installed Phusion Passenger via a source tarball, then remove the directory
 
1984
  in which you placed the extracted Phusion Passenger files. This directory is the
 
1985
  same as the one pointed to the by <span class="monospaced">PassengerRoot</span>/<span class="monospaced">passenger_root</span> configuration directive.
 
1986
</p>
 
1987
</li>
 
1988
<li>
 
1989
<p>
 
1990
If you installed Phusion Passenger through APT or YUM, then use them to uninstall Phusion Passenger.
 
1991
</p>
 
1992
</li>
 
1993
<li>
 
1994
<p>
 
1995
If you installed Phusion Passenger through Homebrew, then run <span class="monospaced">brew uninstall passenger</span>.
 
1996
</p>
 
1997
</li>
 
1998
</ul></div>
 
1999
</div>
 
2000
<div class="sect2">
 
2001
<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-to-a-different-directory-b3lpy1" data-anchor="moving_phusion_passenger">2.11. Moving to a different directory</h3>
 
2002
<div class="paragraph"><p>If you installed Phusion Passenger through a tarball then you can move the Phusion Passenger directory to another location. This is not possible if you used any of the other installation methods.</p></div>
 
2003
<div class="paragraph"><p>First, move the directory to whereever you like:</p></div>
 
2004
<div class="listingblock">
 
2005
<div class="content monospaced">
 
2006
<pre>mv /opt/passenger/passenger-4.0.0 /usr/local/passenger-4.0.0</pre>
 
2007
</div>
 
2008
</div>
 
2009
<div class="paragraph"><p>If you used <a href="#tarball_generic_install">the tarball installation method</a> and you added Phusion Passenger’s <span class="monospaced">bin</span> subdirectory to <span class="monospaced">PATH</span>, then you must update your PATH with the new location. Open <span class="monospaced">/etc/bashrc</span> (or <span class="monospaced">/etc/bash.bashrc</span> on some systems) and change:</p></div>
 
2010
<div class="listingblock">
 
2011
<div class="content monospaced">
 
2012
<pre>export PATH=/opt/passenger/passenger-4.0.0/bin:$PATH</pre>
 
2013
</div>
 
2014
</div>
 
2015
<div class="paragraph"><p>to:</p></div>
 
2016
<div class="listingblock">
 
2017
<div class="content monospaced">
 
2018
<pre>export PATH=/usr/local/passenger-4.0.0/bin:$PATH</pre>
 
2019
</div>
 
2020
</div>
 
2021
<div class="paragraph"><p>Finally, restart all your shell sessions to activate the PATH change.</p></div>
 
2022
</div>
1179
2023
</div>
1180
2024
</div>
1181
2025
<div class="sect1">
1187
2031
<pre>passenger start</pre>
1188
2032
</div>
1189
2033
</div>
1190
 
<div class="paragraph"><p>This will start Phusion Passenger on port 3000. If you want to run it on a different port,
1191
 
use the <span class="monospaced">-p</span> option, e.g.:</p></div>
1192
 
<div class="listingblock">
1193
 
<div class="content monospaced">
1194
 
<pre>sudo passenger start -p 80</pre>
1195
 
</div>
1196
 
</div>
 
2034
</div>
 
2035
</div>
 
2036
<div class="sect1">
 
2037
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_configuration"></span><h2 data-comment-topic="configuration-10trfau" data-anchor="_configuration">4. Configuration</h2>
 
2038
<div class="sectionbody">
 
2039
<div class="sect2">
 
2040
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_command_line_options"></span><h3 data-comment-topic="command-line-options-1njv6kt" data-anchor="_command_line_options">4.1. Command line options</h3>
 
2041
<div class="paragraph"><p>Most configuration is done by customizing the arguments passed to the <span class="monospaced">passenger</span> command. The most important ones are:</p></div>
 
2042
<div class="dlist"><dl>
 
2043
<dt class="hdlist1">
 
2044
<span class="monospaced">--port NUMBER</span>
 
2045
</dt>
 
2046
<dd>
 
2047
<p>
 
2048
        The port number that Phusion Passenger should listen on. Defaults to 3000.
 
2049
</p>
 
2050
</dd>
 
2051
<dt class="hdlist1">
 
2052
<span class="monospaced">--environment NAME</span>
 
2053
</dt>
 
2054
<dd>
 
2055
<p>
 
2056
        Customizes the value of the <span class="monospaced">RAILS_ENV</span>, <span class="monospaced">RACK_ENV</span>, <span class="monospaced">WSGI_ENV</span>, <span class="monospaced">NODE_ENV</span> and <span class="monospaced">PASSENGER_ENV</span> environment variables. Some web frameworks, for example Rails and Connect.js, adjust their behavior according to the environment. The default value is <em>development</em>.
 
2057
</p>
 
2058
</dd>
 
2059
<dt class="hdlist1">
 
2060
<span class="monospaced">--max-pool-size NUMBER</span>
 
2061
</dt>
 
2062
<dd>
 
2063
<p>
 
2064
        The maximum number of application processes to run. The maximum number that you can run depends on the amount of memory your server has. The article <a href="http://blog.phusion.nl/2013/03/12/tuning-phusion-passengers-concurrency-settings/">Tuning Phusion Passenger’s concurrency settings</a> explains how you can infer a good number for this option.
 
2065
</p>
 
2066
</dd>
 
2067
<dt class="hdlist1">
 
2068
<span class="monospaced">--min-instances NUMBER</span>
 
2069
</dt>
 
2070
<dd>
 
2071
<p>
 
2072
        If you don’t want the number of application processes to scale dynamically, then use this option to set it to a value equal to <span class="monospaced">--max-pool-size</span>.
 
2073
</p>
 
2074
</dd>
 
2075
<dt class="hdlist1">
 
2076
<span class="monospaced">--spawn-method NAME</span>
 
2077
</dt>
 
2078
<dd>
 
2079
<p>
 
2080
        When set to "smart" (the default), Phusion Passenger preloads your app and utilizes copy-on-write in order to save memory. You can disable this by setting this option to "direct". Preloading is only supported for Ruby apps. For apps written in other languages, it is as if "direct" is always used.
 
2081
</p>
 
2082
</dd>
 
2083
<dt class="hdlist1">
 
2084
<span class="monospaced">--no-friendly-error-pages</span>
 
2085
</dt>
 
2086
<dd>
 
2087
<p>
 
2088
        If your app fails to start, Phusion Passenger will tell you by showing a friendly error page in the browser. This option disables it.
 
2089
</p>
 
2090
</dd>
 
2091
<dt class="hdlist1">
 
2092
<span class="monospaced">--ssl</span>
 
2093
</dt>
 
2094
<dd>
 
2095
<p>
 
2096
        Enables SSL support. If this is set, you must also set <span class="monospaced">--ssl-certificate</span> and <span class="monospaced">--ssl-certificate-key</span> to the SSL certificate and key files, respectively.
 
2097
</p>
 
2098
</dd>
 
2099
</dl></div>
1197
2100
<div class="paragraph"><p>See <span class="monospaced">--help</span> for all available options.</p></div>
1198
2101
</div>
 
2102
<div class="sect2">
 
2103
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="config_file"></span><h3 data-comment-topic="configuration-file-xng7yp" data-anchor="config_file">4.2. Configuration file</h3>
 
2104
<div class="paragraph"><p><strong>Introduced in version 4.0.24.</strong></p></div>
 
2105
<div class="paragraph"><p>It is possible to store some options in a configuration file <span class="monospaced">passenger-standalone.json</span> in the application directory. Configuration in this file overrides command line options. The configuration file format is JSON.</p></div>
 
2106
<div class="paragraph"><p>In case Passenger Standalone is in <a href="#mass_deployment">mass deployment mode</a>, such a configuration file allows customizing options on a per-application basis.</p></div>
 
2107
<div class="paragraph"><p>The following configuration options are supported:</p></div>
 
2108
<div class="dlist"><dl>
 
2109
<dt class="hdlist1">
 
2110
<span class="monospaced">port</span>
 
2111
</dt>
 
2112
<dd>
 
2113
<p>
 
2114
        Equivalent to the <span class="monospaced">--port</span> command line option.
 
2115
</p>
 
2116
</dd>
 
2117
<dt class="hdlist1">
 
2118
<span class="monospaced">environment</span>
 
2119
</dt>
 
2120
<dd>
 
2121
<p>
 
2122
        Equivalent to the <span class="monospaced">--environment</span> command line option.
 
2123
</p>
 
2124
</dd>
 
2125
<dt class="hdlist1">
 
2126
<span class="monospaced">max_pool_size</span>
 
2127
</dt>
 
2128
<dd>
 
2129
<p>
 
2130
        Equivalent to the <span class="monospaced">--max-pool-size</span> command line option. But when in mass deployment mode, this option in the configuration file has no effect; the command line option should be used to customize this.
 
2131
</p>
 
2132
</dd>
 
2133
<dt class="hdlist1">
 
2134
<span class="monospaced">min_instances</span>
 
2135
</dt>
 
2136
<dd>
 
2137
<p>
 
2138
        Equivalent to the <span class="monospaced">--min-instances</span> command line option.
 
2139
</p>
 
2140
</dd>
 
2141
<dt class="hdlist1">
 
2142
<span class="monospaced">spawn_method</span>
 
2143
</dt>
 
2144
<dd>
 
2145
<p>
 
2146
        Equivalent to the <span class="monospaced">--spawn-method</span> command line option.
 
2147
</p>
 
2148
</dd>
 
2149
<dt class="hdlist1">
 
2150
<span class="monospaced">ssl</span>
 
2151
</dt>
 
2152
<dd>
 
2153
<p>
 
2154
        Equivalent to the <span class="monospaced">--ssl</span> command line option. When given, you must also set <span class="monospaced">ssl_certificate</span> and <span class="monospaced">ssl_certificate_key</span> in the configuration file.
 
2155
</p>
 
2156
<div class="paragraph"><p>When in mass deployment mode, you will probably want to set a different <span class="monospaced">port</span> too. If you don’t, and you end up in a situation in which a port is used for both HTTP and HTTPS traffic, then the builtin Nginx core will abort with an error.</p></div>
 
2157
</dd>
 
2158
</dl></div>
 
2159
<div class="paragraph"><p>Here is an example configuration file:</p></div>
 
2160
<div class="listingblock">
 
2161
<div class="content">
 
2162
<!-- Generator: GNU source-highlight 2.11.1
 
2163
by Lorenzo Bettini
 
2164
http://www.lorenzobettini.it
 
2165
http://www.gnu.org/software/src-highlite -->
 
2166
<pre><tt><span style="color: #FF0000">{</span>
 
2167
        <span style="color: #FF0000">"port"</span><span style="color: #990000">:</span> <span style="color: #993399">8000</span><span style="color: #990000">,</span>
 
2168
        <span style="color: #FF0000">"environment"</span><span style="color: #990000">:</span> <span style="color: #FF0000">"production"</span><span style="color: #990000">,</span>
 
2169
        <span style="color: #FF0000">"ssl"</span><span style="color: #990000">:</span> <span style="font-weight: bold"><span style="color: #0000FF">true</span></span><span style="color: #990000">,</span>
 
2170
        <span style="color: #FF0000">"ssl_certificate"</span><span style="color: #990000">:</span> <span style="color: #FF0000">"/path-to-cert.crt"</span><span style="color: #990000">,</span>
 
2171
        <span style="color: #FF0000">"ssl_certificate_key"</span><span style="color: #990000">:</span> <span style="color: #FF0000">"/path-to-cert.key"</span>
 
2172
<span style="color: #FF0000">}</span></tt></pre>
 
2173
</div>
 
2174
</div>
 
2175
</div>
 
2176
<div class="sect2">
 
2177
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_advanced_configuration"></span><h3 data-comment-topic="advanced-configuration-e3v4pk" data-anchor="_advanced_configuration">4.3. Advanced configuration</h3>
 
2178
<div class="paragraph"><p>Phusion Passenger Standalone is built on the same technology that powers <a href="Users%20guide%20Nginx.html">Phusion Passenger for Nginx</a>, so any configuration option supported by Phusion Passenger for Nginx can be applied to Standalone as well. You can do this by editing the Standalone configuration template directly.</p></div>
 
2179
<div class="paragraph"><p>First, go to the directory where Phusion Passenger is installed:</p></div>
 
2180
<div class="listingblock">
 
2181
<div class="content monospaced">
 
2182
<pre>cd $(passenger-config --root)</pre>
 
2183
</div>
 
2184
</div>
 
2185
<div class="paragraph"><p>Then open the file <span class="monospaced">resources/templates/standalone/config.erb</span>.</p></div>
 
2186
<div class="admonitionblock">
 
2187
<table><tr>
 
2188
<td class="icon">
 
2189
<img src="./images/icons/note.png" alt="Note">
 
2190
</td>
 
2191
<td class="content">If you installed Phusion Passenger using the Debian or Ubuntu packages, then the filename is <span class="monospaced">/usr/share/passenger/templates/standalone/config.erb</span> or <span class="monospaced">/usr/share/passenger-enterprise/templates/standalone/config.erb</span>.</td>
 
2192
</tr></table>
 
2193
</div>
 
2194
<div class="paragraph"><p>Please note that changes to this file only last until you reinstall or upgrade Phusion Passenger. We are currently working on a mechanism for permanently editing the configuration file.</p></div>
 
2195
</div>
 
2196
</div>
 
2197
</div>
 
2198
<div class="sect1">
 
2199
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_using_passenger_standalone_in_production"></span><h2 data-comment-topic="using-passenger-standalone-in-production-1i7yjcz" data-anchor="_using_passenger_standalone_in_production">5. Using Passenger Standalone in production</h2>
 
2200
<div class="sectionbody">
 
2201
<div class="sect2">
 
2202
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="starting_at_system_boot"></span><h3 data-comment-topic="starting-passenger-standalone-at-system-boot-jpem2b" data-anchor="starting_at_system_boot">5.1. Starting Passenger Standalone at system boot</h3>
 
2203
<div class="paragraph"><p>The easiest way to have Passenger Standalone started during system boot is add it to the file <span class="monospaced">/etc/rc.local</span>. This script is called during system boot.</p></div>
 
2204
<div class="paragraph"><p>Here’s an example of what you may want to add to <span class="monospaced">/etc/rc.local</span>. If there is an <span class="monospaced">exit</span> command in <span class="monospaced">rc.local</span>, make sure you add these <em>before</em> the <span class="monospaced">exit</span> command.</p></div>
 
2205
<div class="listingblock">
 
2206
<div class="content">
 
2207
<!-- Generator: GNU source-highlight 2.11.1
 
2208
by Lorenzo Bettini
 
2209
http://www.lorenzobettini.it
 
2210
http://www.gnu.org/software/src-highlite -->
 
2211
<pre><tt><span style="font-style: italic"><span style="color: #9A1900"># If you installed Phusion Passenger from tarball, add its `bin` directory to PATH.</span></span>
 
2212
<span style="font-style: italic"><span style="color: #9A1900">#export PATH=/path-to-passenger/bin:$PATH</span></span>
 
2213
 
 
2214
<span style="font-style: italic"><span style="color: #9A1900"># Change working directory to your webapp.</span></span>
 
2215
cd /path-to-your-webapp
 
2216
 
 
2217
<span style="font-style: italic"><span style="color: #9A1900"># Start Passenger Standalone in daemonized mode. Passenger will be started as</span></span>
 
2218
<span style="font-style: italic"><span style="color: #9A1900"># root when run from this file, so we also tell it to drop its privileges to a</span></span>
 
2219
<span style="font-style: italic"><span style="color: #9A1900"># normal user. Replace 'someusername' with the user you want to run your</span></span>
 
2220
<span style="font-style: italic"><span style="color: #9A1900"># application under.</span></span>
 
2221
passenger start --daemonize --port <span style="color: #993399">80</span> --user someusername</tt></pre>
 
2222
</div>
 
2223
</div>
 
2224
</div>
 
2225
</div>
 
2226
</div>
 
2227
<div class="sect1">
 
2228
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="mass_deployment"></span><h2 data-comment-topic="mass-deployment-1xqriy4" data-anchor="mass_deployment">6. Mass deployment</h2>
 
2229
<div class="sectionbody">
 
2230
<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>
 
2231
<div class="paragraph"><p>Mass deployment is a special mode in Phusion Passenger Standalone that allows you to deploy multiple web applications without having to create configuration entries for each one of them. Given a directory with multiple web applications, Passenger Standalone will automatically give each web application its own virtual host entry, and serve all of them from a single server. The virtual host’s server name is equal to the web application’s directory name. Whenever a new web application is added or removed, Passenger Standalone automatically reconfigures itself without administrator intervention. This makes the mass deployment mode especially useful when there are a large number of web applications.</p></div>
 
2232
<div class="paragraph"><p>For example, suppose we have a directory <span class="monospaced">/webapps</span> with three web applications: Ruby app, a Python app and a Node.js app.</p></div>
 
2233
<div class="listingblock">
 
2234
<div class="content monospaced">
 
2235
<pre>/webapps
 
2236
  |
 
2237
  +-- rubyapp.com
 
2238
  |    |
 
2239
  |    +-- config.ru
 
2240
  |
 
2241
  +-- pythonapp.com
 
2242
  |    |
 
2243
  |    +-- passenger_wsgi.py
 
2244
  |
 
2245
  +-- nodeapp.com
 
2246
       |
 
2247
       +-- app.js</pre>
 
2248
</div>
 
2249
</div>
 
2250
<div class="paragraph"><p>You can activate Passenger Standalone in mass deployment mode by changing the working directory to <span class="monospaced">/webapps</span> and running <span class="monospaced">passenger start</span>:</p></div>
 
2251
<div class="listingblock">
 
2252
<div class="content monospaced">
 
2253
<pre>$ cd /webapps
 
2254
$ passenger start
 
2255
=============== Phusion Passenger Standalone web server started ===============
 
2256
PID file: /webapps/passenger.3000.pid
 
2257
Log file: /webapps/passenger.3000.log
 
2258
Environment: development
 
2259
 
 
2260
Serving these applications on 0.0.0.0 port 3000:
 
2261
 Host name                     Directory
 
2262
.-----------------------------------------------------------
 
2263
 rubyapp.com                   /webapps/rubyapp.com
 
2264
 pythonapp.com                 /webapps/pythonapp.com
 
2265
 nodeapp.com                   /webapps/nodeapp.com
 
2266
.-----------------------------------------------------------</pre>
 
2267
</div>
 
2268
</div>
 
2269
<div class="paragraph"><p>If you for example remove <span class="monospaced">/webapps/rubyapp.com</span>, Passenger Standalone will reconfigure itself without that web application. Or if you add a new web applications <span class="monospaced">/webapps/newapp.org</span>, Passenger Standalone will reconfigure itself with that web application.</p></div>
 
2270
<div class="paragraph"><p>Any options that you pass to the <span class="monospaced">passenger</span> command will affect all deployed web applications. It is also possible to change options on a per-application basis through the use of <a href="#config_file">a <span class="monospaced">passenger-standalone.json</span> file inside each application’s directory</a>.</p></div>
 
2271
</div>
 
2272
</div>
 
2273
<div class="sect1">
 
2274
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="troubleshooting"></span><h2 data-comment-topic="troubleshooting-o7g75o" data-anchor="troubleshooting">7. Troubleshooting</h2>
 
2275
<div class="sectionbody">
 
2276
<div class="sect2">
 
2277
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_generic_troubleshooting_tips"></span><h3 data-comment-topic="generic-troubleshooting-tips-2vokcr" data-anchor="_generic_troubleshooting_tips">7.1. Generic troubleshooting tips</h3>
 
2278
<div class="paragraph"><p>One of the first things you should do upon encountering a problem, is to check
 
2279
Phusion Passenger Standalone log file. This is typically located in <span class="monospaced">log/passenger.[PORT NUMBER].log</span>. Most problems are logged to this log file.</p></div>
 
2280
<div class="paragraph"><p>If neither the logs nor this troubleshooting guide can help you, then please check out our <a href="#where_to_get_support">support resources</a>.</p></div>
 
2281
</div>
 
2282
<div class="sect2">
 
2283
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_upon_uploading_a_file_phusion_passenger_reports_client_body_temp_00000000xx_failed_2_no_such_file_or_directory"></span><h3 data-comment-topic="upon-uploading-a-file-phusion-passenger-reports-client-body-temp-00000000xx-failed-2-no-such-file-or-directory--d01goe" data-anchor="_upon_uploading_a_file_phusion_passenger_reports_client_body_temp_00000000xx_failed_2_no_such_file_or_directory">7.2. Upon uploading a file, Phusion Passenger reports "client_body_temp/00000000xx failed (2: No such file or directory)"</h3>
 
2284
<div class="dlist"><dl>
 
2285
<dt class="hdlist1">
 
2286
<strong>Symptoms</strong>
 
2287
</dt>
 
2288
<dd>
 
2289
<p>
 
2290
        When performing an HTTP POST call, the request sometimes fails, with Phusion Passenger reporting an error along the lines of:
 
2291
</p>
 
2292
<div class="listingblock">
 
2293
<div class="content monospaced">
 
2294
<pre>/tmp/passenger-standalone.8583/client_body_temp/0000000022" failed (2: No such
 
2295
file or directory), client: 127.0.0.1, server: www.foo.com</pre>
 
2296
</div>
 
2297
</div>
 
2298
</dd>
 
2299
<dt class="hdlist1">
 
2300
<strong>Cause</strong>
 
2301
</dt>
 
2302
<dd>
 
2303
<p>
 
2304
        Phusion Passenger buffers HTTP POST bodies (file uploads) to a temporary directory, by default <span class="monospaced">/tmp/passenger-standalone.xxx</span>. This error means that Phusion Passenger that that directory has been removed, probably by some other program.
 
2305
</p>
 
2306
</dd>
 
2307
<dt class="hdlist1">
 
2308
<strong>Solution</strong>
 
2309
</dt>
 
2310
<dd>
 
2311
<p>
 
2312
        Tell Phusion Passenger to use a different directory to store its temporary files passing the <span class="monospaced">--temp-dir</span> command line option. For example:
 
2313
</p>
 
2314
<div class="listingblock">
 
2315
<div class="content monospaced">
 
2316
<pre>mkdir $HOME/tmp
 
2317
cd /path-to-your-app
 
2318
passenger start --temp-dir=$HOME/tmp</pre>
 
2319
</div>
 
2320
</div>
 
2321
</dd>
 
2322
</dl></div>
 
2323
</div>
 
2324
</div>
 
2325
</div>
 
2326
<div class="sect1">
 
2327
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="about_environment_variables"></span><h2 data-comment-topic="appendix-about-environment-variables-1ct91x3" data-anchor="about_environment_variables">8. Appendix: About environment variables</h2>
 
2328
<div class="sectionbody">
 
2329
<div class="paragraph"><p>The Phusion Passenger compilation process can be customized with environment variables.</p></div>
 
2330
<div class="paragraph"><p>Environment variables are named values that affect how the system works. For example they tell the system where to look for commands (the <span class="monospaced">PATH</span> variable) or where to look for libraries (<span class="monospaced">LD_LIBRARY_PATH</span>). Their names are often in all-uppercase. Sometimes people refer to an environment variable with a dollar sign <span class="monospaced">$</span> in front, but that’s the same thing: when people say "the $PATH environment variable" they mean "the PATH environment variable". This is because the dollar sign <span class="monospaced">$</span> is a shell syntax for refering to an environment variable, as you will learn later.</p></div>
 
2331
<div class="paragraph"><p>Environment variables are set on a <strong>per-process</strong> basis, but they are <strong>inherited</strong> by child processes. This means that if you set environment variables in process A, another already running process B will not see these new environment variables. But if A spawns a child process C, then C will have all environment variables that A had. If you once again change the environment variables in A, then C will not see the changes.</p></div>
 
2332
<div class="paragraph"><p>The per-process nature of environment variables some implications. When you set environment variables in your <span class="monospaced">bashrc</span> or other bash startup files…</p></div>
 
2333
<div class="ulist"><ul>
 
2334
<li>
 
2335
<p>
 
2336
…only newly spawned bash shells see them.
 
2337
</p>
 
2338
</li>
 
2339
<li>
 
2340
<p>
 
2341
…the web server usually does not see them, because the web server tends to be started from init scripts, not from bash.
 
2342
</p>
 
2343
</li>
 
2344
<li>
 
2345
<p>
 
2346
…cron jobs do not see them, because cron jobs' environment variables are entirely dictated by their crontabs.
 
2347
</p>
 
2348
</li>
 
2349
</ul></div>
 
2350
<div class="admonitionblock">
 
2351
<table><tr>
 
2352
<td class="icon">
 
2353
<img src="./images/icons/note.png" alt="Note">
 
2354
</td>
 
2355
<td class="content">Because this chapter is meant for beginners, it assumes that the reader uses the bash shell. This chapter does not describe instructions for zsh, csh or other shells. We assume that users of other shells are familiar with the Bourne shell syntax, and know how to apply the instructions in this chapter in their shells' native syntaxes.</td>
 
2356
</tr></table>
 
2357
</div>
 
2358
<div class="sect2">
 
2359
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_working_with_environment_variables"></span><h3 data-comment-topic="working-with-environment-variables-11cmwlv" data-anchor="_working_with_environment_variables">8.1. Working with environment variables</h3>
 
2360
<div class="paragraph"><p>You can see all environment variables in your shell by running the following command:</p></div>
 
2361
<div class="listingblock">
 
2362
<div class="content">
 
2363
<!-- Generator: GNU source-highlight 2.11.1
 
2364
by Lorenzo Bettini
 
2365
http://www.lorenzobettini.it
 
2366
http://www.gnu.org/software/src-highlite -->
 
2367
<pre><tt>env</tt></pre>
 
2368
</div>
 
2369
</div>
 
2370
<div class="paragraph"><p>You can set an evironment variable with the syntax <span class="monospaced">export &lt;NAME&gt;=&lt;VALUE&gt;</span>. For example, to set the <span class="monospaced">APXS2</span> variable to the value <span class="monospaced">/usr/sbin/apxs2</span>:</p></div>
 
2371
<div class="listingblock">
 
2372
<div class="content">
 
2373
<!-- Generator: GNU source-highlight 2.11.1
 
2374
by Lorenzo Bettini
 
2375
http://www.lorenzobettini.it
 
2376
http://www.gnu.org/software/src-highlite -->
 
2377
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">export</span></span> <span style="color: #009900">APXS2</span><span style="color: #990000">=</span>/usr/sbin/apxs<span style="color: #993399">2</span></tt></pre>
 
2378
</div>
 
2379
</div>
 
2380
<div class="paragraph"><p>Any process that you run from your shell from that point on will have said environment variable:</p></div>
 
2381
<div class="listingblock">
 
2382
<div class="content">
 
2383
<!-- Generator: GNU source-highlight 2.11.1
 
2384
by Lorenzo Bettini
 
2385
http://www.lorenzobettini.it
 
2386
http://www.gnu.org/software/src-highlite -->
 
2387
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">export</span></span> <span style="color: #009900">APXS2</span><span style="color: #990000">=</span>/usr/sbin/apxs<span style="color: #993399">2</span>
 
2388
ruby -e <span style="color: #FF0000">'p ENV["APXS2"]'</span>
 
2389
<span style="font-style: italic"><span style="color: #9A1900"># =&gt; "/usr/sbin/apxs2"</span></span></tt></pre>
 
2390
</div>
 
2391
</div>
 
2392
<div class="admonitionblock">
 
2393
<table><tr>
 
2394
<td class="icon">
 
2395
<img src="./images/icons/note.png" alt="Note">
 
2396
</td>
 
2397
<td class="content">
 
2398
<div class="title">The "export" keyword is important</div>
 
2399
<div class="paragraph"><p>You <strong>must</strong> set the <span class="monospaced">export</span> keyword. If you omit the <span class="monospaced">export</span> keyword then the environment variable will not be visible to other processes:</p></div>
 
2400
<div class="listingblock">
 
2401
<div class="content">
 
2402
<!-- Generator: GNU source-highlight 2.11.1
 
2403
by Lorenzo Bettini
 
2404
http://www.lorenzobettini.it
 
2405
http://www.gnu.org/software/src-highlite -->
 
2406
<pre><tt><span style="color: #009900">APXS2</span><span style="color: #990000">=</span>/usr/sbin/apxs<span style="color: #993399">2</span>
 
2407
ruby -e <span style="color: #FF0000">'p ENV["APXS2"]'</span>
 
2408
<span style="font-style: italic"><span style="color: #9A1900"># =&gt; nil</span></span></tt></pre>
 
2409
</div>
 
2410
</div>
 
2411
</td>
 
2412
</tr></table>
 
2413
</div>
 
2414
<div class="paragraph"><p>You can reference an environment variable in your shell by typing the <span class="monospaced">$</span> sign followed by the environment variable’s name. For example, to see the value of the <span class="monospaced">PATH</span> variable:</p></div>
 
2415
<div class="listingblock">
 
2416
<div class="content">
 
2417
<!-- Generator: GNU source-highlight 2.11.1
 
2418
by Lorenzo Bettini
 
2419
http://www.lorenzobettini.it
 
2420
http://www.gnu.org/software/src-highlite -->
 
2421
<pre><tt>echo <span style="color: #009900">$PATH</span></tt></pre>
 
2422
</div>
 
2423
</div>
 
2424
<div class="paragraph"><p>You can also use this trick to extend the value of an environment variable:</p></div>
 
2425
<div class="listingblock">
 
2426
<div class="content">
 
2427
<!-- Generator: GNU source-highlight 2.11.1
 
2428
by Lorenzo Bettini
 
2429
http://www.lorenzobettini.it
 
2430
http://www.gnu.org/software/src-highlite -->
 
2431
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">export</span></span> <span style="color: #009900">PATH</span><span style="color: #990000">=</span>/usr/bin
 
2432
 
 
2433
<span style="font-style: italic"><span style="color: #9A1900"># Prepends '/opt/local/bin', so that it becomes /opt/local/bin:/usr/bin</span></span>
 
2434
<span style="font-weight: bold"><span style="color: #0000FF">export</span></span> <span style="color: #009900">PATH</span><span style="color: #990000">=</span>/opt/local/bin<span style="color: #990000">:</span><span style="color: #009900">$PATH</span>
 
2435
<span style="font-style: italic"><span style="color: #9A1900"># Appends '/usr/local/bin', so that it becomes /opt/local/bin:/usr/bin:/usr/local/bin</span></span>
 
2436
<span style="font-weight: bold"><span style="color: #0000FF">export</span></span> <span style="color: #009900">PATH</span><span style="color: #990000">=</span><span style="color: #009900">$PATH</span><span style="color: #990000">:</span>/usr/local/bin</tt></pre>
 
2437
</div>
 
2438
</div>
 
2439
</div>
 
2440
<div class="sect2">
 
2441
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_the_path_environment_variable"></span><h3 data-comment-topic="the-path-environment-variable-yzfn3k" data-anchor="_the_path_environment_variable">8.2. The PATH environment variable</h3>
 
2442
<div class="paragraph"><p>The <span class="monospaced">PATH</span> environment variable dictates where the system looks for command. It is a colon-separated list of directories. If you get a "command not found" error while you know that the command is installed, then setting <span class="monospaced">PATH</span> will help. For example suppose that the command <span class="monospaced">frobnicator</span> is in <span class="monospaced">/opt/local/bin</span>:</p></div>
 
2443
<div class="listingblock">
 
2444
<div class="content">
 
2445
<!-- Generator: GNU source-highlight 2.11.1
 
2446
by Lorenzo Bettini
 
2447
http://www.lorenzobettini.it
 
2448
http://www.gnu.org/software/src-highlite -->
 
2449
<pre><tt>user@localhost bash$ frobnicator
 
2450
bash<span style="color: #990000">:</span> frobnicator<span style="color: #990000">:</span> <span style="font-weight: bold"><span style="color: #0000FF">command</span></span> not found</tt></pre>
 
2451
</div>
 
2452
</div>
 
2453
<div class="paragraph"><p>We verify that <span class="monospaced">/opt/local/bin</span> is not in <span class="monospaced">PATH</span>:</p></div>
 
2454
<div class="listingblock">
 
2455
<div class="content">
 
2456
<!-- Generator: GNU source-highlight 2.11.1
 
2457
by Lorenzo Bettini
 
2458
http://www.lorenzobettini.it
 
2459
http://www.gnu.org/software/src-highlite -->
 
2460
<pre><tt>user@localhost bash$ echo <span style="color: #009900">$PATH</span>
 
2461
/bin<span style="color: #990000">:</span>/usr/bin<span style="color: #990000">:</span>/usr/local/bin</tt></pre>
 
2462
</div>
 
2463
</div>
 
2464
<div class="paragraph"><p>We can run <span class="monospaced">frobnicator</span> through it’s full path…</p></div>
 
2465
<div class="listingblock">
 
2466
<div class="content">
 
2467
<!-- Generator: GNU source-highlight 2.11.1
 
2468
by Lorenzo Bettini
 
2469
http://www.lorenzobettini.it
 
2470
http://www.gnu.org/software/src-highlite -->
 
2471
<pre><tt>user@localhost bash$ /opt/local/bin/frobnicator
 
2472
<span style="font-style: italic"><span style="color: #9A1900"># =&gt; success!</span></span></tt></pre>
 
2473
</div>
 
2474
</div>
 
2475
<div class="paragraph"><p>…or we can add <span class="monospaced">/opt/local/bin</span> to <span class="monospaced">PATH</span>.</p></div>
 
2476
<div class="listingblock">
 
2477
<div class="content">
 
2478
<!-- Generator: GNU source-highlight 2.11.1
 
2479
by Lorenzo Bettini
 
2480
http://www.lorenzobettini.it
 
2481
http://www.gnu.org/software/src-highlite -->
 
2482
<pre><tt>user@localhost bash$ <span style="font-weight: bold"><span style="color: #0000FF">export</span></span> <span style="color: #009900">PATH</span><span style="color: #990000">=</span><span style="color: #009900">$PATH</span><span style="color: #990000">:</span>/opt/local/bin
 
2483
user@localhost bash$ frobnicator
 
2484
<span style="font-style: italic"><span style="color: #9A1900"># =&gt; success!</span></span></tt></pre>
 
2485
</div>
 
2486
</div>
 
2487
<div class="sect3">
 
2488
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_adding_phusion_passenger_8217_s_administration_tools_to_path"></span><h4 data-comment-topic="adding-phusion-passenger-s-administration-tools-to-path-d7k5mh" data-anchor="_adding_phusion_passenger_8217_s_administration_tools_to_path">8.2.1. Adding Phusion Passenger’s administration tools to PATH</h4>
 
2489
<div class="paragraph"><p>If you get a "command not found" error when invoking one of the Phusion Passenger administration tools (e.g. <span class="monospaced">passenger-status</span> or <span class="monospaced">passenger-memory-stats</span> then that means the tools are not in <span class="monospaced">PATH</span>, so you need to add them.</p></div>
 
2490
<div class="ulist"><ul>
 
2491
<li>
 
2492
<p>
 
2493
If you <a href="#rubygems_generic_install">installed Phusion Passenger with RubyGems</a>, then the tools are in your RubyGems executable path. You can view the gem path using the command <span class="monospaced">gem env</span>:
 
2494
</p>
 
2495
<div class="listingblock">
 
2496
<div class="content monospaced">
 
2497
<pre>$ gem env
 
2498
RubyGems Environment:
 
2499
  - RUBYGEMS VERSION: 1.8.15
 
2500
  - RUBY VERSION: 1.8.7 (2011-12-28 patchlevel 357) [i686-darwin10.8.0]
 
2501
  - INSTALLATION DIRECTORY: /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8
 
2502
  - RUBY EXECUTABLE: /opt/ruby-enterprise-1.8.7-2010.01/bin/ruby
 
2503
  - EXECUTABLE DIRECTORY: /opt/ruby-enterprise-1.8.7-2010.01/bin    &lt;--------- !!
 
2504
  - RUBYGEMS PLATFORMS:
 
2505
    - ruby
 
2506
    - x86-darwin-10
 
2507
  - GEM PATHS:
 
2508
     - /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8
 
2509
     - /Users/hongli/.gem/ruby/1.8
 
2510
  - GEM CONFIGURATION:
 
2511
     - :update_sources =&gt; true
 
2512
     - :verbose =&gt; true
 
2513
     - :benchmark =&gt; false
 
2514
     - :backtrace =&gt; false
 
2515
     - :bulk_threshold =&gt; 1000
 
2516
     - "gem" =&gt; "--no-ri --no-rdoc"
 
2517
  - REMOTE SOURCES:
 
2518
     - http://rubygems.org/</pre>
 
2519
</div>
 
2520
</div>
 
2521
<div class="paragraph"><p>As you can see, the RubyGems executable path in the example happens to be <span class="monospaced">/opt/ruby-enterprise-1.8.7-2010.01/bin</span>. So that directory must be added to <span class="monospaced">PATH</span>.</p></div>
 
2522
</li>
 
2523
<li>
 
2524
<p>
 
2525
If you <a href="#tarball_generic_install">installed Phusion Passenger using the tarball</a>, then the tools are in the <span class="monospaced">bin</span> subdirectory of the Phusion Passenger tarball directory that you extracted. For example, if you extracted <span class="monospaced">passenger-4.9.0.tar.gz</span> inside <span class="monospaced">/opt</span>, then the tools are located in <span class="monospaced">/opt/passenger-4.0.9/bin</span>. In that case, you need to add <span class="monospaced">/opt/passenger-4.0.9/bin</span> to your <span class="monospaced">PATH</span>.
 
2526
</p>
 
2527
</li>
 
2528
<li>
 
2529
<p>
 
2530
If you installed Phusion Passenger using native OS packages, then some Phusion Passenger administration tools are in <span class="monospaced">/usr/bin</span>, while others are in <span class="monospaced">/usr/sbin</span>. If you are not logged in as root, then <span class="monospaced">/usr/sbin</span> may not be in <span class="monospaced">PATH</span>, which would explain why you get a "command not found" when trying to invoke some of the tools. You should <span class="monospaced">/usr/sbin</span> to <span class="monospaced">PATH</span>.
 
2531
</p>
 
2532
</li>
 
2533
<li>
 
2534
<p>
 
2535
If you are unsure where your Phusion Passenger directory is then you can use the <span class="monospaced">find</span> command to look them up. Go to the root directory and invoke <span class="monospaced">find</span> with <span class="monospaced">sudo</span>:
 
2536
</p>
 
2537
<div class="listingblock">
 
2538
<div class="content monospaced">
 
2539
<pre>$ cd /
 
2540
$ sudo find . -name passenger-status
 
2541
/usr/local/passenger/bin/passenger-status</pre>
 
2542
</div>
 
2543
</div>
 
2544
<div class="paragraph"><p>In this example, the administration tools happen to be in <span class="monospaced">/usr/local/passenger/bin</span>, so you must add that to <span class="monospaced">PATH</span>.</p></div>
 
2545
</li>
 
2546
</ul></div>
 
2547
<div class="admonitionblock">
 
2548
<table><tr>
 
2549
<td class="icon">
 
2550
<img src="./images/icons/note.png" alt="Note">
 
2551
</td>
 
2552
<td class="content">You may still get a "command not found" when invoking the tools through sudo, even after you’ve added the relevant directory to <span class="monospaced">PATH</span>. Please read <a href="#env_vars_and_sudo">Environment variables and sudo</a> to learn more.</td>
 
2553
</tr></table>
 
2554
</div>
 
2555
</div>
 
2556
</div>
 
2557
<div class="sect2">
 
2558
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_making_environment_variables_permanent"></span><h3 data-comment-topic="making-environment-variables-permanent-mkq46d" data-anchor="_making_environment_variables_permanent">8.3. Making environment variables permanent</h3>
 
2559
<div class="paragraph"><p>When you exit your shell, the evironment variable changes are lost. There is no standard method to set environment variables system-wide, so you have to set them in different configuration files for different services.</p></div>
 
2560
<div class="sect3">
 
2561
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_bash"></span><h4 data-comment-topic="bash-hmcscc" data-anchor="_bash">8.3.1. bash</h4>
 
2562
<div class="paragraph"><p>To make environment variables permanent for future bash sessions <strong>for the current user</strong>, add them to your <span class="monospaced">~/.bashrc</span>:</p></div>
 
2563
<div class="listingblock">
 
2564
<div class="content">
 
2565
<!-- Generator: GNU source-highlight 2.11.1
 
2566
by Lorenzo Bettini
 
2567
http://www.lorenzobettini.it
 
2568
http://www.gnu.org/software/src-highlite -->
 
2569
<pre><tt>echo <span style="color: #FF0000">'export FOO=bar'</span> <span style="color: #990000">&gt;&gt;</span> <span style="color: #990000">~/.</span>bashrc
 
2570
echo <span style="color: #FF0000">'export PATH=/usr/local/bin:$PATH'</span> <span style="color: #990000">&gt;&gt;</span> <span style="color: #990000">~/.</span>bashrc</tt></pre>
 
2571
</div>
 
2572
</div>
 
2573
<div class="paragraph"><p>To make them permanent for future bash sessions <strong>for all users</strong>, add them to <span class="monospaced">/etc/bashrc</span>.</p></div>
 
2574
<div class="admonitionblock">
 
2575
<table><tr>
 
2576
<td class="icon">
 
2577
<img src="./images/icons/note.png" alt="Note">
 
2578
</td>
 
2579
<td class="content">Depending on the system, the bashrc file may have a different filename. On Debian and Ubuntu, it’s <span class="monospaced">/etc/bash.bashrc</span>.</td>
 
2580
</tr></table>
 
2581
</div>
 
2582
</div>
 
2583
<div class="sect3">
 
2584
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_apache"></span><h4 data-comment-topic="apache-15y3bm0" data-anchor="_apache">8.3.2. Apache</h4>
 
2585
<div class="admonitionblock">
 
2586
<table><tr>
 
2587
<td class="icon">
 
2588
<img src="./images/icons/note.png" alt="Note">
 
2589
</td>
 
2590
<td class="content">This subsection describes how to set environment variables on Apache itself, not on apps served through Phusion Passenger for Apache. The environment variables you set here will be passed to all apps, but you cannot customize them on a per-app basis. See also <a href="#env_vars_passenger_apps">Setting environment variables on Phusion Passenger-served apps</a>.</td>
 
2591
</tr></table>
 
2592
</div>
 
2593
<div class="paragraph"><p>On Debian and Ubuntu, with an Apache installed through apt, Apache environment variables are defined in the file <span class="monospaced">/etc/apache2/envvars</span>. This is a shell script so environment variables must be specified with the shell syntax.</p></div>
 
2594
<div class="paragraph"><p>On Red Hat, Fedora, CentOS and ScientificLinux, with an Apache installed through YUM, Apache environment variables are defined in <span class="monospaced">/etc/sysconfig/httpd</span>.</p></div>
 
2595
<div class="paragraph"><p>On OS X they are defined in <span class="monospaced">/System/Library/LaunchDaemons/org.apache.httpd.plist</span>, as explained <a href="/System/Library/LaunchDaemons/org.apache.httpd.plist">here on Stack Overflow</a>.</p></div>
 
2596
<div class="paragraph"><p>On other systems, or if you did not install Apache through the system’s package manager, the configuration file for environment variables is specific to the vendor that supplied Apache. There may not even be such a configuration file. You should contact the vendor for support.</p></div>
 
2597
</div>
 
2598
<div class="sect3">
 
2599
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_nginx"></span><h4 data-comment-topic="nginx-uarf27" data-anchor="_nginx">8.3.3. Nginx</h4>
 
2600
<div class="admonitionblock">
 
2601
<table><tr>
 
2602
<td class="icon">
 
2603
<img src="./images/icons/note.png" alt="Note">
 
2604
</td>
 
2605
<td class="content">This subsection describes how to set environment variables on Nginx itself, not on apps served through Phusion Passenger for Nginx. The environment variables you set here will be passed to all apps, but you cannot customize them on a per-app basis. See also <a href="#env_vars_passenger_apps">Setting environment variables on Phusion Passenger-served apps</a>.</td>
 
2606
</tr></table>
 
2607
</div>
 
2608
<div class="paragraph"><p>If you installed Nginx through <a href="#install_on_debian_ubuntu">the Brightbox packages</a>, then you can define environment variables in <span class="monospaced">/etc/default/nginx</span>. This is a shell script so you must use the <span class="monospaced">export FOO=bar</span> syntax.</p></div>
 
2609
<div class="paragraph"><p>Otherwise, environment variables are best set through the script which starts Nginx. For example, if you installed Nginx from source and you used
 
2610
then you should edit that script to define the environment variables. Those init scripts are regular shell scripts, so use the <span class="monospaced">export FOO=bar</span> syntax. Just make sure your set your environment variables before the script starts Nginx.</p></div>
 
2611
<div class="admonitionblock">
 
2612
<table><tr>
 
2613
<td class="icon">
 
2614
<img src="./images/icons/note.png" alt="Note">
 
2615
</td>
 
2616
<td class="content">Setting environment variables on Nginx has no effect on the <a href="#flying_passenger">Flying Passenger daemon</a> because the daemon is started seperately. You should set the environment variables in the shell right before starting the daemon.</td>
 
2617
</tr></table>
 
2618
</div>
 
2619
</div>
 
2620
<div class="sect3">
 
2621
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_cron"></span><h4 data-comment-topic="cron-6272ar" data-anchor="_cron">8.3.4. cron</h4>
 
2622
<div class="paragraph"><p>To make environment variables permanent for cron jobs, add those variables to the relevant crontab. But note that inside crontabs you cannot refer to existing environment variables with the <span class="monospaced">$</span> syntax because crontabs are not shell scripts. You have to specify the entire value.</p></div>
 
2623
<div class="listingblock">
 
2624
<div class="title">What to put in "crontab -e"</div>
 
2625
<div class="content monospaced">
 
2626
<pre># Environment variable definitions
 
2627
FOO=bar
 
2628
APXS2=/usr/sbin/apxs2
 
2629
 
 
2630
# **WRONG!** You cannot refer to existing variables with the `$` syntax!
 
2631
PATH=/usr/bin:$PATH
 
2632
# **WRONG!** You cannot use the 'export' keyword!
 
2633
export PATH=/usr/bin:/usr/local/bin
 
2634
# Correct:
 
2635
PATH=/usr/bin:/usr/local/bin
 
2636
 
 
2637
# Jobs:
 
2638
# m h  dom mon dow   command
 
2639
  * *  *   *   *     frobnicator</pre>
 
2640
</div>
 
2641
</div>
 
2642
</div>
 
2643
<div class="sect3">
 
2644
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="env_vars_passenger_apps"></span><h4 data-comment-topic="phusion-passenger-served-apps-127wbl2" data-anchor="env_vars_passenger_apps">8.3.5. Phusion Passenger-served apps</h4>
 
2645
<div class="paragraph"><p>You can pass environment variables to Phusion Passenger-served apps through various methods:</p></div>
 
2646
<div class="ulist"><ul>
 
2647
<li>
 
2648
<p>
 
2649
When running Apache, use the <span class="monospaced">PassEnv</span> and <span class="monospaced">SetEnv</span> directives of <a href="http://httpd.apache.org/docs/2.4/mod/mod_env.html">mod_env</a>. This is supported starting from Phusion Passenger 4.0.
 
2650
</p>
 
2651
</li>
 
2652
<li>
 
2653
<p>
 
2654
When running Nginx, use the <span class="monospaced">env</span> directive. Unlike Apache, Nginx’s <span class="monospaced">env</span> directive can only be set globally and cannot be customized on a per-virtual host basis.
 
2655
</p>
 
2656
</li>
 
2657
<li>
 
2658
<p>
 
2659
Through your <span class="monospaced">bashrc</span>. Starting from version 4.0, Phusion Passenger 4.0 spawns applications through bash and inherit all bash environment variables. Phusion Passenger Standalone tends to be started from the shell and thus inherits all environment variables set by the shell.
 
2660
</p>
 
2661
</li>
 
2662
<li>
 
2663
<p>
 
2664
Through Apache and Nginx, as described earlier in this chapter. Any environment variables that you set on Apache and Nginx itself are inherited by Phusion Passenger, and thus by Phusion Passenger-served apps as well.
 
2665
</p>
 
2666
</li>
 
2667
<li>
 
2668
<p>
 
2669
Through the application itself. Most programming languages provide APIs for setting environment variables. For example in Ruby you can write:
 
2670
</p>
 
2671
<div class="listingblock">
 
2672
<div class="content">
 
2673
<!-- Generator: GNU source-highlight 2.11.1
 
2674
by Lorenzo Bettini
 
2675
http://www.lorenzobettini.it
 
2676
http://www.gnu.org/software/src-highlite -->
 
2677
<pre><tt>ENV<span style="color: #990000">[</span><span style="color: #FF0000">'FOO'</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">'bar'</span></tt></pre>
 
2678
</div>
 
2679
</div>
 
2680
<div class="paragraph"><p>In Python you can write:</p></div>
 
2681
<div class="listingblock">
 
2682
<div class="content">
 
2683
<!-- Generator: GNU source-highlight 2.11.1
 
2684
by Lorenzo Bettini
 
2685
http://www.lorenzobettini.it
 
2686
http://www.gnu.org/software/src-highlite -->
 
2687
<pre><tt><span style="font-weight: bold"><span style="color: #000080">import</span></span> os
 
2688
os<span style="color: #990000">.</span>environ<span style="color: #990000">[</span><span style="color: #FF0000">'FOO'</span><span style="color: #990000">]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">'bar'</span></tt></pre>
 
2689
</div>
 
2690
</div>
 
2691
</li>
 
2692
</ul></div>
 
2693
</div>
 
2694
</div>
 
2695
<div class="sect2">
 
2696
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="env_vars_and_sudo"></span><h3 data-comment-topic="environment-variables-and-sudo-znzmif" data-anchor="env_vars_and_sudo">8.4. Environment variables and sudo</h3>
 
2697
<div class="admonitionblock">
 
2698
<table><tr>
 
2699
<td class="icon">
 
2700
<img src="./images/icons/note.png" alt="Note">
 
2701
</td>
 
2702
<td class="content">RVM users should always use the <span class="monospaced">rvmsudo</span> command instead of <span class="monospaced">sudo</span>. However all information in this section apply to <span class="monospaced">rvmsudo</span> as well.</td>
 
2703
</tr></table>
 
2704
</div>
 
2705
<div class="paragraph"><p>The <span class="monospaced">sudo</span> command resets all environment variables before running the specified command, for security reasons. So if you set environment variables before running <span class="monospaced">sudo passenger-install-xxx-module</span>, <span class="monospaced">sudo passenger-status</span> or any other commands, then the environment variables are not correctly passed to the command. You can solve this by running sudo with <span class="monospaced">-E</span> (preserve environment variables):</p></div>
 
2706
<div class="listingblock">
 
2707
<div class="content">
 
2708
<!-- Generator: GNU source-highlight 2.11.1
 
2709
by Lorenzo Bettini
 
2710
http://www.lorenzobettini.it
 
2711
http://www.gnu.org/software/src-highlite -->
 
2712
<pre><tt>user@localhost bash$ <span style="font-weight: bold"><span style="color: #0000FF">export</span></span> <span style="color: #009900">APXS2</span><span style="color: #990000">=</span>/usr/sbin/apxs<span style="color: #993399">2</span>
 
2713
user@localhost bash$ sudo -E passenger-install-apache<span style="color: #993399">2</span>-module</tt></pre>
 
2714
</div>
 
2715
</div>
 
2716
<div class="paragraph"><p>Alternatively, you can obtain a root prompt with sudo first, and <strong>then</strong> set the environment variables, before running any further commands:</p></div>
 
2717
<div class="listingblock">
 
2718
<div class="content monospaced">
 
2719
<pre>user@localhost bash$ sudo -s
 
2720
Password: ...
 
2721
root@localhost bash# export APXS2=/usr/sbin/apxs2
 
2722
root@localhost bash# passenger-install-apache2-module</pre>
 
2723
</div>
 
2724
</div>
 
2725
<div class="paragraph"><p>Note that for security reasons, <span class="monospaced">sudo</span> <strong>always resets the <span class="monospaced">PATH</span> environment variable</strong>, even if you pass <span class="monospaced">-E</span>! You can get around this problem by obtaining a root prompt first, and then set the environment variables:</p></div>
 
2726
<div class="listingblock">
 
2727
<div class="content monospaced">
 
2728
<pre>user@localhost bash$ sudo -s
 
2729
Password: ...
 
2730
root@localhost bash# export PATH=$PATH:/opt/myruby/bin
 
2731
root@localhost bash# passenger-install-apache2-module</pre>
 
2732
</div>
 
2733
</div>
 
2734
</div>
 
2735
</div>
1199
2736
</div>
1200
2737
</div>
1201
2738
<div id="footnotes"><hr></div>
1880
3417
$(document).ready(Mizuho.initializeCommenting);
1881
3418
 
1882
3419
</script>
1883
 
</body>
 
3420
</body>
1884
3421
</html>