Free SSL Certificate In cPanel With ZeroSSL & Certbot


Share On        


Hurray :) I have written a new article on Free SSL Certificate For CPanel which is free and library is open source. The link is more relevant if you don't want to spend extra bucks on SSL certificate.
NOTE: NOW ZEROSSL HAS MADE ONLY 3 TIMES SSL GENERATION FREE WHICH MEANS. EACH RENEWAL LASTS FOR 3 MONTHS. I AM WORKING ON TO FIND ALTERNATIVE'S. I WILL UPDATE ONCE I WRITE ANOTHER ARTICLE ON THE SAME :)


Hello friends, In this article I will show you how to create a free SSL certificate to your domain in cPanel all for free with Certbot & ZeroSSL. Yup you heard it right. No need to spend heft amounts.


Prerequisites


I hope you might have setup your website and pushed your code to cPanel public directory and waiting to install SSL certificate for free.


Step 1 - Generate SSL Certificate & Verification (From ZEROSSL.COM)


The first step is to generate SSL certificate with using ZEROSSL.COM, first go the site and click on the FREE SSL CERTIFICATE WIZARD-> START like shown in the following image


FREE SSL ->START


ZEROSSL Site To Generate Free Certificate



ADD DOMAIN NAMES COMMA SEPARATED & GENERATE CSR KEY


Next add your domains comma separated like shown in the following image and then click NEXT


ZEROSSL Add Domain Name To Generate Keys



Make Sure to check mark ACCEPT ZEROSSL TOS & ACCEPT LETS ENCRYPT SA


Once you click NEXT ZEROSSL will Generate CSR Key make sure to copy it securely or download it for later usage. The CSR key will be shown in the same page on the right panel. Once you download it or copy it click NEXT.


ACCOUNT KEYS (PRIVATE KEY & CERTIFICATE)


Once you click next ZEROSSL will generate ACCOUNT KEYS & will look like the following screen. Make sure to copy it to safe place & download it for future use.


Account Keys (Private Key & Certificate)



GENERATE VERIFICATION OF KEYS


One you click next in the above step after copying your account keys, ZEROSSL will generate the VERIFICATION KEYS as shown in the following image, which need to be added in your cPanel public_html.


ZEROSSL Verification Keys



VERIFY GENERATE KEYS BELONGS TO DOMAIN


Now go to your webroot ie public_html unless you have multiple folder make sure to put in the public_html itself else go to your specific folder inside public_html and follow the following process


cPanel -> public_html -> .well-known -> acme-challenge



Create .well-known/acme-challenge/ folder and upload the VERIFICATION KEYS. After uploading the VERIFICATION KEYS it will look like the following


Upload VERIFICATION KEYS Like Shown In Image



DOWNLOAD PRIVATE & PUBLIC KEY


Once you add the the VERIFICATION KEYS and click next it will validate the file in your domains and if everything you have add then you will get the following screen


Certificate Ready (Public & Private Key)



In the above screen once you scroll down you will be able to PRIVATE & PUBLIC keys. Now download your PRIVATE & PUBLIC keys which you need to paste in the cPanel.


NOTE: DON'T CLOSE THE WINDOW AFTER GETTING PRIVATE & OTHER KEYS.

Step 2 - Add Public & Private Keys In cPanel


Now go to your cPanel -> Security -> SSL/TLS as shown in the following image and click on it


cPanel -> Security -> SSL/TLS



In the next page after clicking SSL/TLS -> click Manage SSL Sites under [Install and Manage SSL for your site (HTTPS)]


Install & Manage SSL



Once you click on Manage SSL Sites you will get the following image. Now copy & paste the PRIVATE & PUBLIC & CERTIFICATE keys in the following screen


Mange SSL Certificate Image


i. Select domain name from drop down

ii. Add certificate (NOTE - Here zerossl might copy CRT & CABUNDLE keys in same text selection so make sure to cut and paste separately )

iii. Add Private key from the ssl certificate key you downloaded

iv. You will have this with point ii so make sure to cut and paste here.

v. Click Install Certificate to install the certificates.


Hurray! You have successfully install your certificates.


NOTE: Still you haven't redirected all your http requests to https stay tuned till last. I am gonna show this in Step 4

Step 3 - Testing Your Domain For HTTPS


Now go to your browser and type https://your_domain_name you will gets the HTTPS site.


Yay! But hold on. Not all your HTTP requests are getting redirected to HTTPS site. Check out next step for this changes.


Step 4 - .htaccess For HTTP to HTTPS Redirection


Now create .htaccess in your domain root ie public_html or folder where you have project, ie. where you have placed .well-known folder


.htaccess File



In .htaccess file add the following code


RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


This code basically redirects all your HTTP to HTTPS


Conclusion


In this tutorial, you learned to generate public & private keys with ZEROSSL & use the same to redirect all the traffic from HTTP to HTTPS from cPanel with .htaccess




AUTHOR

Channaveer Hakari

I am a full-stack developer working at WifiDabba India Pvt Ltd. I started this blog so that I can share my knowledge and enhance my skills with constant learning.

Never stop learning. If you stop learning, you stop growing