Increase PHP maximum execution time in /etc/php.ini:
Increase PHP-FPM request terminate timeout in the pool configuration (/etc/php/7.2/fpm/pool.d/www.conf):
Increase Nginx FastCGI read timeout under the http section (/etc/nginx/nginx.conf or /etc/nginx/sites-available/nameofvirtualhost):