0

I'm using Passenger + RVM + Nginx, and my Rails applications which are configured for Ruby 1.9.3 work fine, but those for 1.8.7 always return a 502 error. Can anyone spot the trouble?

My config is as follows:

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    passenger_root /usr/local/rvm/gems/ruby-1.9.3-p448@mygems/gems/passenger-4.0
    passenger_log_level 2;
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    include /etc/nginx/conf/sites-enabled/*;

    # from sites-enabled/qa.pinneyinsurance.com
    server {
        listen       80;
        server_name  qa.pinneyinsurance.com;
        index  index.html index.htm;
        root   /var/www/pinneyinsurance.com/current/public;
        passenger_enabled on;
        passenger_ruby /usr/local/rvm/wrappers/ruby-1.8.7-p374@mygems/ruby;
    }
}

My nginx error log outputs the following:

[ 2013-09-12 08:23:56.2677 8932/7f4cd3fff700 agents/HelperAgent/RequestHandler.h:1311 ]: [Client 20] New client accepted; new client count = 1
[ 2013-09-12 08:23:56.2678 8932/7f4cd3fff700 agents/HelperAgent/RequestHandler.h:1881 ]: [Client 20] Checking out session: appRoot=/var/www/pinneyinsurance.com/current
[ 2013-09-12 08:23:56.2678 8932/7f4cd3fff700 Pool2/Pool.h:944 ]: asyncGet(appRoot=/var/www/pinneyinsurance.com/current)  
[ 2013-09-12 08:23:56.2678 8932/7f4cd3fff700 Pool2/Pool.h:949 ]: Found existing SuperGroup
[ 2013-09-12 08:23:56.2679 8932/7f4cd3fff700 Pool2/Group.h:775 ]: Session checked out from process (pid=9183, group=/var/www/pinneyinsurance.com/current#default)
[ 2013-09-12 08:23:56.2679 8932/7f4cd3fff700 Pool2/Pool.h:954 ]: asyncGet() finished
[ 2013-09-12 08:23:56.2679 8932/7f4cd3fff700 agents/HelperAgent/RequestHandler.h:1931 ]: [Client 20] Session checked out: pid=9183, gupid=15eb29b-P6mIqEOuG90
[ 2013-09-12 08:23:56.2680 8932/7f4cd3fff700 agents/HelperAgent/RequestHandler.h:2026 ]: [Client 20] Session initiated: fd=24
[ 2013-09-12 08:23:56.2680 8932/7f4cd3fff700 agents/HelperAgent/RequestHandler.h:2047 ]: [Client 20] Sending headers to application
[ 2013-09-12 08:23:56.2680 8932/7f4cd3fff700 agents/HelperAgent/RequestHandler.h:2177 ]: [Client 20] Begin sending body to application
[ 2013-09-12 08:23:56.2684 8932/7f4cd9fae700 Pool2/Implementation.cpp:1274 ]: [App 8964 stderr] [ 2013-09-12 08:23:56.2683 9183/0x7f8a68ca5770(Worker 1) request_handler/thread_handler.rb:197 ]: *** Passenger RequestHandler warning: someone tried to connect with an invalid connect password.
[ 2013-09-12 08:23:56.2684 8932/7f4cd9fae700 Pool2/Implementation.cpp:1274 ]: [App 8964 stderr] [ 2013-09-12 08:23:56.2684 9183/0x7f8a68ca5770(Worker 1) request_handler/thread_handler.rb:155 ]: No headers parsed; disconnecting client.
[ 2013-09-12 08:23:56.2685 8932/7f4cd3fff700 agents/HelperAgent/RequestHandler.h:1121 ]: [Client 20] Application sent EOF
[ 2013-09-12 08:23:56.2685 8932/7f4cd3fff700 agents/HelperAgent/RequestHandler.h:1203 ]: [Client 20] Client output pipe ended; disconnecting client
[ 2013-09-12 08:23:56.2685 8932/7f4cd3fff700 agents/HelperAgent/RequestHandler.h:577 ]: [Client 20] Disconnected; new client count = 0
[ 2013-09-12 08:23:56.2686 8932/7f4cd3fff700 Pool2/Implementation.cpp:391 ]: Session closed for process (pid=9183, group=/var/www/pinneyinsurance.com/current#default)
2013/09/12 08:23:56 [error] 8948#0: *2 upstream prematurely closed connection while reading response header from upstream, client: 10.71.16.193, server: qa.pinneyinsurance.com, request: "GET / HTTP/1.1", upstream: "passenger:/tmp/passenger.1.0.8928/generation-0/request:", host: "qa.pinneyinsurance.com"

TMI
os: Debian 7
passenger: 4.0.16
rvm: 1.22.7

JellicleCat
  • 284
  • 1
  • 3
  • 15

1 Answers1

-2

OS Debian 3.2? Are you sure? Actual is 7.

502/Bad Gateway usually means, your backend / upstream is down.

can you fire up your rails-application via 1.8.7 and webrick? i'd start to investigate from this point. if this works

i dont know much about rails + passenger + nginx-integration, but i see 2 different rvm-pathes used in http{} (passenger-root) and server {} passenger_ruby. maybe this is an issue?

btw: why not get payed support?.

  • 1. You're right, I'm running Debian 7. For my os above, I just indicated what is output by `uname -a`. – JellicleCat Sep 23 '13 at 23:08
  • 2. As for serving my 1.8.7 application without nginx, yes, I can do that. `cd && rvm use 1.8.7 && passenger start` allows it to be served correctly. – JellicleCat Sep 23 '13 at 23:09
  • 3. One can only declare `passenger_root` a single time in the nginx config, so it will always point to a different ruby than `passenger_ruby` if I am trying to use a ruby other than the primary. – JellicleCat Sep 23 '13 at 23:10
  • ok, then your problem seems to be within the passenger-part (maybe reinstall?) what does this mean (from your debug-log: `Passenger RequestHandler warning: someone tried to connect with an invalid connect password`? – that guy from over there Sep 24 '13 at 05:55
  • What it means is exactly what's in question. – JellicleCat Sep 24 '13 at 17:43
  • did you found [this](https://groups.google.com/forum/#!topic/phusion-passenger/M7m01gcKzWg) thread already? i must admit, i dont like rails/passenger that much, so my experience is limited. – that guy from over there Sep 24 '13 at 20:05
  • Yes, I had read that thread. I have not been able to interpret the penultimate post in it, however. For instance how/where does one 'set PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY=0 to disable'? (Besides which when I installed passenger, I did it on Ruby 1.9.3, and I did NOT get tigaszzz's output: 'no passenger_native_support.so found for the current Ruby interpreter'.) – JellicleCat Sep 24 '13 at 23:03