0

我一直在拉我的頭髮試圖找出這些間歇502的錯誤,有似乎已經從第一天發生1間歇502網關錯誤的Nginx /乘客/ Rails的

這通常似乎只發生在開發環境中,我認爲這是因爲我有相當多的資產正在加載。

這是在瀏覽器中的錯誤,(請記住,它始終是一個不同的文件,該文件得到了502錯誤,它可以是CSS或JS,時有時無的文件得到一個502錯誤)

GET https://example.com/assets/asset.self-368aecefa09656a2be5c72dc8e685b120363a3df812134cbd2dd998bafa179fd.js?body=1 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) 

在軌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 { 
     } 
    } 
} 

回答

0

我只是需要禁用某些寶石是被造成prolbems

評論在我的Gemfile這些行:

#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' 
+0

我不認爲這解決了錯誤你做別的也。 – harshitpthk

+0

我想我最終意識到這些寶石都不會造成問題,但它與nginx的和/或我的服務器一個更大的問題,但是我完全忘了我做了什麼來解決這個問題:/ –