How to host a WordPress website on Google Cloud
How to add google cloud in WordPress? Since google start giving away free credits hosting websites on google cloud. The platform is really interesting especially. If you are a small to medium traffic website and this article will show you. How to set up WordPress on GCP in just a few minutes.
Let’s check it out here’s the Google cloud platform and if this is the first time for you. You will be asked to create your first project. But since I already hosted my website on this platform. I’m going to create a new project for this tutorial and we need to wait for a few seconds before.
We can switch to the new project let’s head to the compute engine section, and select VM instance here. You can create your own virtual machine. As your server, it’s almost the same as purchasing a VPS package from web hosting. But this time you have full control and the ability to scale or upgrade.
Later the downside is you will have to manage. It by yourself which requires some technical background and there are no convenient tools like cPanel, or Plesk from here there are two options to set up. In your instance, you can create your virtual machine here and install all the packages by yourself, or you can use the deployment solution provided on a marketplace for this article.
We will go with the easy way and use the existing solution. Let’s head to the deployment manager and select deployment then, click go to the marketplace from here. You can choose the existing solution to deploy on your project for example. If you want to host a website using Apache. You can deploy a LAMP stack solution.
That will create an instance for you and also install all the required packages. Now since Google has a free tier that. Let you use the smallest VM instance like f1-micro for free. This tutorial is going to focus on staying under that condition and since the CPU and RAM are limited for f1-micro.
I recommend you use a lightweight web server. Like OpenLightspeed instead of Apache let’s select. Open Lightspeed from the marketplace and click Launch on compute engine. Here you can rename the deployment if you want.
Zone is where your VM instance will be placed. You can change Zone to match the website audience. But remember that the free tier allows only. US zone next is the VM instance here. You can select machine type with suitable CPU and RAM but for small to medium static website, the f1-micro should be enough for most cases. Next is the disk size which is default to 10 gigs but since the free tier allows up to 30GB so why not.
Then make sure you allow our web traffic on fire, or setting then click deploy and wait for a few minutes. Now the deployment has finished next. We will reserve the static IP address for our server. Go to our VM instance and select view Network detail then select external IP address. You will see that our current IP type is ephemeral which means it will change over time.
So, let’s change it to static. If you go to this IP address on the browser now. It will tell you to set up a server of its secure shell first. so let’s do it you can connect by clicking the SSH button on your instance. Then you will be asked to enter your domain name. I’m going to skip the SSL setting for now finally update a server to the latest version. This will take five to ten minutes. So, in the meantime let’s set up the WordPress by going to your IP address.
select the language and create a WordPress admin user and that’s it your WordPress is ready. You can log in and start customizing your website now. Then update the DNS setting to point to this VM instance IP address. Your website is ready with the current setting. It should be able to take on around thousand users per day easily and even more.
If you use Cloudflare or cache plug-in but since our server’s RAM is quite limited. It’s best to also turn on a swap file. this is to allocate some disk space to be used as a memory. When Ram is running low first view allocate a file with 1 gig size. Then set the file permission then select our file to be used as a swap. Then turn it on our swap setup is complete. But this is only temporary. If you restart the server.
It will be gone so we need to write a setting permanently. Now to keep track of CPU and RAM usage. You can view it in stack driver for some resources. Like CPU you can view. It right away at for RAM. need to install an agent first. You can use Google-provided commands.
You pull the install script and execute it. It the install is complete but., if you check the status, it will fail this. Because we need to enable the meta setting of our instance. First head back to the VM instance and click Edit unchanged monitoring metadata from 0 to 1.
Then we start to service and check the status again. Now it’s running you should see a checkmark in a Stackdriver.
To view RAM usage select resources and metrics Explorer first. Enter GCE VM instance as resource type then select memory usage. Now you can see, your search statistic report at any time, and that should cover the basic steps. Thanks for reading our google cloud WordPress article.