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?