GoDaddy Install Free Let’s Encrypt SSL Certificate and Renewal using SSH

GoDaddy Install Free Let’s Encrypt SSL Certificate and Renewal using SSH

In this article, we will learn How to install Let’s Encrypt Free SSL using the GoDaddy SSH Control Panel. We will also learn How to enable automatic renewal for a Let’s Encrypt SSL certificate. To install Let’s encrypt SSL certificate, we need to first enable SSH access. To enable SSH access on GoDaddy shared hosting please check this article. 

After enabling the SSH access for your GoDaddy shared hosting, connect your server with an SSH client. We are using putty. We opened putty and connected to our GoDaddy shared hosting server.

Install acme.sh Script

To install Let’s Encrypt SSL certificate, we need to first download and install ache.sh script. It will help us to install and renew the SSL certificate. To download and install acme.sh script execute the following command.

Code

curl https://get.acme.sh | sh

Next, we need to close the Putty or the SSH client session. Close the current session and relaunch Putty or your SSH client. Why? We need to use the above script and without the new session, we can’t use it.

Create a GoDaddy developer API key

To use acme.sh script we need developer access. To get the developer access and the developer API key visit https://developer.godaddy.com/keys/ page and then create a new API key. If you have an existing one, feel free to use the same.
1. Visit https://developer.godaddy.com/keys/
2. Generate the key for the production.
3. In the new SSH session execute the following commands to export the API keys.

Code

export GD_Key=YOUR_KEY_HERE
export GD_Secret=YOUR_SECRET_HERE

Issue free Let’s Encrypt SSL certificate

We are ready to generate a new free Let's Encrypt SSL certificate for our domain hosted on GoDaddy shared hosting. To issue a new SSL certificate, execute the following command.

Code

acme.sh --issue -d websitenhost.com -d www.websitenhost.com -w ~/www --dns dns_gd

In the above command, we are issuing Let’s Encrypt free SSL certificate for the domain websitenhost.com. You need to replace “websitenhost.com” with your own domain.

Install Free SSL Certificate

Let’s Encrypt free SSL certificate is issued for our domain. Next, we need to install it. First, we need to enable DEPLOY_CPANEL_USER. To enable it, open “cpanel_uapi.sh” using the nano editor. Execute the following command and uncomment DEPLOY_CPANEL_USER variable available at the top. It is a variable we need to update its value. Change its value based on your cPanel account username. In the above script, we are issuing Let’s Encrypt free SSL certificate for the domain websitenhost.com. You need to replace “websitenhost.com” with your own domain.

Code

nano ~/.acme.sh/deploy/cpanel_uapi.sh

To save the above changes, press Ctrl+O to overwrite all the changes and Ctrl+K to close the editor.

If everything is fine you can get the following output.

Cron Job to Renew SSL certificates

We are almost done with SSL installation. We installed Let’s Encrypt SSL certificate using acme.sh. When we used acme.sh script, it will auto-create a Cron job to renew the SSL certificate. We can check it using the following command. 

Code

crontab -l

After renewing the SSL certificate, we need to deploy our SSL certificate. To auto-deploy the latest SSL certificate, we will create a new cron job to deploy the SSL certificates. We need to create a specific cron job for each available domain.  For this execute the following command and add lines based on your domain.

Code

EDITOR=nano VISUAL=nano crontab -e

For example, we need to add the following line. Repeat the line based on the number of domains.

Code

1 0 1 * * ~/.acme.sh/acme.sh --deploy -d websitenhost.com --deploy-hook cpanel_uapi

Add all the lines for all your domains. Once done, close the nano editor using Ctrl+O and Ctrl+K keyboard shortcut. You can also check the cron job entries in the GoDaddy control panel.

Redirect HTTP traffic to HTTPS

We are done with SSL installation and renewal configuration. One last thing we need to check How to redirect HTTP traffic to HTTPS. If we are using SSL, then it is important to redirect our HTTP traffic to HTTPS. To redirect our HTTP traffic to HTTPs, we will use the .htaccess file. Edit the file if it is not available to create one. For us, we are using Word Press, so it is already available. Open the file in any editor and add the following line. Save and close the file.

Code

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

You can refer the following file to the correct location for adding the above line. If you need to learn more about .htaccess rewrite engine, please check this article.

We are done with everything. Finally, test our website. Visit the website with HTTP and HTTPS protocol. If you are using HTTP, you will be redirected to HTTPS, assuming you have necessary changes in the .htaccess file.

0 Comments
Leave A Comment

Please login to post your valuable comments.

Join the newsletter

Get the latest vLemonn news first

share