Deceased
- Join Date:
- Nov 2007
- Location:
- Sunny Coast, Australia
- Posts:
- 3,427
- Plugin Contributions:
- 2
Post #1 by frank18
After spending countless hours researching the forums (ZC and others) and finding posts scattered all over the place, in no logical order and resemblance, I decided to start this thread and hopefully (with the approval of the moderators / devs) make it the official "SSL - How To" thread.
The idea is that fellow zenners will share their experience about their own installations of SSL certs so others are getting the chance to learn without spending lots of time going in and out of posts and having to conduct umpteen searches. It should take some workload off the devs and other experienced zenners.
Firstly please read the official tutorial https://www.zen-cart.com/tutorials/index.php?article=14
Be careful though not to post any sensitive information (ie passwords, login details etc etc) for obvious reasons.
So here we go:
SSL INSTALLATION INTO SUBDOMAIN USING CPANEL
My experience is with an SSL cert installation into a store in the subdomain https://www.zencart.frnt.org using cPanel Version 11.24.5-STABLE on an Apache server.
The store (1.3.7.1) has been in ops for more than 2 years now.
STEP 1
If your store is installed in a directory https://www.yourdomain.com/yourstore you need to check if you can reach it by typing https://www.yourstore.yourdomain.com into the address bar of your browser. This may or may not work.
If it does not work then go to your cpanel and create the subdomain https://www.yourstore.yourdomain.com
If it does work, then there still is no guarantee that you can make the domain https://www.yourstore.yourdomain.com your nominated secure domain.
Bottom line: make sure the subdomain https://www.yourstore.yourdomain.com actually exists in cPanel. If it does not exist then create it. It makes no difference to your existing file structure https://www.yourdomain.com/yourstore . Creating this subdomain in cPanel merely creates a pointer within your virtual environment.
STEP 2
Login to cPanel and navigate to SSL/TLS Manager.
Click the link "Create Private Key" (or similar). I am assuming that you don't have a Private Key already. Look for "Generate a New Key" at the bottom of the page. In the Host box type in https://www.yourstore.yourdomain.com , select the key size (1024 or 2048) then click "Generate". The key is automatically created and is unique. Copy the key and save it on your HDD. You will need this key later when ordering your cert.
STEP 3
Still in cPanel go back to SSL/TLS Manager and look for the link "Certificate Signing Requests (CSR)". Under Host Name enter
https://www.yourstore.yourdomain.com
Enter 2 letters for country code (in my case AU for Australia) and 3 letters for state (3 because Aussie uses 3 letters, in my case QLD for Queensland)
The next 3 boxes are self explanatory.
Now to email: it is best to enter an email address like [email protected] or [email protected] or [email protected] as this domain specific email address may be needed to verify that you are owner / nominated administrator of the domain. If you don't have an email address like this then create one in cPanel.
Pass Phrase: enter any combination of letters and numbers but no characters like +-/_= etc (I have learned this the hard way...)
Click "Generate", copy and save the code on your HDD. You will need this key later when ordering your cert.
STEP 4
Buy your certificate. Go shopping around the web. The price differences for exactly the same certificate issued by exactly the same company (GeoTrust, Trustico, VeriSign) are enormous. I bought mine from the Aussie branch of Trustico (no affiliation exists here...)
During the registration process you will be asked to paste your Private Key and your CSR into various boxes on the relevant site. If you get errors (i.e. key not accepted) then most likely it is corrupted because of some extra line breaks etc. Just go back to your cPanel and copy the key again, then paste it straight into the box at the seller's site.
Depending on the seller's site, from here it can go any path (not really the point of this exercise)
STEP 5
Once you receive your certificate by email, go back to cPanel, click on SSL/TLS Manager, click on "Certificates (CRT)" and upload or copy/paste the key into the box.
STEP 6
Still in SSL/TLS Manager, click on "Order SSL Installation". My host Webcity charges a fee for the installation and assignment of a new IP for the secure subdomain. I requested the installation late on a Friday afternoon and the installation (server side) was done in 2 hours. It then takes about 24-48 hours before the new IP address propagates through the DNS. Until that has happened you won't be able to do any configuration / testing on your ZC installation.
STEP 7
Test to see if you can actually reach your secure domain https://www.yourstore.yourdomain.com
Be prepared to see a "bare bone" page (i.e. just words but no formatting) at this stage when you check the accessibility. This happens because you haven't changed your configure.php files yet.
If you still can't reach your https:// url 48 hours after the installation of your certificate then contact your host.
If you can reach your secure domain then go to step 8.
STEP 8
My next step was to implement the configuration changes in includes/configure.php and YOUR_ADMIN_NAME/includes/configure.php as per the tutorial at https://www.zen-cart.com/tutorials/index.php?article=14
This is how I interpreted it:
My settings in includes/configure.php were changed to:
// Define the webserver and path parameters
// HTTP_SERVER is your Main webserver: eg, http://www.yourdomain.com
// HTTPS_SERVER is your Secure webserver: eg, https://www.yourdomain.com
define('HTTP_SERVER', 'http://www.frnt.org');
define('HTTPS_SERVER', 'https://www.zencart.frnt.org');// Use secure webserver for checkout procedure?
define('ENABLE_SSL', 'true');// NOTE: be sure to leave the trailing '/' at the end of these lines if you make changes!
// * DIR_WS_* = Webserver directories (virtual/URL)
// these paths are relative to top of your webspace ... (ie: under the public_html or httpdocs folder)
define('DIR_WS_CATALOG', '/zencart/');
define('DIR_WS_HTTPS_CATALOG', '/');
and the corresponding admin/includes/configure.php changed to
define('HTTP_SERVER', 'http://www.frnt.org');
define('HTTPS_SERVER', 'https://www.zencart.frnt.org');
define('HTTP_CATALOG_SERVER', 'http://www.frnt.org');
define('HTTPS_CATALOG_SERVER', 'https://www.zencart.frnt.org');// Use secure webserver for catalog module and/or admin areas?
define('ENABLE_SSL_CATALOG', 'true');
define('ENABLE_SSL_ADMIN', 'true');// NOTE: be sure to leave the trailing '/' at the end of these lines if you make changes!
// * DIR_WS_* = Webserver directories (virtual/URL)
// these paths are relative to top of your webspace ... (ie: under the public_html or httpdocs folder)
define('DIR_WS_ADMIN', '/zencart/MY_ADMIN_NAME/');
define('DIR_WS_CATALOG', '/zencart/');
define('DIR_WS_HTTPS_ADMIN', '/MY_ADMIN_NAME/');
define('DIR_WS_HTTPS_CATALOG', '/');
This worked first-up without a single glitch. The site was only "down for maintenance" a mere 20mins.
Using my settings and accessing https://www.frnt.org/zencart you will go to an unsecured site. Once you get to
https://www.frnt.org/zencart/index.php?main_page=login the configuration automatically switches to secure mode and stays in secure mode for the entire checkout process - including all intermediate steps.
ZC is smart enough to recognize that it needs to go into secure mode once the customer reaches an area where sensitive information like login details, passwords, preferences etc are being entered.
Anyone trying to access https://www.zencart.frnt.org immediately enters and always stays in a secure environment - full stop.
Best of all: There was no need to copy my existing ZC files into a new secure directory.
IN CLOSING
This post only applies to a cPanel installation with a configuration as described above.
Hope this helps anyone else.
Please post your experiences with SSL installations in different environments so all concerned can learn something.
If I have missed something please let me know.
My second store https://www.personalnaturals.frnt.org is next in line to be secured - just the same way as the above.
Frank
NOTE: We are sorry that Frank is no longer with us.
We are grateful for all his contributions to the Zen Cart community.