Host Opencart in google cloud for free for one year, DNS, SSL, Cloudflare, SSH

This Opencart tutorial shows how to easily host Opencart in Google cloud for free for one year, set up Cloudflare, SSH to run shell scripts and commands, install an SSL certificate and redirect all non-HTTP to HTTPS URL.

Step 1: Set up Google Cloud Platform at using a free Google account or Gmail account.

Step 2: Click on the Navigational Menu icon >> Marketplace >> Search for Solutions >> Type Opencart

Search Opencart in Google Cloud

Step 3: Select the “OpenCart Certified by Bitnami”, this Google Compute Engine package contents Apache 2.4.41, ImageMagick 6.9.8, lego 3.0.2, MySQL 8.0.17, OpenCart, OpenSSL 1.0.2s, PHP 7.3.8, phpMyAdmin, and SQLite 3.29.0.

Opencart Certified by Bitnami in GCP

Step 4: Click “Launch on Compute Engine”. While creating be sure to use the following for the free account
1. Compute Engine Oregon: us-west1 or Iowa: us-central1 or South Carolina: us-east1
2. Machine Type: micro (1 shared vCPU) f1-micro
Get more details at
Select both HTTP and HTTPS traffic and by selecting as in the image, click Deploy.

Opencart Deployment in Google Cloud platform

Lots of scripts run, it creates a virtual machine instance, creating a password, setting config for opencart, setting up a firewall, and so on thus it takes some minutes for the opencart deployment and you will get the Site address, Admin URL, Admin user, and Admin password.

Opencart certified by bitnami

Now you can access the website from the site address for our above example and the admin section is Some of the suggested steps to change the temporary password, for that, go to System >> Users >> Users >> Edit user and change the password.

Step 5: Next suggested step is to assign a static external IP address to your VM instance, for that click on the Navigational Menu icon >> VPC network >> External IP addresses >> In the Type Column select the Static and give some name, with this Static IP address is created, now it will not change so we can set up the domain name to point to the website.

Opencart Static IP GCP

Step 6: Now time to set up a Domain Name to point to the google cloud DNS. For that click to Navigational Menu icon, >> Network Services >> Cloud DNS, this enabled the DNS API then create Zone, choose Zone type as Public, Zone name any, DNS name: use your domain name, DNSSEC you can use Off or On, then click create.

With the above steps, we have NS records. Now let’s add the A record. Click the Add record set button and then in DNS Name leave it blank, and in the Resource Record Type choose A and enter the Static IP that we get above in IPv4 Address (for us it is then click create. Let’s add another record set for the www, click the Add record set button and then in DNS Name type www, and in the Resource Record Type choose CNAME and enter the non-www URL for the canonical name. Then click create.

Cloud DNS in GCP for Opencart

You can see the lists of the above records as in the image. Now we use the NS record to link the domain name to our website. There are four NS records for us these are the following NS:

Step 7: Go to the domain name provider and change or add the NS records and delegate to Google Cloud servers. We use for domain name registration so it looks like below:

Delegate google cloud nameservers

After some minutes the site in the Google Cloud is shown, sometimes it may take up to 24hours as well.

Step 8: Now let’s add an SSL Certificate and set up an SSL Certificate for the website. Go to Menu Navigation icon >> Compute Engine >> VM instances >> then click SSH and shell script window is opened and run following shell script, be sure to change to your email and to your domain name and click Y for all 🙂

sudo /opt/bitnami/letsencrypt/scripts/ -m -d -d
shell script to create and install ssl in google cloud for Opencart

Now redirect all HTTP to HTTPS for that let’s edit the virtual host file. Use the following script:

sudo nano /opt/bitnami/apache2/conf/bitnami/bitnami.conf

It will open the file, then paste the following code in it.

RewriteEngine On 
RewriteCond %{HTTPS} !=on 
RewriteRule ^/(.*)$1 [R,L]

It looks like below:

rewriteengine on for Opencart

Now restart apache by the following command:

sudo /opt/bitnami/ restart apache

With these steps, SSL certificates are created and all non-HTTPS are redirected to HTTPS URL.

Step 9: We see the Bitnami Banner Ad at the bottom right corner, let’s remove it.

Bitnami banner remove from GCP

Run the following command in SSH

sudo /opt/bitnami/apps/opencart/bnconfig --disable_banner 1
sudo /opt/bitnami/ restart apache

With these commands, the Bitnami Banner Ad is removed.

Step 10: Let’s add the Cloudflare CDN for the Opencart website to increase performance using a CDN (Content Delivery Network). Go to and signup for a new account and then add the website URL and click continue and you will get new Cloudflare’s nameservers like:

opencart cloudflare setup

Now again need to go to the domain registrar and need to delegate to Cloudflare nameservers and remove the google cloud servers. For us it looks like below:

change the NS in domain registrar

With these changes, Cloudflare will start protecting our site. Sometimes it may take up to 24hrs, but Cloudflare will notify once it is active

Cloudflare Opencart

In this way, you can easily host the Opencart website in Google Cloud Platform, setup the DNS and your website URL in google cloud DNS, log in with SSH, create an SSL certificate, install it and redirect all to HTTPS, and configure the Cloudflare for the website for better performance. Hope you liked this post, let us know if you have any questions or suggestions, please subscribe to our YouTube Channel for Opencart video tutorials. You can also find us on Twitter and Facebook. Enjoy!


Previous articleHow to create an ebook website to sell PDFs, mp3, digital products in Opencart?
Next articleHow to install and create Opencart 4 theme – user manual and developer guide?


  1. The only problem that OpenCart is not usable, it’s full of bugs. I have 4 projects running on it, but…
    – FedEx
    – USPS,
    – Session,
    – PayPal,
    etc. NOT WORKING
    – Admin is not usable for big inventory
    – MyISM – cannot handle all requests to the database if number of products 10-15K+


Please enter your comment!
Please enter your name here