D
D
Denis Neichev2017-07-11 09:06:34
PHP
Denis Neichev, 2017-07-11 09:06:34

Strange behavior of nginx + php7.0-fpm on Ubuntu 16.04. What could it be?

Oddities are manifested in the following:
- the site works for some time, the time is always different, it works quite quickly and without problems
- after some time *26481 recv() failed (104: Connection reset by peer) while reading response header from upstream by logs Nginxa
- reboot php-fpm and everything starts working fine again until next time
host configs in nginx

server {
  listen 80;
  server_name ;
  return 301 https://$server_name$request_uri;
}
 server {
        charset utf-8;
        client_max_body_size 128M;

        autoindex on;
  server_tokens off;

        listen 443 ssl;

  ssl_session_timeout 1d;
  ssl_session_cache shared:SSL:50m;
  ssl_session_tickets off;	
  ssl_protocols TLSv1.2;
  ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
  ssl_prefer_server_ciphers on;
  add_header Strict-Transport-Security "max-age=15768000";
  ssl_stapling on;
  ssl_stapling_verify on;	

  location / {
          try_files $uri $uri/ /index.php?$args;
                proxy_connect_timeout 300;
                proxy_send_timeout   600;
                proxy_read_timeout   600;
                proxy_buffer_size    64k;
                proxy_buffers     16 32k;
                proxy_busy_buffers_size 64k;
                proxy_temp_file_write_size 64k;
                proxy_pass_header Set-Cookie;
                proxy_redirect     off;
                proxy_hide_header  Vary;
                proxy_set_header   Accept-Encoding '';
                proxy_ignore_headers Cache-Control Expires;
                proxy_set_header   Referer $http_referer;
                proxy_set_header   Host   $host;
                proxy_set_header   Cookie $http_cookie;
                proxy_set_header   X-Real-IP  $remote_addr;
                proxy_set_header X-Forwarded-Host $host;
                proxy_set_header X-Forwarded-Server $host;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                #fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_read_timeout 300;
        }

  #ENABLE GZIP
  gzip on;
  gzip_disable "msie6";
  gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
  gzip_comp_level 5;

  #ENABLE BROWSER CACHE
  location ~* ^.+\.(woff|rss|atom|jpg|jpeg|gif|png|ico|rtf)$ {
    expires max;
  }

  location ~ /.well-known {
                allow all;
        }
}

nothing changed in the fpm/www.conf settings except
;listen = /run/php/php7.0-fpm.sock
listen = 127.0.0.1:9000

in the slow fpm log after the crash writes index.php, the one that is called by the nginxa virtual host.
I tried tuning fpm and timeouts. Didn't give any result.
Who can faced such as won? help me please

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Neichev, 2017-07-11
@dneichev

the question was closed. found the shit code of one of the developers, which looped the backend, as a result of which there was no exit from the procedure and fpm did not understand what to do. thank you all for your attention

D
Dmitry, 2017-07-11
@backender_ru

There was such a problem when FPM lay down randomly on a VPS with Debian. At the same time, the number of processes and so on did not help. Do not believe me - I removed xDebug and there were no more problems. But this is in my case.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question