Installing OpenCart on Digital Ocean


Firstly, I was a big fan of PHP until I met python. Upon choosing to try out OpenCart, I was conflicted with using it over Odoo, a Python e-commerce platform that is designed to meet one's journey map from a startup to an enterprise level system. However, for the e-commerce system, I'm going to deploy, I didn't want to overwhelm the client with features. Therefore, I decided to visit the good old PHP frameworks and above all, OpenCart stands out the most at this point.

Getting Started

Like most framework, the first thing you need to do is to setup the environment. For me, I didn't bother to setup a local environment for testing. I went straight to Digital Ocean and create a $5 per month Ubuntu 16.04 droplet. I do plan to upgrade the server once there's more traffic on the site, but for now, I'm just using it to prototype the storefront for the client. Upon creating the new droplet, I attached my ssh keys to the server, which allows me to connect to it via SSH. I'm using MobaXterm as my client since it offers an SSH browser when connected to a server. As a result, there's no need to download or install filezilla.

Setting up Server

After I logged in to my server for the first time, I followed the instructions given in the Digital Ocean's How to install LAMP on Ubuntu 16.04 tutorial to get PHP, MySQL and Apache setup. Afterwards, you need to install phpMyAdmin by following another Digital Ocean tutorial. Finally, run the following command:

sudo apt-get install php-curl php-zip php-mcrypt

Setting up OpenCart

Securing your OpenCart Website

  • Remove the install folder found in the root of the site and VQmod
  • Change the file permission to 444 for config.php, admin/config.php and index.php
  • Rename the admin folder to something else. This will prevent web bots, hackers and other potentially harmful species from accessing such a crucial section of your website. In addition, you will need to update the path to the admin location in your config.php, admin/config.php or any vqmod addon that has the admin path hard coded. Execute the code below by replacing yournewadminfolder with your desired folder name.
    find -type f -exec sed -i "s/admin/yournewadminfolder/g" '{}' \;

    For more information, read J.B.M Hunter's blog about stopping OpenCart from being hacked 

Go Back