How to Hosting WordPress on Google Cloud

How to Hosting Wordpress on Google Cloud

Since google start giving away free credits hosting website on google cloud platform is really interesting especially if you are a small to medium traffic website and this content will show you how to set up a 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 ability to scale or upgrade it later the downside is you will have to manage it by yourself which requires some technical background and there is no convenient tools like cpanel or plesk, from here there are two options to set up 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 tutorial 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 marketplace from here you can choose the existing solution to deploy on your project for example if you want to host a web site using apache you can deploy a lamp stack solution which will create an instance for you and also install all the required packages.

tutorial google cloud free 2020
tutorial google cloud free 2020
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 is limited for f1-micro i recommend you to use a lightweight web server like.

Openlightspeed instead of apache let’s select open lightspeed from 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 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 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 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 click the ssh button on your instance then you will be asked to enter your domain name.

ssh google cloud vpn free
ssh google cloud vpn free

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 go to your ip address select the language and create a wordpress admin user and that’s it your wordpress is ready you can login and start customizing your website.

Now then update the dns setting to point to this vm instance ip address and 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 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 and 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 stackdriver for some resources like cpu you can view it right away at for ram you need to install an agent.

First you can use google provided commands you pull the install script and execute 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 and tutorials thanks watching and see you next time bye.