Elgg cannot connect to itself to test rewrite rules properly

Hello All

I have two servers running ubuntu 18.04 my dev server is setup the same as my production server but unfortunately I have the following issue on my production server whereas my development server doesn't. 

I seem to have an issue running elgg 2.3.10 on my Ubuntu 18.04 server running Vestacp apache/nginx

I have managed to install elgg without any issues, I've set up my data directory outside the public_html directory and configured my open_basedir.

Like I said the site is working without any other issues other than when I try to use the upgrade.php I get the following error:

Elgg cannot connect to itself to test rewrite rules properly. Check that curl is working and there are no IP restrictions preventing localhost connections.
Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away in /home/tanertemel/web/t3.bolton365.net/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:104 Stack trace: #0 /home/tanertemel/web/t3.bolton365.net/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(104): PDO->query('INSERT INTO elg...') #1 /home/tanertemel/web/t3.bolton365.net/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(954): Doctrine\DBAL\Driver\PDOConnection->query('INSERT INTO elg...') #2 /home/tanertemel/web/t3.bolton365.net/public_html/vendor/elgg/elgg/engine/classes/Elgg/Database.php(443): Doctrine\DBAL\Connection->query('INSERT INTO elg...') #3 /home/tanertemel/web/t3.bolton365.net/public_html/vendor/elgg/elgg/engine/classes/Elgg/Database.php(252): Elgg\Database->executeQuery('INSERT INTO elg...', Object(Doctrine\DBAL\Connection), Array) #4 /home/tanertemel/web/t3.bolton365.net/public_html/vendor/elgg/elgg/engine/classes/Elgg/Http/DatabaseSess in /home/tanertemel/web/t3.bolton365.net/public_html/vendor/elgg/elgg/engine/classes/Elgg/Database.php on line 446

I've googled this issue but haven't managed to find any solution.

would really apreciate any help.