Host WordPress on Google

Let’s face it.

Having your website run smoothly and fast is one of the core things when it comes to modern online business. Your customers’ attention span is unbelievably short these days. According to KISSmetrics almost half of your web visitors expect a website to load within 2 seconds or less.

That’s right, 2 seconds.

If you’re a small business and running a website on a shared hosting, chances are that it loads more than that. Especially when we talk about international website traffic.

Traditional VPS, shared server or dedicated server has a physical location. That means that your site load speed will vary around the globe. For example if your site is hosted in the US, it will load faster in the US, but slower in Europe or Asia.

Here’s a website loading tool. Go ahead and see how fast your website loads in different locations.

I’ll wait for you…

Now, there could be several reasons why a website is loading slowly. I’m not going into the details on optimising your website for speed. That’s a topic for another time. I’m assuming you already have an optimised website and would like to get that extra boost.

This can be achieved by moving your website to cloud hosting. Simply put, cloud hosting makes your website available for clients from where they are requesting it. Imagine your website being hosted in several servers around the world. If somebody from China visits your website, he/she will see it from a server that is located in Asia.

So what, you might ask?

What I’ve experienced is that loading a site from a server that is physically near you reduces the load time dramatically. For example my blog GettingGrowth.com was hosted in Estonia (EU). Simply because I live here and sites hosted here load fast for me (load time was 3 seconds).

On the other hand, loading my site from the US used to take around 8 seconds. That’s where I lost half (if not more) of my visitors.

Now, when I moved to cloud hosting, I get a 2 second load time around the world. In the US, that loading time is even under 1 second, which is unbelievably fast.

Loading speed makes a better user experience which is directly linked with Google’s ranking factors. So, by making your website faster, you’re not only optimising for your current visitors, but also getting more organic traffic.

That’s good business!

Cloud Hosting Providers

There are several cloud hosting providers. To name a few:

  • Cloudways – starting from $7/month (they actually operate different cloud hosting providers)
  • Google Cloud – starting ~$5/month ($300 free credit for new users)
  • Amazon EC2 – starting $3/month
  • DigitalOcean – starting $5/month

They all start in a pretty similar price range. So which one should you choose? Well, obviously the question is when you start scaling your business and you need more power.

Now with traditional cloud host like AWS or Google Cloud you get the raw Linux server interface to play around with. That’s all good if you’re comfortable of running tasks from the command  terminal.

There are also few other more newbie friendly options. For example I know Hostgator is also offering cloud hosting. The good thing with Hostgator is that they offer cPanel, which allows you to easily deploy WordPress and other popular CMSs into your server. Additionally cPanel makes server configuration much more easier than doing it traditionally on the command terminal.

There’s an option to install cPanel to Google Cloud as well, but its robust (at least now).

Since I recently migrated my site to Google Cloud, I thought it might be a good idea to share how I did it.

If you’re considering moving your site to the cloud as well, but you don’t feel comfortable doing some server configurations, then I suggest going with Hostgator cloud hosting instead.

Step-by-Step guide to Host WordPress on Google Cloud

1. Create a Google Cloud account

So first head over cloud.google.com and sign up. You will be asked for a credit card. Don’t worry, this is only for verification, Google won’t charge without your consent and until your trial runs out. Since there’s a 12 month trial with $300 of credit you shouldn’t even worry about it.

Google Cloud

2. Create a project

Once, you’ve created an account you need to create a new project. You can name the project whatever you like. create a project

3. Run and Install Script of WordPress

Now, let’s start installing WordPress. For that you need to go to cloud launcher and search for WordPress.

cloud launcher

You should be able to see a couple of options. Either Bitnami or Google Click to Deploy would work. For this guide I’ve chosen Google Click to Deploy version.

Install wordpress

Since it’s quite easy to upgrade your server you might as well choose the lowest power at the moment and increase it when you need more.

Add your email address (which will be used for wordpress admin) and hit deploy. 

This might take a few minutes. After a while you should see that your WordPress site has installed.

wordpress install

And there you have it. Your WordPress site is installed in the Google Cloud. Since there’s no domain set up you can start editing via your_ip/wp-admin (e.g. http://104.111.222.33/wp-admin).

Note: it’s recommended to change the database password and also the WordPress admin user “admin”. 

Since you need to make some configurations in your install files and other server files. You can open an SSH connection directly in the browser. Simply click on SSH button.

4. Configure php.ini (optional)

WordPress default install comes with certain upload limits. For example if you have bought a theme or a plugin for your WordPress installation then you might get some errors while installing them from WordPress admin.

This happens due to server PHP limits. Since you now have access to server via SSH you can change the php.ini file.

The most common things to change in a WordPress php.ini are MEMORY_LIMIT and UPLOAD_MAX_FILESIZE.

These are your server’s PHP configurations. To change them you need to locate the php.ini file and increase the values assigned to them.

If you installed the WordPress as I did in this tutorial you should be able to find php.ini in /etc/php5/apache2 folder.

To navigate there write the following in your console. (I hope you didn’t close it already..)

cd /etc/php5/apache2

Once in that directory, bring up the file for editing with the following line:

sudo nano php.ini

If done correctly, you should see something like this

php.ini wordpress

Now, you want to change the upload memory value and php memory value. PHP.ini file is usually a long one, so let’s make a search. You can search by clicking the top right corner keyboard and choosing CTRL + W to conduct a search.

Search in linux

Let’s search for upload_max_filesize.

upload_max_filesize

As you can see the maximum upload value is 2M, which stands for 2 Mb. That is too low for modern WordPress installation. You can move around in the Nano editor with your arrow keys and change this into 50M or more. Remember, you should only be using as much as you need. I doesn’t make sense to change this into 2000M with no reason.

You can change the MEMORY_LIMIT value also if required, but most likely you can get away by just increasing the upload limit.

If you changed the number, then you can close the Nano editor by sending key shortcut to the consul.

send key shortcut

To exit, send ctrl + x. Editor should then ask whether you want to save your changes. Hit “Y” and enter.

5. Using your own Domain Name

Next thing we need to do is appoint a domain name to your server.

This is fairly simple. For that you need to get a static IP for your VM. Go to Compute Engine, select VM instances. From there select your fresh VM and change External IP (Emphemeral) to Static. It will ask you to name it. It doesn’t really matter what you write there, so just for clarity write your site name.

Change IP

Now, head over to Compute Engine and select Cloud DNS.

Cloud DNS

Red box should be around “Networking” on this image. /facepalm

Create a DNS zone. Add a name and make a DNS name.

Create a DNS

Go to your domain registrant and edit your name server info. Note that once this is done it will take up to 48h for your domain to start using Google name servers (it took me couple of hours only).

In addition you need to add a A/AAAA record and a CNAME record. And any other records you might be using with your current registrant (you’re likely to have these records when you’re using another hosting provider currently).

 

Nameservers

When you add A or AAAA record then you simply enter the static IP address that we reserved previously. This will tell Google that your domain should be used instead of your server IP.

Also you can add CNAM record to have www. subdomain in front of your site address.

6. Update URLs

Once the domain is pointing at Google’s server and your A records are working correctly your domain address should already work in your browser. However if  something’s wrong you can log in to your WordPress database and update the site URL. The address should be your IP /phpmyadmin (xxx.xxx.xxx.xx/phpmyadmin). If you don’t remember your phpmyadmin user or password, you can go to Deploy Manager and select your WordPress installation. Admin and password is written there.

When you log into your database, go to wpdatabse and select wp_options table.

phpmyadmin

In this database table you need to change 2 URLs, the siteurl and home. In both cases click Edit, replace the IP address with your domain name and hit Go.

phpmyadmin

There you go.

You can now go to http://yoursitename.com and start developing it at http://yoursitename.com/wp-admin.

wordpress install complete

7. Add SSL (https) to your Site (optional)

Having SSL support for your site improves security. Google has also announced that site security is becoming more important in search rankings. So it makes sense to look into SSL (https://) for your site as well.

You can either buy a certificate from a CA (Certificate Authority) or get one free from Let’s Encrypt. There are probably several ways to install a certificate to your site. I found it easy to run a cert-bot in my Linux server.

Basically, you can run a command over SSH and a certificate will be automatically installed to your server. First go to Certbot website and choose your software and system. For my installation it is Apache and Debian (3.x.x). So for system I choose Debian (other).

CertbotIf you make your selection, the website gives you the instructions to install it into your server. Simply put, you need to copy-paste a few lines to your SSH console and that’s it.

Once you get the confirmation from your console that the certificate has been installed, you can visit your site with https:// prefix.

In order to change all the URLs to https:// you just need to:

  • Go to WordPress database again and change the 2 URLs from http://yoursite.com to https://yoursite.com
  • Log in to your WordPress. Go to Settings > Permalinks and save the links (this is just to avoid any possible errors with URLs)
  • Install plugin Velvet Blues URLs. You can use this plugin to change all the file and links paths in use from one address to another. In our case we will use http://yoursite.com as Old URL and https://yoursite.com as New URL (if you have new clean WordPress, then you probably can skip this step).

Here’s a more detailed guide on how to add SSL to your Google Cloud WordPress install.

Conclusion

Cloud hosting is a great alternative to traditional VPS or dedicated server hosting, as it’s far more scaleable and offers flexible pricing (you pay for what you use). Additionally, you’ll be guaranteed 100% up-time as your site is hosted in several locations at the same time.

It has dramatically made my site GettingGrowth.com faster and that’s why I would recommend this to anyone who’s running anything online internationally.

On top of that what I’ve been testing is the use of CDN (content delivery network). I got additional 20-30% faster speed load by just applying CDN. I would suggest Stackpath as a CDN provider.

Let me know if you’re also planning to move your site to the cloud. And if you’re already using cloud hosting, let me know which hosting provider you have chosen.

PS. If you want to move your current wordpress to Google Cloud or any other hosting and need some help with that then shoot me an email and I’ll help you out!

Avatar
Author

Johannes holds a Masters degree in Business IT. He has more than 7 years of experience in online marketing and holds certifications from Google. Additionally, has helped to develop several start-ups. He enjoys good food and feels slightly awkward talking about himself in third person.

23 Comments

  1. Avatar

    Yeah, I can’t believe we’ve gotten to the point where a site NEEDS to load within 2 seconds or we’re out of there! It’s great that sites can do this and it’s also bad because we’re not as patient as we once were. I, for one, can wait up to 10 seconds easily but I’m the exception :)) I guess.

    I had no idea that the place where my site is hosted can have such a big impact on how it loads in certain parts of the world. Just this thought alone is worth going full on with cloud hosting.

    • Avatar

      Absolutely Daniel! I didn’t think much about cloud hosting myself. But it really matter from where your site is being loaded. Good luck!

  2. Avatar
    Brooklyn Thompson Reply

    Thank you for making these screenshots of how to setup this type of cloud hosting. It was very helpful when I had to do it myself. I’ve went ahead and followed your lead and invested in a Google Cloud account because my sites were loading so poorly lately that it was just a needed change. I’ve had people tell me my site was loading in as much as 12 seconds where they lived! It was loading fine for me but then I found out that’s not the case all over the world.

    • Avatar

      Yeah, that’s the problem. One alternative to cloud hosting would be simply to look at from which country the majority of traffic is coming. As for me it’s US. So I could basically get a shared hosting there cheaper, but then visitors from EU and Asia would suffer. Glad I could help. Let me know if you need any assistance setting it up. It can be quite overwhelming at first.

  3. Avatar

    Why do people still keep their admin user as “admin”? I don’t get it. This is the first thing hackers exploit when they are trying to break into your WP site. And it’s so easy and simple to change.

    By the way, your site loads in under 2 seconds where I live – Thailand – so everything seems to be working well. Thanks for the post, Johannes. Bookmarked it for use when I do get around to doing this myself which should be next month.

  4. Avatar

    So many steps! I can’t believe there’s so much to be done to make this work. And I generally hate doing this kind of technical stuff myself so I’ll probably ask around for someone to do it for me. Maybe my brother.

    One of the best things from all of this is I’ve found out about Let’s Encrypt – had no idea you could get this for free. I need to do this and get a cloud hosting (probably from Google) as soon as possible because my site load speed is just not up to par at all :(.

    • Avatar

      Caroline, actually if you’re looking to set everything quickly I’d recommend going with Hostgator cloud hosting. Not so much work. 🙂

      Glad that you found about Let’s Encrypt. Encrypted connection is becoming more important as Google search ranking factor as well.

  5. Avatar

    I have a question and I hope it’s not a dumb one: why wouldn’t it be ok to change the maximum upload value to 2000Mb? Does that mean that 2000MB would be “wrongly” allocated for this process and you could never use them for anything else even if they’d basically be unused?

    I think you should ask a small fee for doing this for people who just don’t know how to do this for themselves. I would pay for something like this and knowing it was done well and I didn’t mess something up :).

    • Avatar

      Hi Diane! It’s not a dumb question at all. 🙂

      You should only change to maximum upload limit to whatever you are using because of security. Hackers might try to run scripts from your website front-end to upload files and it might crash the server if it gets a large file requests.

  6. Avatar

    Thanks for this guide, it was so easy getting WordPress set up! However, I cant log into PHPmyAdmin (xxx.xxx.xxx.xx/phpmyadmin) as I get: The requested URL /phpmyadmin was not found on this server. Could this be because my IP is not static yet?

  7. Avatar
    Jonathan Swart Reply

    Thanks for this article, it has been super helpful! However, when I try access PhpmyAdmin using (xxx.xxx.xxx.xx/phpmyadmin) I get an error: “The requested URL /phpmyadmin was not found on this server”.

    Could this be because my IP is not yet static?

      • Avatar
        Jonathan Swart Reply

        I will do so 🙂 But for now I chose to rather deploy the Bitnami version which allowed me to easily access PHPmyAdmin through an SSH tunnel.

  8. Avatar

    helpful. But i have a problem i increased file size from 2m to 50m and try to upload 4m file but getting same error “The uploaded file exceeds the upload_max_filesize directive in php.ini.” please help me to solve this error i’ll be very thankful to you

    • Avatar

      Hey! Not sure if it’s still relevant, but did you try to restart your apache server after the change? Also you can add a line code regarding the upload limit to .htaccess and wp-config.php

  9. Pingback: Simple 6 Step Guide - How to Monetize Instagram with E-mail Marketing

  10. Avatar

    I do believe all of the ideas you have presented on your post.
    They’re really convincing and can certainly work.
    Nonetheless, the posts are too brief for newbies.
    May you please lengthen them a bit from next time?
    Thanks for the post.

Write A Comment