RoundCube gives 504 Gateway Time-out on fresh install

The problem has been [solved].

I’m facing the same problem. I think it is because the hosts file does not contain the domain name. I solved the problem by adding the domain name to the address 127.0.0.1 in /etc/hosts.
The result is this line
127.0.0.0.1 localhost box box.domain.tld