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.
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.
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.
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.
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.
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://184.108.40.206/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..)
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
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.
Let’s search for 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.
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.
Now, head over to Compute Engine and select Cloud DNS.
Red box should be around “Networking” on this image. /facepalm
Create a DNS zone. Add a name and make a DNS name.
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).
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.
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.
There you go.
You can now go to http://yoursitename.com and start developing it at http://yoursitename.com/wp-admin.
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).
If 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.
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!