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
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?.