对于 ruby​​ 1.8.7,Passenger + RVM 返回 502(passenger_root 位于 ruby​​ 1.9.3)

对于 ruby​​ 1.8.7,Passenger + RVM 返回 502(passenger_root 位于 ruby​​ 1.9.3)

我正在使用 Passenger + RVM + Nginx,为 Ruby 1.9.3 配置的 Rails 应用程序运行良好,但为 1.8.7 配置的 Rails 应用程序总是返回 502 错误。有人能发现问题吗?

我的配置如下:

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;
    }
}

我的 nginx 错误日志输出以下内容:

[ 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"

跨国公司
操作系统:Debian 7
乘客:4.0.16
rvm:1.22.7

答案1

操作系统 Debian 3.2?你确定吗?实际是 7。

502/Bad Gateway 通常意味着您的后端/上游已关闭。

你能通过 1.8.7 和 webrick 启动你的 rails 应用程序吗?我会从这一点开始调查。如果这有效

我不太了解 rails + airline + nginx-integration,但我看到 http{} (passenger-root) 和 server {} airline_ruby 中使用了 2 个不同的 rvm-path。也许这是一个问题?

顺便问一下:为什么不获得付费支持?

相关内容