I have this problem and I can't figure out why... I have a php-fpm + nginx configuration.
I see in the php-fpm logs that every day at 0,6,12,18 hours the server kill all children and restart itself. It works, however there are like 30 seconds or so each time when nginx respons bad gateway.
Any idea what can cause this?