Hosting: moving to Google Cloud Platform

This entry will cover on the process of moving out an entire site from old hosting to Google Cloud Platform (GPC). It is assumed that:-

  1. You have SSH access to old hosting account
  2. You already create your VM with GPC
  3. You already install web server/apache & mysql/phpmyadmin on that VM

Step 1

The initial phase is to zip your site files. Access to the old hosting via SSH and zip them:

zip – r website_folder/

Step 2

The zipped file then can be downloaded via FTP access or any file transfer you prefer, the main point is to move to GPC.

One easy alternative is to move the zipped file to a downloadable location such as:

mv website_folder/

Then from GPC SSH:

cd /var/www


Then on your old hosting SSH:

rm website_folder/

Step 3

Unzip the files on your GPC:

cd /var/www


Notes: if there is an error such as “command not found”, just install it.

sudo apt-get install unzip

Now after unzipping the files you will get website_folder in the current path, such as:


Now change the ownership:

chown -R www-data:www-data website_folder

Step 3

Let’s make a copy of database from old server. Cpanel users will be able to do this via ‘export’ function in phpmyadmin then download the SQL file, name it as website.sql

Step 4

Import the database to your GPC. Go to your VM phpmyadmin, create a database, and do the import function.

Step 5

Update apache configuration file to let it know where your files are located at.


cd /etc/apache2/sites-available/

Create a file with this content:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

Name it

Then enable it:

sudo a2ensite

sudo service apache2 restart

Step 6

Now point your domain DNS to GPC external IP address.

After the the DNS propagation done, the website should be served from GPC already.

Prev PostDividen ASB 2018 dan 5 tahun sebelumnya
Next Post#khabarbaik - pelan pasca bayar serendah RM19 dari Unifi Mobile

Leave a reply