Another solution to this problem would be restart all of your network devices. Temporary problems with your modem, router, switches, or other networking hardware could be causing the 504 Gateway Timeout issue you're seeing. Just restarting these devices could help.