Install Prestashop, SSL and Apache2 on Google Cloud

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, avr: 5.00)

Google Cloud Platform (GCP) offers pre-defined templates that you can use to deploy common solutions with Deployment Manager. These templates are offered as part of GCP Marketplace and can be found in the Google Cloud Platform Console, one of them install Prestashop, SSL and Apache2

Prestashop is the open source e-commerce solution to start your online business and start selling online. This tutorial demonstrates step by step install and configuration Prestashop 1.7, SSL and Apache2 with greatly simplifies creating deployments on Deployment Manager.

Prerequisites

Before starting with this guide, make sure you are able to use the Google Cloud Platform Console and the gcloudcommand-line tool SSH. on this tutorial we will use testing subdomain lab.axfon.com


Step 1: Install Prestashop

There are multiple templates versions of Prestashop on Google Cloud Marketplace, on this tutorial we are going to use Prestahop Certified by Bitnami, let’s install it

Go to Left Sidebar Menu ➝ Marketplace ➝ On input search box type “Prestashop”  then click on Prestashop Certified by Bitnami


You will be directed to deploy form, set VM name as your own, choose Instance zone location and let others default value

  1. Set name for deployment (you may change with your prefer name)
  2. Select zone location (recommended choose the closest location with your target country)
  3. Machine type it recommended min small 1 share CPU
  4. Boost disk type recommended SSD
  5. Deploy (let others default value)

Step 2: Reserve a Static IP Address (Optional)

A static/external IP address is an external IP address that is reserved for your VM Instance or other projects. You can reserve that IP address so that only your project can use it. Reserving static IP is an Optional you still can use external (dynamic) IP provided by default when creating a project.

Go to Left Sidebar Menu ➝ VPC network ➝ External IP Addresses ➝ On the above menu click “RESERVE A STATIC ADDRESS”

  1. Set name for your reserve static IP
  2. IP Type select Regional
  3. On Region select the same region as your VM Instance Region already deployed on step 1
  4. Attached by selecting VM Instance name
  5. Reserve

Sometimes it does not directly change the IP address on Apache 2, Changes made in the Apache2 configuration file will not be applied until the command to Restart

sudo /opt/bitnami/ctlscript.sh restart apache

Step 3: Configure Domain to IP Address

Got to domain provider to create or add A record and pointing to static IP address

  1. Your domain name (On the picture we used a subdomain for testing)
  2. Set IP address
  3. Save

DNS or IP Address changes usually take 24 to 48 hours to propagation for fully start working


Step 4: Install and Enable SSL on Prestashop

SSL (Secure Sockets Layer) is a standard security protocol for establishing encrypted. If you don’t have own SSL certificate and want to enable HTTPS (SSL/TLS) on the website, we recommended to use Let’s Encrypt, it is a free, automated, and open certificate authority (CA)

Go to Left Sidebar Menu ➝ Deployment Manager ➝ Deployments ➝ Click on your project name

  1. User and Password information for your Prestahop Admin
  2. Click on SSH to install SSL

To install SSL Let’s Encrypt certificate, for this example we used both www and non-www lab.axfon.com and www.lab.axfon.com Don’t forget to change it with your domain name and email address

sudo /opt/bitnami/letsencrypt/scripts/generate-certificate.sh -m [email protected] -d lab.axfon.com -d www.lab.axfon.com

If prompted confirmation type Y and ENTER to continue

Restart the Apache2 web server

sudo /opt/bitnami/ctlscript.sh restart apache

Enable SSL on PrestaShop

Enable SSL on PrestaShop 1.7 you have to configure it on Admin Dashboard page, to do this go to url http://your_domain_or_IP/administration Login with Username and Password

Go to Left Sidebar Menu ➝ Shop Parameters ➝ General

If the first time Enable SSL, you have to click “Please click here to check if your shop supports HTTPS” then you will be prompted for confirmation, just click “I Understand the risk” now you can Enable SSL to be YES and Enable SSL on all pages to be YES 

You should now be able to access your application using an HTTPS URL, let’s see on url SSL Let’sencript worked perfectly and on the page showed Bitnami banner icon


Step 5: Configure Redirect Http to Https

The default Apache virtual host file Bitnami is in directory /opt/bitnami/apache2/conf/bitnami/bitnami.conf  modify these file use nano editor

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

Add this code RewriteRule ^/(.*) https://(www).%{SERVER_NAME}/$1 [R,L] if you don’t want www just remove it

<VirtualHost _default_:80>
  DocumentRoot "/opt/bitnami/apache2/htdocs"
  RewriteEngine On
  RewriteCond %{HTTPS} !=on
  RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]
  ...
</VirtualHost>

Press Ctrl/Cmd + X and then press Y and ENTER to save changes

Changes made in the Apache2 configuration file will not be applied until the command to Restart

sudo /opt/bitnami/ctlscript.sh restart apache

Step 6: PHP File Upload Limit

The default PHP file configuration directory /opt/bitnami/php/etc/  we need to modify a file php.ini

sudo nano /opt/bitnami/php/etc/php.ini

To edit these file you may find or use Cmd/Ctrl W to search

post_max_size = 100M
upload_max_filesize = 100M

Press Ctrl/Cmd + X and then press Y and ENTER to save changes

Changes made in the Apache2 configuration file will not be applied until the command to Restart

sudo /opt/bitnami/ctlscript.sh restart apache

Step 7: How to Remove Bitnami Banner Logo (Optional)

The Default page is including Bitnami banner Logo it’s useful links to documentation. If you want to remove this banner you have to set disable bnconfig to be True, /opt/bitnami/apps/APPNAME/bnconfig --disable_banner 1 to do this use the command below

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

If this tutorial could help you, please rate above Star button rating and share to help others find it! Feel free to leave a comment below.

Recommended For You

Axfon

About the Author: Axfon

Axfon.com is a site Online publisher for collection of guides and tutorials about Internet Technology