Install Let’s Encrypt SSL on Free Plan of ServerPilot

letsencrypt

ServerPilot’s free plan doesn’t allow you to automatically configure an SSL certificate on your servers so, in this guide, we will learn how to manually install a free Let’s Encrypt SSL certificate on your server that is being managed by ServerPilot.

Method 1: Use My Written Shell Script

Recently I’ve written a simple shell script that automates the installation of Let’s Encrypt SSL on your ServerPilot-managed server. To use my written script, visit the GitHub page here and follow the simple instructions to clone the script to your server. After cloning the script to your server, you can run a simple, one-line command to install the SSL on your domains easily. SSLs installed using the script will be automatically added to the system cron for their auto-renewal.

Method 2: Install the SSL Manually:

First of all, sign in as root using any terminal:

Next, clone Let’s Encrypt’s repository from GitHub by typing this command:

Now browse into the certbot directory by typing this command:

And then run the installer by typing this:

Let’s Encrypt installation wizard will launch. Please note that your domain name should be already pointed on your server otherwise ownership verification will fail and you will not be able to install the SSL.

Provide required details and proceed with the installation. When the wizard asks you for the domains, enter your domains (separated by either a comma or a space) and then proceed. Remember that you have to manually select the root directory for your domains and when the wizard asks you to select the root directory, locate the directory by typing /srv/users/serverpilot/apps/yourapp/public and then proceed.

Don’t forget to replace yourapp with the app name of your domain where you want to install the SSL.

Once the SSL is installed, you will be presented with a success message. Now you need to add a new (SSL) configuration file to the NGINX so the server will be able to handle the SSL requests. To do this, browse to the required directory by typing this command in terminal:

Once you reach this destination, create a new configuration file by typing this command in the terminal:

You should type your actual domain name in place of mydomain. The editor will open. Now use a local text editor (like notepad) to edit below code and then paste the modified code in your configuration file that you are currently editing with the terminal:

You need to replace mysite.com and appname with actual values. Once you add this code to the configuration file, press Ctrl + O to save the file with added code and then press Ctrl + X to exit the editor.

Please also note that the certificate files are placed in /etc/letsencrypt/live/mysite.com/ by default but this location may differ. The actual path for the files will be displayed along with the success message when SSL installation completes.

Now it’s the time to restart your server by typing below command:

When the restart is complete, visit https://yoursite.com to see either the SSL certificate is installed properly or not. If your site is being accessed over https, then proceed to force the SSL according to your preference.

Issues: If your server fails to start after your customizations and it goes down, then you must be doing something wrong during adding the configuration file. Double check your rules in the configuration blocks (in mydomain.ssl.conf file) to ensure that the information is correctly provided. If you fail to sort out the issue, then simply remove the configuration file. Type below commands in the terminal to delete the file and to restart the server again:

In such a case, you can hire an expert to install the SSL for you properly. You can hire me too at Upwork here.

36 Comments

Leave a reply