504: Gateway time-out

Hey guys, my hosting shut down my server forcibly in order to update the kernel in the node and now I'm left with a broken Elgg site. I'm still trying to figure out how to fix this 504 error. I'm running nginx with cloud flare DNS. I tried repairing the database via CLI but nothing. Error logs just shows people trying to connect and time out. It's been two days since I've been trying to figure this out.

It's been working fine before the shut down. I've narrowed it down to a php-fpm fault or so it seems. When I use apache, the site works fine.