Running Wordpress for free on the GCP

Today I will show you how easy is to setup your own dedicated Wordpress server, for a whole year, free, on the Google Cloud Platform. Sure, there are plenty of other options when setting up Wordpress, some of them free and some of them cheaper than GCP over the long run. The goal of this article is not debate which option is better. All I want to show is how you can setup Wordpress on GCP if one day you decide to do it.

Signup to GCP

Create a Google Cloud account if you don’t have one at You will get $300 USD free credit valid for 1 year.

Create your VM Instance

After signing up, navigate to Compute Engine -> VM Instances

Click on Create

On the left hand side you will see the Marketplaces link. Click on this link as we are going to use a ready made instance of wordpress created by Bitnami.

Search for wordpress bitnami

For this tutorial we will use the image “Wordpress with NGINX and SSL Certified by Bitnami and Automatic”

The total cost for this VM is circa around $13.61/month which includes discounts for continuous utilisation. With this you get a 1 shared vCPU + 1.7GB of memory(g1-small).

Click Launch

Select your desired Zone. Typically you want to select a zone close to where most your visitors will come from. E.g. Europe-west-4a. You will notice that the cost will vary slightly as different zones will incur extra costs specific to the country where the data center is located.

In this page you can also upscale your machine type by adding extra disk or specifying extra vCPUs.

I am not changing any of the settings except for the VM Instance name.

The firewall ports are already correctly setup to only allow HTTP/HTTPS traffic.

Click Deploy and wait for a few minutes for the VM instance to be ready

You will be forwarded to a Deployment Manager page where after the VM instance is provisioned you can access basic connection details and credentials needed for your new wordpress instance:

  • The IP address
  • URL for login to wordpress admin
  • Passwords….

Login to your wordpress instance

Let’s first login to wordpress admin with the provided credentials.

First thing I do is to change the generated password. You might also want to create your own user.

Ok so now we have a Wordpress website running with ip address What is next?

Configure a domain name

If you already have a domain name, then point your domain to this ip address.

If you don’t have a domain name you should buy one. For the purpose of this tutorial I will not create a domain name but instead use a free service that allows me to transform any ip addresss to a valid domain name. The service I will use is

Generate SSL Certificates

I need a domain name because I want to generate a valid SSL certificate for my wordpress site using LetsEncrypt.

My domain name is, where is the ip address of the VM that was launched earlier.

Access instance by SSH

We need to access the wordpress instance via SSH. You can access the instance directly from the GCP console.

Go to Compute Engine -> VM Instances

Click on the SSH link to open a cloud shell.

When accessing our wordpress instance via SSH there are some useful links to the documentation for our Bitnami wordpress instance.

Let’s create a free LetsEncrypt SSL certificate for this wordpress site. Bitnami has created some scripts that already automate that process.

sudo /opt/bitnami/letsencrypt/scripts/ -m -d

Type Y for everything, including the last question about the cron job.

If all goes well and the domain is correctly configured you should see a success message at the end after NGINX is restarted.

Test your new SSL Certificate

Let’s test if the SSL certificate is working by accessing

I know it worked in this case because I can see the safe lock displayed on the browser and the hello world wordpress page is correctly displayed.

Further inspection of the SSH certificate shows:

Setup redirect to https

One thing you will notice is that you still can access the site via http. This is not desirable so one should ensure that all traffic is redirected to https.

Using the ssh shell we opened earlier edit the /opt/bitnami/nginx/conf/bitnami/bitnami.conf file and change the following code block:

# HTTP serverserver {
listen 80;
server_name localhost;
return 301 https://$host$request_uri;#include "/opt/bitnami/nginx/conf/bitnami/phpfastcgi.conf";include "/opt/bitnami/nginx/conf/bitnami/bitnami-apps-prefix.conf";

The line you need to add is show above in bold.

Save and exit

Restart NGINX

Restart Nginx with the following script:

@wordpress-gcp-1-vm:~$ sudo /opt/bitnami/ restart nginx
Unmonitored nginx
/opt/bitnami/nginx/scripts/ : Nginx stopped
/opt/bitnami/nginx/scripts/ : Nginx startedMonitored nginx

And voila, any visitor to the site will now always be redirected to HTTPS

Some housekeeping

Remove MANAGE Link from front page

Remove MANAGE Link shown at the bottom right of the wordpress Hello World page.

Manage link that you is shown in a default install of wordpress by Bitnami

We don’t want to leave that link there, so we need to disable it. In order to disable it let’s again use the SSH Cloud shell and execute the following script:

sudo /opt/bitnami/apps/wordpress/bnconfig --disable_banner 1

And like magic the link is gone.

How to access PHPMyAdmin

Is this all? Not yet. At some point you will need access to the phpMyAdmin page. Because of security constraints, you can only access it via localhost( What that means is that an ssh tunnel is needed. Not great for those less technically savvy. But that’s how it was configured.

15.1 Create an SSH Key

If you use MacOS, open a terminal and type:

-mbp:~ user$ ssh-keygenGenerating public/private rsa key pair.Enter file in which to save the key (/Users/user/.ssh/id_rsa): /Users/user/.ssh/id_rsa_gcpEnter passphrase (empty for no passphrase):Enter same passphrase again:Your identification has been saved in /Users/user/.ssh/id_rsa_gcp.Your public key has been saved in /Users/user/.ssh/ key fingerprint is:SHA256:qesXV6dbzUu0l4Gcdg4lm5TLX0iJi9hQQ+Mroghzew4 acachada@armindos-mbp.lanThe key's randomart image is:+---[RSA 2048]----+|         o=  ... ||        .. o.+o. ||         +..+oO. ||        ..o.o@o+.||o .   . S ...o*o=|| + o . o... . .*+||  E o .  o   o. o||   +   ..   .  . ||    ..o.         |+----[SHA256]-----+

15.2 In a browser go to GCP->Compute Engines->VM Instances and click on the wordpress VM instance to view the instance details.

15.3 Add your SSH public key to the VM instance

Click Edit and in the edit screen, locate the SSH Keys section and paste the content of /Users/user/.ssh/

Click Save to save the changes.

15.4 Now you can create SSH tunnel to the instance

ssh -N -L 8888: -i KEYFILE username@SERVER-IP

You should be able to access PhpMyAdmin at


Username is root

and password is the same as the original password that we used to access wordpress admin.

Now you should be ready to build your new website!

Written by

Founding Director at Spltech

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store