Random Nginx + php-fpm case

I have a site with Codeigniter running on Ubuntu with Nginx and PHP-FPM. It worked fine until the last night, when it started loading pages very slowly, sometimes giving 504, and sometimes quickly loading pages.

If I restart nginx or php-fpm, the site works fine for 20-30 seconds, then the problem will recur.

Here is what the nginx error log says:

[error] 25226 # 25226: * 65 timeout up (110: connection time out) when reading the response header upstream, client: XXXX, server: www.mydomain.ext, request: "GET / HTTP / 1.1", upstream: "fastcgi: // unix: /var/run/php/php5.6-fpm.sock:", host: "Www.mydomain.ext"

For the past few hours, I have been searching the Internet and playing with nginx and php-fpm config, but I could not solve it.

Does anyone know how to help me?

+6
source share
1 answer

For me, this seems like a problem with managing the FPM process. For more information, see Link. It looks like you have a static number of processes available for php-fpm, and the traffic exceeds it. I ran into similar problems, but I don’t remember if this was an exact error message. But the behavior was like you explained, some connections were very slow (expecting fpm?), Others were going at 504.

UPDATE: , /etc/php5.6/pool.d/www.conf :

pm.max_children = X

fpm. , .

0

Source: https://habr.com/ru/post/1016673/


All Articles