Could you try to increase the timeouts for Apache too?
You will need to add the following 2 lines at the end of the
Then restart the services:
sudo /opt/bitnami/ctlscript.sh restart
Does it solve the issue? Can you calculate how long does it take your website to throw the
504 Gateway timeout error when you try to access to it?