If you are looking for a simple way to install SSL certificates for your domains or subdomains on a cloud hosting account (I am with DigitalOcean) managed by a free ServerPilot account the serverpilot-letsencrypt Bash script is a great solution.

Disclaimer: Take a backup of your site before you begin and proceed at your own risk.

Note: A few steps in the screencast are incomplete. Watch it for a general idea and then follow the text instructions below the video

Step 1
In a terminal, ssh to your server as the root user.

If you don’t want to log in as a root user, log in as a normal user and do sudo su to act as root.

Step 2

Navigate to /usr/local/bin directory.

cd /usr/local/bin

Step 3
Download serverpilot-letsencrypt Bash script.


Step 4
Make it executable.

chmod +x sple.sh
or, if you are not logged in as root user: sudo chmod +x sple.sh

Step 5
Run the script.

Step 6
Enter your app name, system user, and space separated domains (primary domain at the beginning).

Step 7
Edit .htaccess (if your app is a WordPress site, .htaccess will be present. If not, create it) in the site’s root and paste

RewriteCond %{HTTP:X-Forwarded-Proto} !=https
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L]
at the beginning of the file to direct all traffic from http to https.

Step 8
Visit your site in a browser tab and you should now see https and secure message in the address bar.

If so, go back and edit the .htaccess file to change 302 to 301.

If not, follow this.

Step 9
Set SSL certificate to be auto-renewed so it is totally hands-off.

Check the version of your hosting account’s Ubuntu server by running lsb_release -a. In my case, it is 16.04.

Next, run crontab -e to edit the crontab file.

Scroll down and paste the corresponding command as given here.

In my case, it is

0 */12 * * * letsencrypt renew && service nginx-sp reload
If your server runs on a different version of Linux, add:

0 */12 * * * letsencrypt renew


Please enter your comment!
Please enter your name here