Logo

dev-resources.site

for different kinds of informations.

Let’s Encrypt SSL certificate in Namecheap AutoRenewal – Verified & working – Using ACME.sh

Published at
9/18/2020
Categories
ssl
namecheap
acme
letsencrypt
Author
atomar
Categories
4 categories in total
ssl
open
namecheap
open
acme
open
letsencrypt
open
Author
6 person written this
atomar
open
Let’s Encrypt SSL certificate in Namecheap AutoRenewal – Verified & working – Using ACME.sh

NameCheap doesn't support Let's Encrypt natively, But provides option so you can setup LetEncrypt SSL certificates using different utilities like getSSL or ACME.sh, having used both found acme.sh to be quite better and simple to use + it supports auto renewal too.

1 - Enable SSH to get into your shared hosting server with your cpanel username.(You can get keys & login from your terminal or use inbuilt capnel terminal for quick access)

2 - Get the certs

#Get acme.sh utility
curl https://get.acme.sh | sh

#Source the Environment variables
source ~/.bashrc

#Register your email with Lets's Encrypt to be notified any renewals issue
acme.sh --register-account --accountemail [email protected]

# At this moment a cron entry already has been setup for autorenewal which will auto renew after 60 days., You can update /dev/null to something like this if you need the log
crontab -l | grep acme.sh
10 0 * * * "/home/_CPANEL_USERNAME_/.acme.sh"/acme.sh --cron --home "/home/_CPANEL_USERNAME_/.acme.sh" >> /home/_CPANEL_USERNAME_/.acme_cron_log
Enter fullscreen mode Exit fullscreen mode

4 – Issue a test cert to check if all working

#webroot will be any directory in which your domain exist, give path accordingly.
acme.sh --issue --webroot ~/public_html -d yourdomain.com --staging
Enter fullscreen mode Exit fullscreen mode

5 – issue an actual Certificate

acme.sh --issue --webroot ~/public_html -d yourdomain.com --force

#In ourput you will see success if all goes fine & key/Certs/chaincerts/csr will be stored under below location, you can refer those if you intend to apply those using cpanel GUI manually

~/.acme.sh/yourdomain.com/
Enter fullscreen mode Exit fullscreen mode

6 - Apply Cert to website using cPnel hook

acme.sh --deploy --deploy-hook cpanel_uapi --domain yourdomain.com
Enter fullscreen mode Exit fullscreen mode

7 – You should be able to see your domain with SSL in cpanel under SSL/TLS -> Manage all certs

Alt Text

8 - Force HTTP-HTTPS redirection
If you see option to enable you can enforce HTTP from cpanel itself:

cPanel->Domains

Enter fullscreen mode Exit fullscreen mode

Alt Text

In case it is greyed out, which could be in case you have multiple domains like www.yourdomain.com for which you don’t have the cert , Enable the redirection from “redirects” or simply add below lines in .htaccess file

#always backup as a thumb of rule
vi ~/public_html/.htaccess 

Or

vi ./yourdomain.com/.htaccess 

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
Enter fullscreen mode Exit fullscreen mode

9 – test your website in new window with URL: https://yourdomain.com or http://yourdomain.com( in http it should redirect automatically to https)

So you are all done now, If you need a more detailed Article you can checkout the original article on below link:
devops.egyan.space

Glad if this helped you, You can now buy me a coffee if this was helpful:

namecheap Article's
25 articles in total
Favicon
Run NextJS App in shared-hosting cPanel domain!
Favicon
Get a free SSL certificates for your shared-hosting cPanel domain!
Favicon
Why is My Card Declining on Namecheap But I Have Money? (And How EverTry Can Help)
Favicon
Connect Namecheap Domain to KnownHost
Favicon
Deploy Laravel Projects to Namecheap Server on Github Push with 3 Easy Steps (The only tutorial you would every need)
Favicon
Set up Domain name in Vercel Project
Favicon
How to Get a Free Custom Domain as a Student
Favicon
Deploy Next.js to Contabo VPS
Favicon
Moving DNS Records from NameCheap to Cloudflare
Favicon
How to link your Namecheap domain to GitHub Pages
Favicon
How to deploy a Django app on an AWS EC2 instance
Favicon
How to connect your domain from Namecheap to Amazon Route 53
Favicon
Setting up Domain with Namecheap & Netlify
Favicon
How I could manage (without permission) someone else their Shopify domain via Namecheap.
Favicon
Deploying Django Application on AWS with Terraform. Namecheap Domain + SSL
Favicon
Change Netlify Domain to Namecheap using Azure DNS Zone
Favicon
Deploying and Hosting a Custom Domain on Vercel
Favicon
Setting up Namecheap domain in Vercel
Favicon
#Hosting With cPanel React App
Favicon
Setting up a Namecheap domain on Begin.
Favicon
Let’s Encrypt SSL certificate in Namecheap AutoRenewal – Verified & working – Using ACME.sh
Favicon
How to configure custom Namecheap domain to GitHub Pages
Favicon
“DNS” URL redirect records considered harmful
Favicon
Custom domain name, Heroku, and SSL
Favicon
Getting a Free Domain For Students

Featured ones: