Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

315
Visualizações
Nginx + php-fpm random hang

I have a website made with Codeigniter, running on Ubuntu with Nginx and PHP-FPM. It worked fine till last night, when it started loading pages really slow, sometimes giving 504, other times loading pages fast.

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

Here's what nginx error log says:

[error] 25226#25226: *65 upstream timed out (110: Connection timed out) while reading response header from upstream, client: X.X.X.X, server: www.mydomain.ext, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php5.6-fpm.sock:", host: "www.mydomain.ext"

I've been googling and playing around with nginx and php-fpm config for the last few hours, but I couldn't solve it.

Does anyone know how to help me?

about 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

To me it looks like a problem with the FPM process management. See this link for more information. It's seems like you have static number of processes available for php-fpm and traffic is exceeding it. I was facing similar issues, but I don't remember if this was the exact error message back then. But the behavior was like you explained, some connections were really slow (Waiting for fpm?) other were returning 504.

UPDATE: To confirm my theory you should check the file /etc/php5.6/pool.d/www.conf and check this line:

pm.max_children = X

Increase the number and restart fpm. Then see if problem is solved.

about 4 years ago · Santiago Trujillo Relatório

0

Try to modify your config as follows :

pm = ondemand
pm.max_children = 200
pm.process_idle_timeout = 1s
pm.max_requests = 1000

restart fpm and your problem should be solved.

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda