A step-by-step guide to hosting a static website on Google Cloud Storage for better performance at lower cost.
If you are hosting static website (HTML/CSS/JS/Images), then you don’t need to bother about cPanel web hosting plan to manage your site. Instead, you can use Google Cloud storage which will be cheaper, faster & easy to maintain.
A static site is suitable for personal, corporate, information page or anything where you don’t expect to generate a transaction or dynamic contents. It doesn’t need any server-side processing or database connectivity.
Why Google Cloud Storage?
It performs better at a lower cost.
You can host 10 GB of sites at multi-regional for high-availability for less than $1 per month.
You can choose to host your content on multi-regional storage class which means your data is available in two region’s data center for high-availability.
Google offers high-performance cloud storage for fast loading content worldwide with 99.95% availability SLA.
There is no minimum limit of an object, and you pay what you use.
The following instructions will help you to host the static website on Cloud Storage in less than 15 minutes.
For this demonstration, I will use bloggerflare.com.
Let’s get it started…
Verify Domain Ownership
First, you got to verify that you are an owner of the domain by adding the URL to “Search Console.”
Create Storage Bucket
- Log in to Cloud Storage and click “Create Bucket.”
- Enter the bucket name (important tips: if you would like to point your domain name to storage then you got to give the bucket name as a domain name)
- Select the storage class (leave multi-regional for high-performance & availability)
- Select location from US, EU & Asia (choose the nearest to your audience)
- Click “Create.”
Note: if a domain is not verified, you will get an error as below.
So you got to ensure the domain name which you’ve entered in the bucket name is verified.
Once a bucket is created, you should see them on the list.
Configuring Storage Bucket
It’s necessary to set up your bucket for your site to be accessible over the Internet.
- Select the bucket from the list
- Click on setting icon at right side >>Edit bucket permissions
- It will open permissions properties at the right side
allUsersin “Add members” field and select permission as “Storage Object Viewer.”
- Click Add to save the configuration
- Next, click on setting icon again >>Edit website configuration
- Enter index & 404 page (Most of the time index page would be index.html & 404.html)
- Save the configuration
Uploading Static Website
It’s time to upload your site to cloud storage. I am using Slides by Designmodo for my static website.
- Click on newly created bucket
- Click “Upload folder/Upload files” and choose your website files to upload
- Ensure index.html is present in bucket root
Based on file size, it may take some time.
Update CNAME Record
Finally, you got to point your domain to Google Cloud storage using CNAME record.
Login to your Domain Registrar control panel and update CNAME to c.storage.googleapis.com of your domain.
It may take some time to get DNS propagated globally, and you may use DNS lookup tool to verify the result.
Once domain CNAME is resolving to c.storage.googleapis.com, you can try accessing the URL to confirm working as expected.
So as you can see my static website is up and running on Google Cloud storage.
By default, a site will be available on http:// however, if you need to secure and make it accessible using https:// then you can refer this guide.
I hope above give you an idea how easy to host a static website on Cloud Storage at low cost.