@andreychumak
junior

Как решить проблему 104: Connection reset by peer?

Долго грузится сайт, иногда в итоге выдает 502 Bad Gateway

Места много, swap используется на 40/1024

А вот nginx в логах выдает ошибку
failed (104: Connection reset by peer) while reading response header from upstream


Пробовал перезагружать nginx, puma, убивал процессы.

Подскажите как решить проблему с nginx?

UPD

nginx.conf
#user  nobody;
worker_processes  1;

events {
    worker_connections  1024;
}


daemon off;
http {
gzip  on;
gzip_static on;
gzip_types text/html application/json;
include servers/*.conf;
    include       mime.types;
    default_type  application/octet-stream;


    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       80;
        server_name  localhost;

        location / {
            root   html;
            index  index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
  }
}


oil-www.conf
server {
   listen  80;
   server_name  www.example.ru;
   rewrite ^ http://example.ru$request_uri? permanent; #301 redirect
}

server{
  listen 80;
  root /home/oil/www/oil/current/apps/www/public;
  server_name example2-www.oil.ru 2016.example.ru example.ru retail.example.ru;
  client_max_body_size 50M;
  charset off;

  location ~ ^/(assets|images|system|ckeditor_assets)/  {
    root /home/oil/www/oil/current/apps/www/public;
    expires 30d;
    add_header Pragma public;
    add_header  Cache-Control public;
  }

  location / {
    try_files $uri @puma;
  }

  location @puma {
    proxy_read_timeout 18000;
    proxy_set_header  Client-Ip $remote_addr;
    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header  Host $host;
    proxy_pass  http://unix:/home/oil/www/oil/current/apps/www/tmp/sockets/puma.sock;
  }

  location /eorder6/ {
    root /home/exampleru_eorder;
  }

  location ~* /products/motul/ {
    rewrite ^ /motul_abuse redirect;
  }
  location ~* /products/motul.html {
    rewrite ^ /motul_abuse redirect;
  }
}
  • Вопрос задан
  • 9034 просмотра
Пригласить эксперта
Ответы на вопрос 1
chupasaurus
@chupasaurus
Сею рефлекторное, злое, временное
Ошибка означает, что клиент не дождался ответа от nginx и закрыл TCP-сессию.
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы