I am trying to move a PHP Laravel application from my development computer running apache to a server running nginx. I have configured the database connection, and my Laravel app (mostly) responds with the expected page. However, there are random times when the server does not respond quickly and returns a
504 Gateway Time-out
after some time. A
service php5-fpm restart
or trying again later fixes this temporarily. I am using nginx with PHP 5.6 (through FPM), HHVM, and MySQL. I do not want to increase the maximum execution time as the script should not take this long in first place.
I suspect this is an issue with either the PHP scripts in the new environment or a configuration issue. This should not be an issue with nginx itself, as static resources are sent correctly. How can I troubleshoot and fix this?