I seem to have solved my own problem.
In case anyone ever experiences this in the future, what fixed it for me was adding a couple of lines in my nginx server config. The following lines should be added to a "server" or "location" block.
fastcgi_read_timeout 180;
proxy_read_timeout 180;
Please note that I'm currently using Flarum version 0.1.0 beta7.