Migrate WordPress website to Google Cloud Platform. Moving a website from one server to another server is a stressful experience, but it doesn’t have to be.
Many people need had to migrate to a better server and the process is delayed because of fear of making mistakes while migrating. So, they hire a professional to move the site for them.
This guide, covers all the tasks required for migrating a site to Google Cloud Platform.
Benefits of Hosting on Google Cloud
- Google provides $300 FREE credit for 12 months.
- Handle any amount of traffic.
- Performance benefits like fast loading, TTFB, response time and more.
- Better pricing than competitors
- Secure and reliable.
- And many more…
Steps to Migrate WordPress Site
- Edit your DNS records and reduce the TTL time.
- Set up Google Cloud for WordPress.
- Create new DNS records in Cloud DNS.
- Serve a back soon message.
- Backup and Import your whole website.
- Import your website to Google Cloud.
- Switch DNS records.
01. Edit your DNS records
Edit your DNS records and reduce the TTL time to 330 seconds. This means that most users were routed to the new server quickly.
However, if your DNS TTL is higher, we would recommend lowering it a few days prior to performing the migration. Normally, DNS propagation takes around 24 – 48 hrs. This method will ensure DNS changes propagate more quickly to your users.
02. Set up Google Cloud for WordPress
You can setup WordPress with Apache web server or Nginx web server. You can also choose Operating systems from Ubuntu, Debian, CentOS and more.
- Install LEMP in Compute Engine.
- Set up Server Blocks for your WordPress files.
- Set up Cloud SQL and connect with your Instance.
Now you must have a directory structure like the one below.
yourdomainname.com with your original domain name.
public directory is the root directory for your website.
03. Create new DNS records in Cloud DNS
Now you need to create new DNS record with the A record pointing to your VM’s IP address.
Go ahead and Set Up Cloud DNS for your domain.
You can also set up DNSSEC to secure your domain name from DNS cache poisoning.
04. Serve a Back Soon Message
This step is necessary to stop the live site from modifying the database while migrating to Google Cloud. So, we’re going to show a ‘Back Soon’ page for some time.
The simplest way to do this is to upload an
index.html file to your web root and make it serve instead of
05. Backup your whole website
Now, you can take backup of your website and database. Once you have your backup you can upload the files to Google Cloud Instance.
Next, you need to make some changes to your database file to remove all MyISAM engine. Cloud SQL does not support MyISAM engine so you need to remove this or replace with InnoDB engine.
Then you can upload your database file in your Cloud Storage bucket and import into Cloud SQL.
06. Switch DNS records
Once everything is in place you can update the DNS records with the records provided by Google Cloud.
Modifying your DNS records will start routing traffic to your new server. However, keep in mind that DNS queries are cached, so anyone who has visited your site recently will likely still be routed to the old server and see the ‘Back Soon’ page. Once the user’s machine re-queries for the domain’s DNS entries they should be forwarded to the new server.
Advanced Set Up
If you wonder about handling huge traffic, you can set up Load balancing on Google Cloud and dynamically scale your VM instance during high traffic and scale down during low traffic.
Now you have learned how to migrate your WordPress site to Google Cloud Platform by yourself.
If you have anything to discuss please post your comment below. Thank you!