Compute Engine Google Cloud

Best WordPress Server set up on Google Cloud

Best WordPress Server set up on Google Cloud. If you are preparing for high traffic or a high performance web server you should consider splitting your WordPress application into as many separate services as possible, and serving those services independently.

Instead of running your WordPress in a single machine you can split your application on many machines. For example splitting your database on separate server and splitting your Media Library to separate disk spaces or cloud storage.

Split your WordPress database

To split your database and move to another database server Google Cloud provides a setup named Cloud SQL. This is fully managed database service which is secure, reliable, easy to set up and maintain your databases.

Create a Cloud SQL instance and authorize your VM instance to connect to Cloud SQL. Create a database and import your SQL file to Cloud SQL. Learn more about setting up Cloud SQL on Google Cloud.

Learn how to set up Cloud SQL and connect to your VM Instance.

Split your Media Library

You can use Google Cloud Storage for your WordPress media files so that all images are served from Cloud Storage and uploaded directly to Cloud Storage. To achieve this setup you can use a plugin named WP-Stateless. 

Once you have activated this plugin you can sync all your WordPress Media library to Google Cloud Storage. When new uploads are made the images are automatically uploaded to Cloud Storage. For example your image URL will be

https://storage.googleapis.com/bucket_name/year/month/filename.png

With this setup your server load will get reduced because all image requests are made to a Multi-regional storage service. 

Learn how to split WordPress media library to Cloud Storage

Nginx Web server 

Now your media files are moved to Cloud Storage and database is moved to Cloud SQL. So only WordPress core files, plugins and themes are inside your server. 

FastCGI cache caches the whole page after its generated. So once a cache is generated the next request to the same page will get served from cache. By this you can increase performance of your web server.

Learn how to set up LEMP stack on Google Compute Engine.

Page Cache and Object Cache

For some websites the content is rarely updated so it’s unnecessary to query the database to build the web page. So by using Nginx FastCGI cache you can cache the static page and serve the HTML version of the page.

Nginx automatically creates the cached HTML version of the web page and serves them without hitting the PHP.

An object cache stores database query results and serves them from memory. This improves the performance of WordPress as there is no longer a need to query the database on every page load for information is already stored within the object cache.

You can set up Redis in you server for object caching.

Learn how to set up FastCGI cache in Nginx.

Horizontal Scaling

Now with the above set up your server is light weight with only WordPress core files, plugins and themes. So you can scale your server horizontally during high traffic with load balancing. So multiple servers uses single external database and media files from Cloud Storage.

There are many benefits in Google Load Balancing. You can use the Google’s globally distributed Content Delivery Network to cache HTTP(S) load balanced content.

Learn to set up HTTP(S) Load Balancing on Google Cloud.

Infrastructure

Initially you can go with Micro Instance in Compute Engine and Micro Instance in Cloud SQL.

Once you are getting more traffic you can upgrade to small machine or standard machine and finally to the load balancing.

Full set up and install WordPress on Google Cloud.

Cloudbooklet builds a large collection of Linux based guides and tutorials on Cloud platforms like Google Cloud, AWS, Azure, DigitalOcean and more

5 Comments

  1. Hi

    I am interested in this awesome structure. But I am a bit concerned about:

    1) Can I use this structure with Cyberpanel or Google one-click WordPress Deployment option?
    2) The structure seems to involve more technology than normal. Does it need more maintenance by the website owner? Or only the WordPress core files?

    • Cloudbooklet Reply

      Hi, thank you for your interest in CloudBooklet

      1. You cannot use Cyberpanel or Click-to-deploy because we need to use database from an external server(Cloud SQL)
      2. This structure requires so me tech knowledge to update (Rolling Update) WordPress while it is powered by Load Balancer

Write A Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

If you find this helpful? Support me!
Buy me a coffee Donation Please buy me a coffee