We are heading to a period when SSL won’t be optional anymore. As long as you have applications and websites online, they’ll need to run on https – sooner rather than later. As such, knowing how to install an SSL Certificate could prove convenient for you. Lets look at how we can install an SSL certificate on your domain that runs on a apache server under centos web panel. We will install Comodo’s 90 day Free SSL for illustration purposes.
Prerequisites
1. Root privileged access to your server running on cwp
2. A domain name hosted on the server. My domain is domain.com
Process
1. Login to your server as root (or sudoer).
2. Navigate to WebServer Settings >> SSL Certificates
3. Click Generate CSR and fill in the details on the form displayed. Then click Generate. Copy the CSR generated and save it elsewhere. You can also choose to send the CSR copy as an email.
4. Access your Comodo’s portal to get the SSL certificate. In this case, I will access https://secure.instantssl.com/products/SSLIdASignup1a to get Free 90day SSL from Comodo.
5. On the website, paste your CSR in it’s place. On the Webserver type, fill Other as your Webserver as CWP is not explicitly listed on by Comodo on the issuance form. Click Next.
6. The next part will be the domain control validation. Here you can use 3 validation types: Email validation, HTTP/S validation or DNS validation. In our case, we’ll use email validation. At this point, go back to cwp and create an email [email protected]. Click Next
7. Provide your contact details on the form as guided. Note that some fields are mandatory. Complete the form by clicking Next. Now an email has been sent to [email protected] for you to validate domain control. Access the email and follow the instructions there to validate.
8. Validation takes 1-5 minutes. Once done, your certificate will be emailed to you. Alternatively, you can download it by logging in to your portal at Comodo and download a zipped file of your SSL certificate.
9. Extract the zipped file to get your SSL files. One of the files will have a name domain.com.crt and another one will have the name COMODORSADomainValidationSecureServerCA.crt These are the two files we want.
10. Access cwp as root and navigate to WebServer Settings >> SSL Certificates >> Manual Install. Select your domain name in the form displayed.
11. Copy, in full, the contents of domain.com.crt to the section labeled Certificate *:
Then the Private Key * section should auto fill as it’s obtained from the server. Finally, copy the contents of COMODORSADomainValidationSecureServerCA.crt to the Certificate Authority: section.
12. Click the three buttons, first Validate Certificate, then Generate Intermediate Certificate then Save. You should get a notification that the process has been successful.
Your SSL has now been installed – but we aren’t through just yet. We normally want the https to automatically appear on the website without having to type it. So we need to force all http traffic to redirect to https. This can be done via the .htaccess file for your domain’s Document Root. So we proceed…
13. Access the Document Root of your domain, normally it’s /home/username/public_html and create a .htaccess file. If one exists, just use that instead. Add the following content to your .htaccess file:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
This forces all http requests on the domain to be redirected to https. You are now good to go.
Thanks, it is quite informative
Thank you. This post helped me a lot!
Thank you so much for putting tutorial online. Genuinely very helpful!