Ruby on rails 4 间歇性502网关错误,Nginx/乘客/轨道

Ruby on rails 4 间歇性502网关错误,Nginx/乘客/轨道,ruby-on-rails-4,nginx,ubuntu-14.04,passenger,development-environment,Ruby On Rails 4,Nginx,Ubuntu 14.04,Passenger,Development Environment,我一直在绞尽脑汁,试图找出这些从第一天起似乎一直在发生的间歇性502错误 这通常似乎只发生在开发环境中,我假设这是因为我有相当多的正在加载的资产 这是浏览器中的错误,(请记住,总是另一个文件出现502错误,它可以是css或js,有时没有文件出现502错误) 在nginx错误日志中显示了这一点 [ 2016-11-21 13:17:43.2054 17184/7efd3bfff700 age/Cor/Con/InternalUtils.cpp:112 ]: [Client 2-66] Sendin

我一直在绞尽脑汁,试图找出这些从第一天起似乎一直在发生的间歇性502错误

这通常似乎只发生在开发环境中,我假设这是因为我有相当多的正在加载的资产

这是浏览器中的错误,(请记住,总是另一个文件出现502错误,它可以是css或js,有时没有文件出现502错误)

在nginx错误日志中显示了这一点

[ 2016-11-21 13:17:43.2054 17184/7efd3bfff700 age/Cor/Con/InternalUtils.cpp:112 ]: [Client 2-66] Sending 502 response: application did not send a complete response
[ 2016-11-21 13:17:43.2112 17184/7efd3bfff700 age/Cor/CoreMain.cpp:819 ]: Checking whether to disconnect long-running connections for process 17411, application /home/user/app/public (development)
在rails development.log中显示

Started GET "/assets/asset.self-368aecefa09656a2be5c72dc8e685b120363a3df812134cbd2dd998bafa179fd.js?body=1" for 64.72.213.76 at 2016-11-21 13:24:24 -0700
Started GET "/assets/profile.self-c0665056b47c3ab674073339b59398e0dd63f2b5080c9418e2401dee223f31c6.css?body=1" for 64.72.213.76 at 2016-11-21 13:24:25 -0700
Started GET "/assets/ratings.self-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css?body=1" for 64.72.213.76 at 2016-11-21 13:24:25 -0700
这是我的nginx.conf

user  user user;
worker_processes  1;
error_log  /var/log/nginx/error.log;
pid        /run/nginx.pid;
events {
    worker_connections  2048;
}
http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main;
    sendfile        on;
    keepalive_timeout  65;
    gzip  on;
    index   index.html index.htm;
    server {
        listen              443 ssl;
        server_name         example.com;
        ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers         HIGH:!aNULL:!MD5;
        root /home/user/app/public;

        location / {
          passenger_enabled on;
          passenger_ruby /usr/bin/ruby;
          passenger_buffers 16 32k;
          passenger_buffer_size 64k;
          passenger_intercept_errors on;
          passenger_app_env development;
          auth_basic "Restricted Content";
          auth_basic_user_file /etc/nginx/.htpasswd;
        }
    }
    client_max_body_size 20M;

    fastcgi_buffers 16 32k;
    fastcgi_buffer_size 64k;
    fastcgi_connect_timeout 300;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 300;
    proxy_buffers 8 16k;
    proxy_buffer_size 32k;
    server {
        root         /usr/share/nginx/html;
        include /etc/nginx/default.d/*.conf;

        location / {
        }
        error_page  404              /404.html;
        location = /40x.html {
        }
        location = /50x.html {
        }
    }
}

我只需要禁用一些引起问题的宝石

在我的文件中注释了以下行:

#gem 'figaro'
#gem 'therubyracer'
#gem 'cocaine'
#gem 'pry'
#gem 'pry-doc'
#gem 'roadie'
#gem 'public_activity'
#gem 'stackprof'
#gem 'activerecord-reputation-system'
#gem 'rails-perftest'
#gem 'ruby-prof'

我认为这并不能解决这个错误。您是否还做了其他任何事情。我想我最终意识到这些gem并没有造成问题,但这是nginx和/或我的服务器的一个更大的问题,但是我完全忘记了我做了什么来修复它:/
#gem 'figaro'
#gem 'therubyracer'
#gem 'cocaine'
#gem 'pry'
#gem 'pry-doc'
#gem 'roadie'
#gem 'public_activity'
#gem 'stackprof'
#gem 'activerecord-reputation-system'
#gem 'rails-perftest'
#gem 'ruby-prof'