Today we have many hosting solutions available for WordPress hosting. For this reason, it might be hard to decide what’s the best option for your website. We can classify hosting in a few categories shared, dedicated, managed, VPS ( Virtual private server ), and cloud hosting. In this article, we are looking at Google Cloud hosting. But before we set up WordPress on Google Cloud let’s see if it’s the right choice for your website. To do that first, we are going to see what cloud computing is. Then we are going to see what are the advantages of running WordPress websites on the Google Cloud Platform (Compute Engine).
What is cloud computing?
Cloud computing or simply the cloud refers to servers that are accessed over the internet. Those servers are located in data centers all over the world.
So how does cloud computing work? Two things make the cloud work so well. First is many servers working together as one unit. The second thing is virtualization technology. When you use Google Cloud you are going to create virtual machines. Virtual machines share server resources and there can be many virtual machines running on one server at the time. For us, the end-users of those virtual machines act just like real servers. We can install an operating system of our choice and any applications we want.
There are a few cloud hosting providers that you can use. The most popular ones are:
- Amazon Web Services (AWS)
- Google Cloud: Cloud Computing
- Microsoft Azure: Cloud Computing Services
- DigitalOcean: The developer cloud
Today we are going to show you how to host the WordPress website on Google Cloud: Cloud Computing. That said you should check other platforms to see what is a better option for your business.
Advantages of running WordPress websites on The Cloud
The main advantage of using cloud computing is that you don’t have to manage physical servers yourself. Instead, you are just renting server space from big cloud companies. Setting up and maintaining WordPress installation on the cloud requires a bit of knowledge and work. So it might not be for everyone.
When using cloud computing you are paying only for the resources you use. And in many cases, it’s going to be less expensive than other types of hosting. That makes sense since you are cutting out the middlemen. There is a good chance that if you get shared or managed hosting that your site is actually on some cloud. This is because hosting companies also use the cloud. So you are paying for cloud plus all the expenses of the hosting provider managing your WordPress website. If you have the technical knowledge to set up everything it’s probably worth going this route. It’s also worth mentioning that Google gives $300 free credit that you can use for one year for their cloud.
The performance of the cloud is much better and you have more control over it. Dedicated hosting might be better in some cases but still, the cloud is one of the best options for bigger sites.
Installing WordPress on Google Cloud
If you did not create Google Cloud account so far you should do so. The nice thing is that when you sign up you get $300 to spend on Google Cloud Platform over the next 12 months. Also, there is no auto-charge after the trial ends. So you can test Google Cloud WordPress to see if it is the right choice for your website. This also means that you can run your WordPress site on google for one year for free. However, this will depend on how much traffic you get to your website. If you get a lot of traffic you might use up free credit in less than one year.
1. Launching a WordPress Instance
Before we can make WordPress Instance we need to create a project. Access your Google Cloud Console and from the drop-down menu make a new project. You will need to fill in all the information name, billing account, and app engine location and so on. Accept terms and conditions and click create.
Go to API Manager > Library, then under the Google Cloud APIs section click on Cloud Deployment Manager API. And then finally, click Enable.
Next, go to cloud.google.com then click the CONSOLE button in the upper right corner of the screen click.
Then click on the Marketplace link in the left-hand of the screen. In the past, this option was called a cloud launcher.
On the next page under Virtual machines select WordPress Google Cloud Click to Deploy. In case, that you don’t see this virtual machine you can use the search bar at the top of the page. Just type WordPress Google Click to Deploy into the box and you should see WordPress as an option.
For this tutorial, we are using the Click to Deploy a version of WordPress. However, you have other options like Bitnami WordPress. You can even set up WordPress by hand instead of using WordPress deployer. That process is a bit more complicated but you have more control over how everything is set up.
Then just click on the LAUNCH button.
2. Configuring WordPress Instance
On the next page, we are going to configure our WordPress installation. First, fill in the Deployment name this can be anything you want. Then select a zone you should select the zone based on where your audience is located. For Machine Type, we are going to use a micro instance for this tutorial. This cloud VM is the smallest instance that you can create. It can be used for testing or smaller websites.
Scroll down a bit and fill in the rest of the information. Add your Administrator Email. Check install phpMyAdmin. For disk type, it’s much better if you select SSD. Make sure to check Allow HTTP and HTTPS traffic under Firewall. And finally, click on Deploy.
Once the instance is created you can do a quick test. Copy site address and paste it to a new tab you should see the WordPress blog home page.
You can also login to the WordPress dashboard. First, copy the admin password.
Then add /wordpress/wp-admin/ after IP address. Type admin as username and the password you copied from Google Cloud.
Congratulations you have installed WordPress on Google Cloud. But there are still more things to do. Next, we are going to install phpMyAdmin.
3. Install phpMyAdmin
First, we need to change the password for MySQL. To do this first copy the command mysqladmin -u root -p password from the black box under Change your MySQL root password.
Then click on the SSH dropdown menu and click on View gcloud command.
The gcloud command-line popup will appear next click on RUN IN CLOUD SHELL.
Paste the command you copied in the previous step to the shell.
Copy MySQL password and paste it in to shall then enter the new password.
Open phpMyAdmin and enter root as user name and the new password you just created as a password.
Ok, now you have an essential setup.
4. Setting up Static IP
First, go to VPC network/External IP addresses.
Then from the Type drop-down menu select Static IP.
Setting up Google Cloud DNS and using your Domain Name
Go to Networking and select cloud DNS.
Create a DNS zone. Add a name and make a DNS name.
Next, go to the domain registrant and edit your name server info. Also, you need to add A/AAAA record and a CNAME record
Congratulations you have set up a WordPress site on Google Cloud. However, that are more things you can do. We have a few bonus tips that you might want to do.
Migrating WordPress installation to Google Cloud.
If you already have an existing WordPress website you can use a migration plugin for WordPress. This is an easy way to transfer your website to Google Cloud.
Enable Google Cloud Monitoring
You might want to enable monitoring so you can follow your website performance. This way you can see if your website load is too high and you need to upgrade your VM.
Improving performance for larger websites
If you have a larger website you might want to look into Google Cloud CDN and load balancer to improve load times. Google Cloud can handle anything but you need to take extra steps. If you optimize your WordPress installation your site will perform well even if there are large traffic spikes.
Configure SSL Certificates
You don’t have to set up SSL but it is a good idea. If you set up SSL certificates your site will use HTTPS a secure version of the HTTP protocol. Keeping your website secure is important so it is worth an extra effort.
Get an email address for your website
In case, you were wondering if you can get an email with Google Cloud you can. There are two options you can set up a mail server on VM or get G Suite. Setting up a mail server is a bit more involved if you want easier options G Suite is perfect. Not only that you get mail you also get access to all Google apps.
Hosting WordPress on Google App Engine
As an alternative to creating virtual machines on Google Cloud, you can use the Google App Engine. The setup process is a bit more involved and requires knowledge of Linux terminal commands. That said it’s a flexible way of hosting WordPress that might be good in some cases.
For more WordPress tutorials check the rest of our blog. If you have further questions write them in the comment section below. Have a great day!