Intestallation gateway timeout apache creating database

I have try for more than 5 time the installation but every time I get
“# Gateway Timeout
The gateway did not receive a timely response from the upstream server or application.”

I am tring to unstall on ubuntu 18 on vps I have enought disk space, ram and processor

Is there any way to install database manually? to solve the problem?

I have found the solution setting max_connectio_timout to 600
in /etc/php/7.2/apache/php.ini