Jump to content


Photo

How to install OpenCart and configure SSL


  • Please log in to reply
No replies to this topic

#1 Ric

Ric

    Project Manager

  • Admin
  • PipPipPipPipPip
  • 1,535 posts
  • Gender:Male
  • Location:Cambridge,UK
  • Interests:Electronics
    Internet in general
    Open source projects
  • SourceForge IDmpgcan
  • Wiki ID: Ric
  • Main OS: Windows XP

Posted 18 April 2014 - 06:46 AM

How to install OpenCart and configure SSL

I have had several requests regarding the installation of OpenCart and how to run it with SSL on Uniform Server. A default installation of Uniform Server contains a separate folder (ssl) preconfigured specifically for a personal secure server. To run third party scripts such as OpenCart requires this default behaver to be modified such that SSL secures the main server only. The following step-by-step guide covers this modification and how to install OpenCart on Uniform Server ZeroXI. The guide also covers portability allowing OpenCart to run from a USB memory stick or other location.

Preliminary:
1. Download (opencart-1.5.6.3.zip) and extract OpenCart files to a separate folder.
2. Copy the folder “upload” to Uniform Server folder UniServerZ\www
3. Rename the “upload” folder to shop.
4. Rename file UniServerZ\www\shop\config-dist.php to config.php
5. Rename file UniServerZ\www\shop\admin\config-dist.php to config.php

Apache configuration:  Apache SSL configuration must be modified to secure the main server only.
6. Edit file UniServerZ\core\apache2\conf\extra\httpd-ssl.conf
Locate two instances of ${US_ROOTF_SSL} and replace with ${US_ROOTF_WWW}

Apache server certificate:
Create a self-signed server certificate (or see documentation, obtaining and installing a certificate issued by a certificate authority.)
7. Start UniController
8. From the top menu bar select: Apache>Apache SSL>Server Certificate and Key generator
9. Generator forms opens. No need to change any parameters, click Generate button.

OpenCart installation:
10. From UniController start Apache and MySQL server.
11. Using phpMyAdmin create a new database, name it opencart (or any name of your choice)
12. Access OpenCart by typing the following into your browser: http://localhost/shop/
This starts the installation process displaying four pages as follows:
Page Step 1: Click continue
Page Step 2: All items are green - Click continue
Page Step 3: Configuration. Set following parameters:

 1. Please enter your database connection details.
 Database Host: change localhost to 127.0.0.1
 User: root
 Password: root (or whatever you set for the MySQL root password)
 Database name: opencart (or whatever you set in 11)

 2. Please enter a username and password for the administration
 Username: fred (use a name you prefer)
 Password fred123 (use your own password)
 E-mails me@some_provider.com (provide an e-mail you wish to use)
 Click continue.

Page Step 4: Delete folder: UniServerZ\www\shop\install
13. While on step 4 page click “Login to your Administration
14. Enter name and password (fred fred123) you set for the administrator. Click Login
15. Enabling SSL in the OpenCart Dashboard as follows:
a. Go to System > Settings
b. To the right of  “Your Store (Default)” click Edit
c. Click on the Server tab
d. Check the radio button to use SSL
e. Click Save
g. Logout


16. Enabling SSL in the OpenCart directory config.php file:
a. Edit file UniServerZ\www\shop\config.php
b. Locate these lines:

// HTTPS
define('HTTPS_SERVER', 'http://localhost/shop/');

Change to:

// HTTPS
define('HTTPS_SERVER', 'https://localhost/shop/');

17. Enabling SSL in the OpenCart Admin folder config.php file:
a. Edit file:  UniServerZ\www\shop\admin\config.php
b. Locate these lines:

// HTTPS
define('HTTPS_SERVER', 'http://localhost/shop/admin/');
define('HTTPS_CATALOG', 'http://localhost/shop/');

Change to:

// HTTPS
define('HTTPS_SERVER', 'https://localhost/shop/admin/');
define('HTTPS_CATALOG', 'https://localhost/shop/');

That completes installation. Close browser and restart servers.

Test:
18. Type the following into browser: http://localhost/shop/  Expected result example cart content  is displayed.
19. Add an item to the cart and click checkout. Result your browser is forced to a secure connection and displays closed padlock. If requested by your browser add an exception.
20. Type the following into browser:  http://localhost/shop/admin/
21. Enter name and password (fred fred123) you set for the administrator. Expected result your browser is again forced to a secure connection and displays closed padlock.

Portability:
The above installation is fixed however it is easily converted for portability allowing OpenCart to run from a USB memory stick. Paths in the two configuration (config.php) files are absolute these require modification. Note your paths may be different to those shown however the replacement sections can be used with no modification.

22. Edit file: UniServerZ\www\shop\config.php
Locate this section:

// DIR
define('DIR_APPLICATION', 'C:\UniServerZ\www\shop/catalog/');
define('DIR_SYSTEM', 'C:\UniServerZ\www\shop/system/');
define('DIR_DATABASE', 'C:\UniServerZ\www\shop/system/database/');
define('DIR_LANGUAGE', 'C:\UniServerZ\www\shop/catalog/language/');
define('DIR_TEMPLATE', 'C:\UniServerZ\www\shop/catalog/view/theme/');
define('DIR_CONFIG', 'C:\UniServerZ\www\shop/system/config/');
define('DIR_IMAGE', 'C:\UniServerZ\www\shop/image/');
define('DIR_CACHE', 'C:\UniServerZ\www\shop/system/cache/');
define('DIR_DOWNLOAD', 'C:\UniServerZ\www\shop/download/');
define('DIR_LOGS', 'C:\UniServerZ\www\shop/system/logs/');

 Replace with:

// DIR
$root= substr($_SERVER["DOCUMENT_ROOT"],0,-4);   // Get path
define('DIR_APPLICATION', $root . '\www\shop/catalog/');
define('DIR_SYSTEM',      $root . '\www\shop/system/');
define('DIR_DATABASE',    $root . '\www\shop/system/database/');
define('DIR_LANGUAGE',    $root . '\www\shop/catalog/language/');
define('DIR_TEMPLATE',    $root . '\www\shop/catalog/view/theme/');
define('DIR_CONFIG',      $root . '\www\shop/system/config/');
define('DIR_IMAGE',       $root . '\www\shop/image/');
define('DIR_CACHE',       $root . '\www\shop/system/cache/');
define('DIR_DOWNLOAD',    $root . '\www\shop/download/');
define('DIR_LOGS',        $root . '\www\shop/system/logs/');

23. Edit file: UniServerZ\www\shop\admin\config.php
Locate this section:

// DIR
define('DIR_APPLICATION', 'C:\UniServerZ\www\shop/admin/');
define('DIR_SYSTEM', 'C:\UniServerZ\www\shop/system/');
define('DIR_DATABASE', 'C:\UniServerZ\www\shop/system/database/');
define('DIR_LANGUAGE', 'C:\UniServerZ\www\shop/admin/language/');
define('DIR_TEMPLATE', 'C:\UniServerZ\www\shop/admin/view/template/');
define('DIR_CONFIG', 'C:\UniServerZ\www\shop/system/config/');
define('DIR_IMAGE', 'C:\UniServerZ\www\shop/image/');
define('DIR_CACHE', 'C:\UniServerZ\www\shop/system/cache/');
define('DIR_DOWNLOAD', 'C:\UniServerZ\www\shop/download/');
define('DIR_LOGS', 'C:\UniServerZ\www\shop/system/logs/');
define('DIR_CATALOG', 'C:\UniServerZ\www\shop/catalog/');

 Replace with:

// DIR
$root= substr($_SERVER["DOCUMENT_ROOT"],0,-4);   // Get path
define('DIR_APPLICATION', $root . '\www\shop/admin/');
define('DIR_SYSTEM',      $root . '\www\shop/system/');
define('DIR_DATABASE',    $root . '\www\shop/system/database/');
define('DIR_LANGUAGE',    $root . '\www\shop/admin/language/');
define('DIR_TEMPLATE',    $root . '\www\shop/admin/view/template/');
define('DIR_CONFIG',      $root . '\www\shop/system/config/');
define('DIR_IMAGE',       $root . '\www\shop/image/');
define('DIR_CACHE',       $root . '\www\shop/system/cache/');
define('DIR_DOWNLOAD',    $root . '\www\shop/download/');
define('DIR_LOGS',        $root . '\www\shop/system/logs/');
define('DIR_CATALOG',     $root . '\www\shop/catalog/');

All the best
Ric
 






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users