Installing Let's Encrypt SSL Certificates On Namecheap Hosting
Acme.sh
This process only needs to be performed once. Running the acme.sh script creates a cron job that will handle certificate renewals.
- How to use acme.sh with cPanel for automatically renewing Let's Encrypt SSL (Gist)
- Let’s Encrypt SSL certificate in Namecheap AutoRenewal – Verified & working – Using ACME.sh (dev.to)
Same basic instructions as above, but with comments and some extra information.
Confirm expiration date of a certificate
Using a browser
- Load the site in a Chrome browser.
- Open Developer Tools.
- Click the Security tab.
- Certificate > View Certificate button.
- Expiration Date is displayed in the dialog.
Using cPanel
- Log into cPanel.
- Security > SSL/TLS
- Generate, view, upload, or delete SSL certificates will show who issued the certificates in use.
- Manage SSL Sites will show which sites have certificates, and when those certificates expire.
Troubleshooting
Certificate not renewing
Try manually running the cron job from the command line. There should be error reporting if any of the certificates fail to renew.
$ crontab -l | grep acme.sh
Certificate failing to verify using .well-known challenge
Use case
- Log into the server using ssh.
- Run
acme.shscript from the command line to renew certificate. - There will be errors to effect of
"verify error"and"invalid response from [domain]/.well-knonwn/acme-challenge/...".
Cause
Permissions errors prevent the script from writing the file to .well-known/acme-challenge/ that is used to verify ownership of the domain.
Fix
The last time this happened, I compared the permissions for the web roots and .well-known directories for two sites hosted on the same server where one site's certificate was being renewed and the other was failing. I could not find any differences in the permissions.
What I ended up doing was to move the root directory of the site, create a new directory for the site, put a potboiler index html page in the directory, and then run the acme script. After this allowed me to renew the certificate, I copied all the content from the original directory back into the new one.
See also
Let's Encrypt SSL Certificates on Namecheap Hosting (Legacy)