Your scripts might be stuck in infinite loop, not producing a fatal error but causing the server to timeout the request after some time. Try installing xdebug
for your OS/distribution (php-xdebug
in recent Ubuntu versions) which will enforce a xdebug.max_nesting_level
directive that should log an actual error and a call stack to help you identify the problem.