So you want to host WordPress on Google Cloud?
This guide will take you step-by-step through the process of deploying a WordPress website to Google Cloud.
Let’s get started!
In this introductory section of the guide, you will learn about the pros and cons of moving to Google Cloud. You will also learn about the costs of hosting WordPress on Google Cloud, including the importance of deploying a solution that balances efficiency with performance.
After you’ve read through this introdution, the guide will then walk you through the process of deploying a WordPress website to Google Cloud.
Why host WordPress on Google Cloud?
Google Cloud is an excellent platform for hosting WordPress websites that require scalability, resiliency, and performance.
The #1 reason why you should host WordPress on Google Cloud is because you’re developing a website that you predict will grow in size and complexity over time, and you require a highly-scalable infrasture that can grow with your website.
Below is a list of pros and cons to consider when determining whether to host your WordPress website on Google Cloud:
Pros of Google Cloud hosting
- Significantly Increased performance
- Virtually unlimited scalability
- Highly cost-effective for large projects
- Greater control and flexibility
- Native integration with Google products
Cons of Google Cloud hosting
- Steep learning curve for beginners
- Requires significant time investment
- No customer support options included
- Greater risk exposure for new users
Cost of Hosting WordPress on Google Cloud
The cost of hosting WordPress websites on Google Cloud (compute engine) varies widely, and depends on many factors. Generally, the cost ranges between $1-$30 per month for typical WordPress websites.
Balancing efficiency and performance
When selecting the infrastructure to use for hosting your WordPress website on Google Cloud, it’s important to understand the need for balancing efficiency and performance.
Below is a side-by-side comparison of an efficiency ($0.08/month) vs. performance ($29.71/month) based configuration for hosting WordPress on Google Cloud.
The efficiency configuration is optimal for low-traffic websites (under 1000 daily users). This configuration takes full advantage of Google Cloud’s generous Always-Free Tier, which provides an f1-micro instance, as well as 30GB of HDD persistent disk storage, all at no cost.
This strictly efficiency-based model will allow you to host your WordPress website on Google Cloud at a very low cost, however, larger websites strictly adhering to the efficiency model may incur performance issues.
The performance configuration is optimal for websites with higher traffic volumes (over 1000 daily users). However, unlike the efficiency configuration, neither the n1-standard instance nor the 30GB SSD persistent disk are covered under Google’s Always-Free tier.
This strictly performance-based model will allow for your website to out-perform the efficiency model, especially under heavy load. However, low-traffic websites that utlize this configuration may be allocating resources inefficiently.
Which configuration should you choose?
One of the benefits of migrating to Google Cloud is that you can take advantage of their ‘pay-as-you-go’ model, which means only paying for the resources that your website requires, and nothing more. That being said, a good rule of thumb is to start small, and upgrade only when necessary. To determine whether upgrading is necessary, you will need to monitor your instance’s performance metrics.
To access your instance’s performance metrics, start from the Google Cloud sidebar menu and navigate to Compute Engine > VM Instances, then click on your instance. From here, you’ll see a Monitoring tab at the top of the page, which links to a dashboard displaying your instance’s performance metrics.
The most important metric to assess the performance of your instance is CPU usage. CPU usage consistently under 60% is ideal. If CPU usage is consistently over 60%, you may want to consider upgrading your machine size.
In addition to CPU usage, you’ll also want to monitor the free space available on your persistent disk. To check available disk space, use the df command.
Part I – Configure WordPress
In this section of the guide, you will deploy a WordPress website on Google Cloud using the efficiency configuration, which consists of an f1-micro instance and a 32GB HDD persistent disk, at an estimated cost of around $1 per month.
1. Deploy WordPress
2. Customize Deployment
Part II – Configure Domain
Now that your WordPress instance has been deployed, you will configure a domain name for your new WordPress website. Although the tutorial uses Namecheap as the domain name provider, the configuration is universal and will work with any domain name provider.
3. Copy Instance IP Address
4. Enable DNS Settings
5. Create DNS Record
Part III – Configure SSL
Now that your website’s domain name has been configured, you will learn how to enable SSL for your domain name. To do this, you will connect to your WordPress instance via the SSH terminal, then execute a script which will automate the process of configuring SSL for your website.
6. Connect to WordPress Instance
7. Execute SSL Script
After you’ve pressed Enter the script will prompt you with a series of questions, which you will answer by entering either y (for yes), or n (for no). We recommend answering each question in the following way, remembering to replace each bolded instance of Cronos with your own domain name or email:
Domain list : cronosasia.com www.cronosasia.com Enable HTTP to HTTPS redirection [Y/n]: y Enable non-www to www redirection [Y/n]: n Enable www to non-www redirection [y/N]: y Do you agree to these changes? [Y/n]: y E-mail address : firstname.lastname@example.org Do you agree to the Let's Encrypt Subscriber Agreement? [Y/n]: y
Well done! You’ve successfully deployed a fully-functional WordPress website on GCP, however, there are still some very important concepts that need to be covered. In this Next Steps… section of the guide you will learn how to retrieve your login credentials and login to your WordPress website, and optionally import an existing WordPress website.