title: Rails Nginx Passenger Cannot checkout session because a spawning error occurred
body: <p>I have a Rails 3.2.14 app that deploys and operates fine on a production server.  I'm working on deploying it to another server to test changes before I push out to production.  I'm running the latest version of passenger/nginx and using Capistrano 2.12.0 with Ruby 1.9.3-p194 due to this being a legacy app and I'm trying to mimic the environment.</p>
  
  <p>I can deploy the app without a problem, but it won't spawn passenger and start up the app.  </p>
  
  <p>Here's one of the errors I get in /var/log/nginx/error.log</p>
  
  <pre><code>[ 2014-08-10 07:09:08.7782 733/7f2626fb2700 Pool2/Implementation.cpp:284 ]: Could not spawn process for application /home/d
  eploy/exigencad/current: An error occured while starting up the preloader.
    Error ID: aa5360f9
    Error details saved to: /tmp/passenger-error-0aEhJZ.html
    Message from application: cannot load such file -- bundler/setup (LoadError)
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:263:in `block in run_load_path_setup_code'
    /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:366:in `running_bundler'
    /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:261:in `run_load_path_setup_code'
    /usr/share/passenger/helper-scripts/rack-preloader.rb:100:in `preload_app'
    /usr/share/passenger/helper-scripts/rack-preloader.rb:158:in `&lt;module:App&gt;'
    /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `&lt;module:PhusionPassenger&gt;'
    /usr/share/passenger/helper-scripts/rack-preloader.rb:28:in `&lt;main&gt;'
  
  
  [ 2014-08-10 07:09:08.7874 733/7f2624c8d700 agents/HelperAgent/RequestHandler.h:2305 ]: [Client 20] Cannot checkout session
   because a spawning error occurred. The identifier of the error is . Please see earlier logs for details about the error.
  App 1521 stdout: 
  App 1521 stdout: 
  </code></pre>
  
  <p>I noticed an error about bundler but I did install the bundler gem, and here's my output running as deploy user or root user:</p>
  
  <pre><code>bundle -v
  Bundler version 1.1.4
  </code></pre>
  
  <p>Here's the specific error log file for passenger</p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
      &lt;meta name="generator" content="Phusion Passenger"&gt;
      &lt;title&gt;Web application could not be started&lt;/title&gt;
      &lt;style type="text/css"&gt;
          body {
      font-family: Verdana, 'Bitstream Vera Sans', Arial, Sans-Serif;
      font-size: 10pt;
      background: white;
      color: #222222;
      margin: 0;
      padding-top: 3em;
      padding-bottom: 3em;
      padding-left: 4.5em;
      padding-right: 4.5em;
  }
  
  h1 {
      font-size: 17pt;
      font-weight: medium;
      color: #533e72;
      border-bottom: 1px solid #533e72;
  }
  
  h1.title {
      margin-top: 0;
  }
  
  h1.error_title {
      color: red;
      border-bottom: 1px solid red;
  }
  
  a {
      text-decoration: none;
  }
  
  a:hover {
      text-decoration: underline;
  }
  
  dt {
      font-weight: bold;
      color: #280050;
  }
  
  dd {
      margin-top: 0.5em;
      margin-bottom: 1em;
  }
  
  .commands {
      border: 1px solid #b594e7;
      background: #ddc6ff;
      padding: 0.5em;
      margin: 0.5em;
      font-family: 'Bitstream Vera Sans Mono', 'Courier New', Monospace;
  }
  
  pre {
      overflow: auto;
      white-space: pre-wrap;
      text-align: left;
  }
  
  table.backtrace th {
      background: #8470a6;
      color: white;
  }
  
  table.backtrace th,
  table.backtrace td {
      padding: 0.2em;
      padding-left: 0.4em;
      padding-right: 0.4em;
  }
  
  table.backtrace tr td {
      background: #ecdfff;
  }
  
  table.backtrace tr.even td {
      background: #f7f2ff;
  }
  
  table.backtrace td.index {
      font-weight: bold;
  }
  
  #site_footer {
      border-top: solid 1px black;
      margin-top: 1em;
      padding-top: 1em;
      font-size: small;
      color: #777777;
  }
  
  #site_footer a {
      color: #65498e;
  }
  
  #site_footer a:hover {
      color: #9681d9;
  }
  
  #site_header .corporate_identity {
      display: none;
  }
  
      &lt;/style&gt;
      &lt;link rel="stylesheet" type="text/css" href="http://www.modrails.com/error_pages/1.0/error_page.css"&gt;
      &lt;style type="text/css"&gt;
          dd {
              text-align: left;
          }
  
          dd pre {
              margin-top: 0;
              margin-bottom: 0;
          }
      &lt;/style&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
      &lt;div id="site_container"&gt;
          &lt;div id="site_header"&gt;
              &lt;ul class="corporate_identity"&gt;
                  &lt;li class="logo"&gt;&lt;a href="https://www.phusionpassenger.com"&gt;&lt;span&gt;Phusion Passenger&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
          &lt;/div&gt;
          &lt;div id="site_body"&gt;
              &lt;h1 class="error_title"&gt;Web application could not be started&lt;/h1&gt;
              &lt;div id="content"&gt;
                  &lt;pre&gt;cannot load such file -- bundler/setup (LoadError)
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb:&lt;wbr&gt;36:&lt;wbr&gt;in `require&amp;apos;
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb:&lt;wbr&gt;36:&lt;wbr&gt;in `require&amp;apos;
    /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:&lt;wbr&gt;263:&lt;wbr&gt;in `block in run_load_path_setup_code&amp;apos;
    /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:&lt;wbr&gt;366:&lt;wbr&gt;in `running_bundler&amp;apos;
    /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:&lt;wbr&gt;261:&lt;wbr&gt;in `run_load_path_setup_code&amp;apos;
    /usr/share/passenger/helper-scripts/rack-preloader.rb:&lt;wbr&gt;100:&lt;wbr&gt;in `preload_app&amp;apos;
    /usr/share/passenger/helper-scripts/rack-preloader.rb:&lt;wbr&gt;158:&lt;wbr&gt;in `&amp;lt;module:&lt;wbr&gt;App&amp;gt;&amp;apos;
    /usr/share/passenger/helper-scripts/rack-preloader.rb:&lt;wbr&gt;29:&lt;wbr&gt;in `&amp;lt;module:&lt;wbr&gt;PhusionPassenger&amp;gt;&amp;apos;
    /usr/share/passenger/helper-scripts/rack-preloader.rb:&lt;wbr&gt;28:&lt;wbr&gt;in `&amp;lt;main&amp;gt;&amp;apos;
  &lt;/pre&gt;
  
                  &lt;dl&gt;
                  &lt;dt&gt;Error ID&lt;/dt&gt;
                  &lt;dd&gt;aa5360f9&lt;/dd&gt;
                  &lt;dt&gt;Application root&lt;/dt&gt;
                  &lt;dd&gt;/home/deploy/exigencad/current&lt;/dd&gt;
                  &lt;dt&gt;Environment (value of RAILS_ENV, RACK_ENV, WSGI_ENV, NODE_ENV and PASSENGER_APP_ENV)&lt;/dt&gt;
                  &lt;dd&gt;production&lt;/dd&gt;
  
                      &lt;dt&gt;Ruby interpreter command&lt;/dt&gt;
                      &lt;dd&gt;&lt;pre&gt;/home/deploy/.rbenv/shims/ruby&lt;/pre&gt;&lt;/dd&gt;
  
                  &lt;dt&gt;User and groups&lt;/dt&gt;
                  &lt;dd&gt;&lt;pre&gt;uid=&lt;wbr&gt;1000(deploy) gid=&lt;wbr&gt;1000(deploy) groups=&lt;wbr&gt;1000(deploy),&lt;wbr&gt;27(sudo)
  &lt;/pre&gt;&lt;/dd&gt;
                  &lt;dt&gt;Environment variables&lt;/dt&gt;
                  &lt;dd&gt;&lt;pre&gt;RBENV_VERSION =&lt;wbr&gt; 1.9.3-p194
  TERM =&lt;wbr&gt; xterm-256color
  SHELL =&lt;wbr&gt; /bin/bash
  PYTHONUNBUFFERED =&lt;wbr&gt; 1
  PASSENGER_DEBUG_DIR =&lt;wbr&gt; /tmp/passenger.spawn-debug.XXXX3H8hx2
  SERVER_PORT =&lt;wbr&gt; 80
  USER =&lt;wbr&gt; deploy
  DOCUMENT_ROOT =&lt;wbr&gt; /home/deploy/exigencad/current/public
  SCGI =&lt;wbr&gt; 1
  RBENV_ROOT =&lt;wbr&gt; /home/deploy/.rbenv
  REQUEST_URI =&lt;wbr&gt; /
  IN_PASSENGER =&lt;wbr&gt; 1
  RACK_ENV =&lt;wbr&gt; production
  RBENV_HOOK_PATH =&lt;wbr&gt; :&lt;wbr&gt;/home/deploy/.rbenv/rbenv.d:&lt;wbr&gt;/usr/local/etc/rbenv.d:&lt;wbr&gt;/etc/rbenv.d:&lt;wbr&gt;/usr/lib/rbenv/hooks
  REMOTE_PORT =&lt;wbr&gt; 64649
  PATH =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/bin:&lt;wbr&gt;/home/deploy/.rbenv/libexec:&lt;wbr&gt;/home/deploy/.rbenv/plugins/ruby-build/bin:&lt;wbr&gt;/usr/local/sbin:&lt;wbr&gt;/usr/local/bin:&lt;wbr&gt;/sbin:&lt;wbr&gt;/bin:&lt;wbr&gt;/usr/sbin:&lt;wbr&gt;/usr/bin
  WSGI_ENV =&lt;wbr&gt; production
  PWD =&lt;wbr&gt; /home/deploy/exigencad/current
  LANG =&lt;wbr&gt; en_US.UTF-8
  NODE_PATH =&lt;wbr&gt; /usr/share/passenger/node
  NODE_ENV =&lt;wbr&gt; production
  REMOTE_ADDR =&lt;wbr&gt; 75.89.97.25
  SERVER_NAME =&lt;wbr&gt; prod.hcems.com
  HOME =&lt;wbr&gt; /home/deploy
  SHLVL =&lt;wbr&gt; 0
  RAILS_ENV =&lt;wbr&gt; production
  RBENV_DIR =&lt;wbr&gt; /usr/share/passenger/helper-scripts
  SERVER_SOFTWARE =&lt;wbr&gt; nginx/1.6.0
  LOGNAME =&lt;wbr&gt; deploy
  QUERY_STRING =&lt;wbr&gt; 
  SERVER_ADDR =&lt;wbr&gt; 72.14.181.99
  SERVER_PROTOCOL =&lt;wbr&gt; HTTP/1.1
  PASSENGER_APP_ENV =&lt;wbr&gt; production
  REQUEST_METHOD =&lt;wbr&gt; GET
  &lt;/pre&gt;&lt;/dd&gt;
                  &lt;dt&gt;Ulimits&lt;/dt&gt;
                  &lt;dd&gt;&lt;pre&gt;Unknown&lt;/pre&gt;&lt;/dd&gt;
  
                      &lt;dt&gt;System metrics&lt;/dt&gt;
                      &lt;dd&gt;&lt;pre&gt;------------- General -------------
  Kernel version    :&lt;wbr&gt; 3.15.4-x86_64-linode45
  Uptime            :&lt;wbr&gt; 14h 3m 25s
  Load averages     :&lt;wbr&gt; 0.01%,&lt;wbr&gt; 0.22%,&lt;wbr&gt; 0.27%
  Fork rate         :&lt;wbr&gt; unknown
  
  ------------- CPU -------------
  Number of CPUs    :&lt;wbr&gt;    4
  Average CPU usage :&lt;wbr&gt;   0%  --   0% user,&lt;wbr&gt;   0% nice,&lt;wbr&gt;   0% system,&lt;wbr&gt; 100% idle
    CPU 1           :&lt;wbr&gt;   0%  --   0% user,&lt;wbr&gt;   0% nice,&lt;wbr&gt;   0% system,&lt;wbr&gt; 100% idle
    CPU 2           :&lt;wbr&gt;   0%  --   0% user,&lt;wbr&gt;   0% nice,&lt;wbr&gt;   0% system,&lt;wbr&gt; 100% idle
    CPU 3           :&lt;wbr&gt;   0%  --   0% user,&lt;wbr&gt;   0% nice,&lt;wbr&gt;   0% system,&lt;wbr&gt; 100% idle
    CPU 4           :&lt;wbr&gt;   0%  --   0% user,&lt;wbr&gt;   0% nice,&lt;wbr&gt;   0% system,&lt;wbr&gt; 100% idle
  I/O pressure      :&lt;wbr&gt;   0%
    CPU 1           :&lt;wbr&gt;   0%
    CPU 2           :&lt;wbr&gt;   0%
    CPU 3           :&lt;wbr&gt;   0%
    CPU 4           :&lt;wbr&gt;   0%
  Interference from other VMs:&lt;wbr&gt;   0%
    CPU 1                    :&lt;wbr&gt;   0%
    CPU 2                    :&lt;wbr&gt;   0%
    CPU 3                    :&lt;wbr&gt;   0%
    CPU 4                    :&lt;wbr&gt;   0%
  
  ------------- Memory -------------
  RAM total         :&lt;wbr&gt;   4002 MB
  RAM used          :&lt;wbr&gt;    205 MB (5%)
  RAM free          :&lt;wbr&gt;   3797 MB
  Swap total        :&lt;wbr&gt;    255 MB
  Swap used         :&lt;wbr&gt;      0 MB (0%)
  Swap free         :&lt;wbr&gt;    255 MB
  Swap in           :&lt;wbr&gt; unknown
  Swap out          :&lt;wbr&gt; unknown
  
  &lt;/pre&gt;&lt;/dd&gt;
  
  
                      &lt;dt&gt;General Ruby interpreter information&lt;/dt&gt;
                      &lt;dd&gt;&lt;pre&gt;RUBY_VERSION =&lt;wbr&gt; 1.9.3
  RUBY_PLATFORM =&lt;wbr&gt; x86_64-linux
  RUBY_ENGINE =&lt;wbr&gt; ruby
  RubyGems version =&lt;wbr&gt; 1.8.23
  RubyGems paths =&lt;wbr&gt; [&amp;quot;/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1&amp;quot;,&lt;wbr&gt; &amp;quot;/home/deploy/.gem/ruby/1.9.1&amp;quot;]
  &lt;/pre&gt;&lt;/dd&gt;
  
  
                      &lt;dt&gt;Ruby configuration (RbConfig::CONFIG)&lt;/dt&gt;
                      &lt;dd&gt;&lt;pre&gt;DESTDIR =&lt;wbr&gt; 
  MAJOR =&lt;wbr&gt; 1
  MINOR =&lt;wbr&gt; 9
  TEENY =&lt;wbr&gt; 1
  PATCHLEVEL =&lt;wbr&gt; 194
  INSTALL =&lt;wbr&gt; /usr/bin/install -c
  EXEEXT =&lt;wbr&gt; 
  prefix =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194
  ruby_install_name =&lt;wbr&gt; ruby
  RUBY_INSTALL_NAME =&lt;wbr&gt; ruby
  RUBY_SO_NAME =&lt;wbr&gt; ruby
  exec =&lt;wbr&gt; exec
  ruby_pc =&lt;wbr&gt; ruby-1.9.pc
  PACKAGE =&lt;wbr&gt; ruby
  BUILTIN_TRANSSRCS =&lt;wbr&gt;  newline.c
  USE_RUBYGEMS =&lt;wbr&gt; YES
  MANTYPE =&lt;wbr&gt; doc
  NROFF =&lt;wbr&gt; /usr/bin/nroff
  vendorhdrdir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/include/ruby-1.9.1/vendor_ruby
  sitehdrdir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/include/ruby-1.9.1/site_ruby
  rubyhdrdir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/include/ruby-1.9.1
  UNIVERSAL_INTS =&lt;wbr&gt; 
  UNIVERSAL_ARCHNAMES =&lt;wbr&gt; 
  configure_args =&lt;wbr&gt;  &amp;apos;--prefix=&lt;wbr&gt;/home/deploy/.rbenv/versions/1.9.3-p194&amp;apos; &amp;apos;LDFLAGS=&lt;wbr&gt;-L/home/deploy/.rbenv/versions/1.9.3-p194/lib &amp;apos; &amp;apos;CPPFLAGS=&lt;wbr&gt;-I/home/deploy/.rbenv/versions/1.9.3-p194/include &amp;apos;
  vendordir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/vendor_ruby
  sitedir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby
  ruby_version =&lt;wbr&gt; 1.9.1
  sitearch =&lt;wbr&gt; x86_64-linux
  arch =&lt;wbr&gt; x86_64-linux
  RI_BASE_NAME =&lt;wbr&gt; ri
  ridir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/share/ri
  rubylibprefix =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby
  MAKEFILES =&lt;wbr&gt; Makefile
  THREAD_MODEL =&lt;wbr&gt; pthread
  SYMBOL_PREFIX =&lt;wbr&gt; 
  EXPORT_PREFIX =&lt;wbr&gt; 
  COMMON_HEADERS =&lt;wbr&gt; 
  COMMON_MACROS =&lt;wbr&gt; 
  COMMON_LIBS =&lt;wbr&gt; 
  MAINLIBS =&lt;wbr&gt; 
  ENABLE_SHARED =&lt;wbr&gt; no
  DLDLIBS =&lt;wbr&gt;  -lc
  SOLIBS =&lt;wbr&gt; 
  LIBRUBYARG_SHARED =&lt;wbr&gt; -Wl,&lt;wbr&gt;-R -Wl,&lt;wbr&gt;/home/deploy/.rbenv/versions/1.9.3-p194/lib -L/home/deploy/.rbenv/versions/1.9.3-p194/lib 
  LIBRUBYARG_STATIC =&lt;wbr&gt; -Wl,&lt;wbr&gt;-R -Wl,&lt;wbr&gt;/home/deploy/.rbenv/versions/1.9.3-p194/lib -L/home/deploy/.rbenv/versions/1.9.3-p194/lib -lruby-static
  LIBRUBYARG =&lt;wbr&gt; -Wl,&lt;wbr&gt;-R -Wl,&lt;wbr&gt;/home/deploy/.rbenv/versions/1.9.3-p194/lib -L/home/deploy/.rbenv/versions/1.9.3-p194/lib -lruby-static
  LIBRUBY =&lt;wbr&gt; libruby-static.a
  LIBRUBY_ALIASES =&lt;wbr&gt; libruby.so
  LIBRUBY_SO =&lt;wbr&gt; libruby.so.1.9.1
  LIBRUBY_A =&lt;wbr&gt; libruby-static.a
  RUBYW_INSTALL_NAME =&lt;wbr&gt; 
  rubyw_install_name =&lt;wbr&gt; 
  LIBRUBY_DLDFLAGS =&lt;wbr&gt; 
  LIBRUBY_LDSHARED =&lt;wbr&gt; gcc -shared
  warnflags =&lt;wbr&gt; -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=&lt;wbr&gt;pointer-arith -Werror=&lt;wbr&gt;write-strings -Werror=&lt;wbr&gt;declaration-after-statement -Werror=&lt;wbr&gt;implicit-function-declaration
  debugflags =&lt;wbr&gt; -ggdb
  optflags =&lt;wbr&gt; -O3
  cxxflags =&lt;wbr&gt;  -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=&lt;wbr&gt;pointer-arith -Werror=&lt;wbr&gt;write-strings -Werror=&lt;wbr&gt;declaration-after-statement -Werror=&lt;wbr&gt;implicit-function-declaration
  cflags =&lt;wbr&gt;  -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=&lt;wbr&gt;pointer-arith -Werror=&lt;wbr&gt;write-strings -Werror=&lt;wbr&gt;declaration-after-statement -Werror=&lt;wbr&gt;implicit-function-declaration
  cppflags =&lt;wbr&gt; -I/home/deploy/.rbenv/versions/1.9.3-p194/include 
  NULLCMD =&lt;wbr&gt; :&lt;wbr&gt;
  INSTALLDOC =&lt;wbr&gt; all
  CAPITARGET =&lt;wbr&gt; nodoc
  RDOCTARGET =&lt;wbr&gt; rdoc
  EXECUTABLE_EXTS =&lt;wbr&gt; 
  ARCHFILE =&lt;wbr&gt; 
  LIBRUBY_RELATIVE =&lt;wbr&gt; no
  EXTOUT =&lt;wbr&gt; .ext
  PREP =&lt;wbr&gt; miniruby
  TEST_RUNNABLE =&lt;wbr&gt; yes
  setup =&lt;wbr&gt; Setup
  EXTSTATIC =&lt;wbr&gt; 
  STRIP =&lt;wbr&gt; strip -S -x
  TRY_LINK =&lt;wbr&gt; 
  LIBPATHENV =&lt;wbr&gt; LD_LIBRARY_PATH
  RPATHFLAG =&lt;wbr&gt;  -Wl,&lt;wbr&gt;-R%1$-s
  LIBPATHFLAG =&lt;wbr&gt;  -L%1$-s
  LINK_SO =&lt;wbr&gt; 
  LIBEXT =&lt;wbr&gt; a
  DLEXT2 =&lt;wbr&gt; 
  DLEXT =&lt;wbr&gt; so
  LDSHAREDXX =&lt;wbr&gt; g++ -shared
  LDSHARED =&lt;wbr&gt; gcc -shared
  CCDLFLAGS =&lt;wbr&gt; -fPIC
  STATIC =&lt;wbr&gt; 
  ARCH_FLAG =&lt;wbr&gt; 
  DLDFLAGS =&lt;wbr&gt; 
  ALLOCA =&lt;wbr&gt; 
  WERRORFLAG =&lt;wbr&gt; -Werror
  CHDIR =&lt;wbr&gt; cd -P
  RMALL =&lt;wbr&gt; rm -fr
  RMDIRS =&lt;wbr&gt; rmdir --ignore-fail-on-non-empty -p
  RMDIR =&lt;wbr&gt; rmdir --ignore-fail-on-non-empty
  CP =&lt;wbr&gt; cp
  RM =&lt;wbr&gt; rm -f
  PKG_CONFIG =&lt;wbr&gt; pkg-config
  DOXYGEN =&lt;wbr&gt; 
  DOT =&lt;wbr&gt; 
  MAKEDIRS =&lt;wbr&gt; /bin/mkdir -p
  MKDIR_P =&lt;wbr&gt; /bin/mkdir -p
  INSTALL_DATA =&lt;wbr&gt; /usr/bin/install -c -m 644
  INSTALL_SCRIPT =&lt;wbr&gt; /usr/bin/install -c
  INSTALL_PROGRAM =&lt;wbr&gt; /usr/bin/install -c
  SET_MAKE =&lt;wbr&gt; 
  LN_S =&lt;wbr&gt; ln -s
  NM =&lt;wbr&gt; nm
  DLLWRAP =&lt;wbr&gt; 
  WINDRES =&lt;wbr&gt; 
  OBJCOPY =&lt;wbr&gt; objcopy
  OBJDUMP =&lt;wbr&gt; objdump
  ASFLAGS =&lt;wbr&gt; 
  AS =&lt;wbr&gt; as
  AR =&lt;wbr&gt; ar
  RANLIB =&lt;wbr&gt; ranlib
  try_header =&lt;wbr&gt; 
  COUTFLAG =&lt;wbr&gt; -o 
  OUTFLAG =&lt;wbr&gt; -o 
  CPPOUTFILE =&lt;wbr&gt; -o conftest.i
  GNU_LD =&lt;wbr&gt; yes
  GCC =&lt;wbr&gt; yes
  EGREP =&lt;wbr&gt; /bin/grep -E
  GREP =&lt;wbr&gt; /bin/grep
  CPP =&lt;wbr&gt; gcc -E
  CXXFLAGS =&lt;wbr&gt;  -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=&lt;wbr&gt;pointer-arith -Werror=&lt;wbr&gt;write-strings -Werror=&lt;wbr&gt;declaration-after-statement -Werror=&lt;wbr&gt;implicit-function-declaration
  CXX =&lt;wbr&gt; g++
  OBJEXT =&lt;wbr&gt; o
  CPPFLAGS =&lt;wbr&gt; -I/home/deploy/.rbenv/versions/1.9.3-p194/include   -I/home/deploy/.rbenv/versions/1.9.3-p194/include 
  LDFLAGS =&lt;wbr&gt; -L. -L/home/deploy/.rbenv/versions/1.9.3-p194/lib  -rdynamic -Wl,&lt;wbr&gt;-export-dynamic
  CFLAGS =&lt;wbr&gt;  -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=&lt;wbr&gt;pointer-arith -Werror=&lt;wbr&gt;write-strings -Werror=&lt;wbr&gt;declaration-after-statement -Werror=&lt;wbr&gt;implicit-function-declaration
  CC =&lt;wbr&gt; gcc
  target_os =&lt;wbr&gt; linux
  target_vendor =&lt;wbr&gt; unknown
  target_cpu =&lt;wbr&gt; x86_64
  target =&lt;wbr&gt; x86_64-unknown-linux-gnu
  host_os =&lt;wbr&gt; linux-gnu
  host_vendor =&lt;wbr&gt; unknown
  host_cpu =&lt;wbr&gt; x86_64
  host =&lt;wbr&gt; x86_64-unknown-linux-gnu
  RUBYW_BASE_NAME =&lt;wbr&gt; rubyw
  RUBY_BASE_NAME =&lt;wbr&gt; ruby
  build_os =&lt;wbr&gt; linux-gnu
  build_vendor =&lt;wbr&gt; unknown
  build_cpu =&lt;wbr&gt; x86_64
  build =&lt;wbr&gt; x86_64-unknown-linux-gnu
  RUBY_RELEASE_DATE =&lt;wbr&gt; 2012-04-20
  RUBY_PROGRAM_VERSION =&lt;wbr&gt; 1.9.3
  BASERUBY =&lt;wbr&gt; echo executable host ruby is required.  use --with-baseruby option.;&lt;wbr&gt; false
  target_alias =&lt;wbr&gt; 
  host_alias =&lt;wbr&gt; 
  build_alias =&lt;wbr&gt; 
  LIBS =&lt;wbr&gt; -lpthread -lrt -ldl -lcrypt -lm 
  ECHO_T =&lt;wbr&gt; 
  ECHO_N =&lt;wbr&gt; -n
  ECHO_C =&lt;wbr&gt; 
  DEFS =&lt;wbr&gt; 
  mandir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/share/man
  localedir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/share/locale
  libdir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/lib
  psdir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/share/doc/ruby
  pdfdir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/share/doc/ruby
  dvidir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/share/doc/ruby
  htmldir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/share/doc/ruby
  infodir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/share/info
  docdir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/share/doc/ruby
  oldincludedir =&lt;wbr&gt; /usr/include
  includedir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/include
  localstatedir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/var
  sharedstatedir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/com
  sysconfdir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/etc
  datadir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/share
  datarootdir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/share
  libexecdir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/libexec
  sbindir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/sbin
  bindir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/bin
  exec_prefix =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194
  PACKAGE_URL =&lt;wbr&gt; 
  PACKAGE_BUGREPORT =&lt;wbr&gt; 
  PACKAGE_STRING =&lt;wbr&gt; 
  PACKAGE_VERSION =&lt;wbr&gt; 
  PACKAGE_TARNAME =&lt;wbr&gt; 
  PACKAGE_NAME =&lt;wbr&gt; 
  PATH_SEPARATOR =&lt;wbr&gt; :&lt;wbr&gt;
  SHELL =&lt;wbr&gt; /bin/bash
  rubylibdir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1
  archdir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux
  sitelibdir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby/1.9.1
  sitearchdir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby/1.9.1/x86_64-linux
  vendorlibdir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/vendor_ruby/1.9.1
  vendorarchdir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/vendor_ruby/1.9.1/x86_64-linux
  topdir =&lt;wbr&gt; /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux
  &lt;/pre&gt;&lt;/dd&gt;
  
  
  
                      &lt;dt&gt;Ruby load path ($LOAD_PATH)&lt;/dt&gt;
                      &lt;dd&gt;&lt;pre&gt;/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby/1.9.1
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby/1.9.1/x86_64-linux
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/vendor_ruby/1.9.1
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/vendor_ruby/1.9.1/x86_64-linux
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/vendor_ruby
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux
  &lt;/pre&gt;&lt;/dd&gt;
  
  
                      &lt;dt&gt;Ruby loaded libraries ($LOADED_FEATURES)&lt;/dt&gt;
                      &lt;dd&gt;&lt;pre&gt;enumerator.so
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/enc/encdb.so
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/enc/trans/transdb.so
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/defaults.rb
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/rbconfig.rb
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/deprecate.rb
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/exceptions.rb
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems.rb
  /usr/lib/ruby/vendor_ruby/phusion_passenger.rb
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/etc.so
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/fileutils.rb
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/tmpdir.rb
  /usr/lib/ruby/vendor_ruby/phusion_passenger/utils/tmpio.rb
  /usr/lib/ruby/vendor_ruby/phusion_passenger/platform_info.rb
  /usr/lib/ruby/vendor_ruby/phusion_passenger/platform_info/operating_system.rb
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/version.rb
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/requirement.rb
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/platform.rb
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/specification.rb
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/path_support.rb
  /usr/lib/ruby/vendor_ruby/phusion_passenger/platform_info/ruby.rb
  /usr/lib/ruby/vendor_ruby/phusion_passenger/platform_info/binary_compatibility.rb
  /home/deploy/.passenger/native_support/4.0.48/ruby-1.9.3-x86_64-linux/passenger_native_support.so
  /usr/lib/ruby/vendor_ruby/phusion_passenger/native_support.rb
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/socket.so
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/socket.rb
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/thread.rb
  /usr/lib/ruby/vendor_ruby/phusion_passenger/ruby_core_enhancements.rb
  /usr/lib/ruby/vendor_ruby/phusion_passenger/utils/tmpdir.rb
  /usr/lib/ruby/vendor_ruby/phusion_passenger/preloader_shared_helpers.rb
  /usr/lib/ruby/vendor_ruby/phusion_passenger/constants.rb
  /usr/lib/ruby/vendor_ruby/phusion_passenger/public_api.rb
  /usr/lib/ruby/vendor_ruby/phusion_passenger/debug_logging.rb
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/shellwords.rb
  /usr/lib/ruby/vendor_ruby/phusion_passenger/utils/shellwords.rb
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/fcntl.so
  /usr/lib/ruby/vendor_ruby/phusion_passenger/message_channel.rb
  /usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb
  /usr/lib/ruby/vendor_ruby/phusion_passenger/message_client.rb
  /usr/lib/ruby/vendor_ruby/phusion_passenger/utils/native_support_utils.rb
  /usr/lib/ruby/vendor_ruby/phusion_passenger/utils/unseekable_socket.rb
  /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb
  /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb
  /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/stringio.so
  /usr/lib/ruby/vendor_ruby/phusion_passenger/utils/tee_input.rb
  /usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb
  /usr/lib/ruby/vendor_ruby/phusion_passenger/union_station/connection.rb
  /usr/lib/ruby/vendor_ruby/phusion_passenger/union_station/transaction.rb
  /usr/lib/ruby/vendor_ruby/phusion_passenger/utils/lock.rb
  /usr/lib/ruby/vendor_ruby/phusion_passenger/union_station/core.rb
  &lt;/pre&gt;&lt;/dd&gt;
  
                  &lt;/dl&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div id="site_footer"&gt;
              &lt;!--
                 You are free to modify the footer as you see fit,
                 but we kindly ask of you to preserve to following
                 text. Thank you.
              --&gt;
              &lt;div class="container"&gt;
                  Powered by &lt;a href="https://www.phusionpassenger.com/"&gt;Phusion Passenger&lt;/a&gt;,
                  &lt;tt&gt;mod_rails&lt;/tt&gt; / &lt;tt&gt;mod_rack&lt;/tt&gt; for Apache and Nginx.
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here's my capistrano deploy.rb in case it helps (note, working on production server, but when I change the IP to the staging server it deploys but doesn't run rake tasks or whenever gem to set crontab):</p>
  
  <pre><code>require "bundler/capistrano"
  set :whenever_command, "bundle exec whenever"
  require "whenever/capistrano"
  
  server "72.14.181.01", :web, :app, :db, primary: true
  
  set :application, "appname"
  set :user, "deploy"
  set :deploy_to, "/home/#{user}/#{application}"
  #set :deploy_via, :remote_cache
  set :use_sudo, false
  set :rails_env, "production"
  
  
  set :scm, "git"
  set :repository, "git@github.com:appguy/#{application}.git"
  set :branch, "master"
  
  
  default_run_options[:pty] = true
  ssh_options[:forward_agent] = true
  
  after "deploy", "deploy:cleanup" # keep only the last 5 releases
  after "deploy:update", "gps_listener:restart"
  
  namespace :deploy do
    task :start do ; end
    task :stop do ; end
    task :restart, :roles =&gt; :app, :except =&gt; { :no_release =&gt; true } do
      run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
    end
    desc "reload the database with seed data"
    task :seed do
      run "cd #{current_path}; bundle exec rake db:seed RAILS_ENV=#{rails_env}"
    end
  end
  
  namespace :gps_listener do
    task :start do
      run "#{sudo} start app-gps"
    end
  
    task :stop do
      run "#{sudo} stop app-gps"
    end
  
    task :restart do
      run "#{sudo} stop app-gps &amp;&amp; sleep 1 &amp;&amp; #{sudo} start app-gps"
    end
  end
  
  task :after_update_code do
    run "ln -nfs #{deploy_to}/shared/config/database.yml #{release_path}/config/database.yml"
    run "cd #{current_path}; RAILS_ENV=#{rails_env} bundle exec rake gps:listen"
  end
  </code></pre>
  
  <p>I'll admit, it's been a long time (1-2 years) since I've had to bootstrap a new server so recreating this legacy app with new versions of passenger/nginx is proving troublesome.  I'm not sure if it's an issue with passenger itself or if it's a ruby issue.</p>
  
  <p>Here's my passenger config for nginx btw:</p>
  
  <p>/etc/nginx/nginx.conf</p>
  
  <pre><code>   passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
     passenger_ruby /home/deploy/.rbenv/shims/ruby;
  </code></pre>
  
  <p>Here's my default virtual host for /etc/nginx/site-available/default</p>
  
  <pre><code>server {
          listen 80 default_server;
          listen [::]:80 default_server ipv6only=on;
  
          server_name prod.hcems.com;
          passenger_enabled on;
          rails_env    production;
          root         /home/deploy/exigencad/current/public;
  
          # redirect server error pages to the static page /50x.html
          error_page   500 502 503 504  /50x.html;
          location = /50x.html {
              root   html;
          }
  }
  </code></pre>