2014-09-10 11 views
6

Ho un'app per rails che ho appena distribuito su Digital Ocean ed è in esecuzione su Puma e Nginx.L'app per rails in esecuzione su puma e nginx continua a morire ogni ora con Bad Gateway

Alla fine tutto ritorna è una cattiva gateway e questo è ciò che è in error.log

2014/09/09 22:23:06 [error] 5729#0: *3059 connect() to unix:///var/www/mysite/mysite_app.sock failed (111: Connection refused) while connecting to upstream, client: 67.5.19.192, server: mysite.com, request: "GET/HTTP/1.1", upstream: "http://unix:///var/www/mysite/mysite_app.sock:/", host: "mysite.com" 

Per risolvere il problema, ho appena ricomincio puma e sembra funzionare.

Come posso eseguire il debug di questo per capire perché continua a morire?

Ecco la mia nginx config:

upstream mysite { 
       server unix:///var/www/mysite/mysite_app.sock; 
     } 
     server { 
       listen 80; 
       server_name mysite.com; 
       root /var/www/mysite/current/public; 
     client_max_body_size 20M; 

       location/{ 
         proxy_pass http://mysite; # match the name of upstream directive which is defined above 
         proxy_set_header Host $host; 
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
       } 
       location ~* ^/assets/ { 
         # Per RFC2616 - 1 year maximum expiry 
         expires 1y; 
         add_header Cache-Control public; 

         # Some browsers still send conditional-GET requests if there's a 
         # Last-Modified header or an ETag header even if they haven't 
         # reached the expiry date sent in the Expires header. 
         add_header Last-Modified ""; 
         add_header ETag ""; 
         break; 
       } 
     } 

EDIT

Questo potrebbe essere causato da corto di memoria?

Ecco il mio attuale stato della memoria, ma come ho continuare a correre questo comando ogni tanto, la quantità di memoria libera scende e una volta ho riavviato puma che salta indietro fino a come 150.

$ free -m 
      total  used  free  shared buffers  cached 
Mem:   490  440   50   0   17   84 
-/+ buffers/cache:  338  151 
Swap:   0   0   0 

risposta

1

Lack la memoria può essere problematica, ma è meglio esaminare i registri puma e rails, non solo nginx. Nella cartella dell'applicazione:

tail -f log/puma* 
tail -f log/production.log 
+0

Niente mi salta nel file production.log. Non c'è il file di registro puma che ho trovato. – Catfish

Problemi correlati