ssl

ssl





# Install Let's Encrypt SSL on ServerPilot (Free Plan) / Digitalocean Hosted Droplet

Automate the installation of Let's Encrypt SSL on the free plan of ServerPilot

This script adds Let's encrypt SLL to your Wordpress site created using Serverpilot and hosted on Digitalocean.

ServerPilot offers auto installation of Let's encrypt with upgrade account about $10 per month. This script saves the time and works with free serverpilot account. It's install SSL + adds a cornjob that renew Let's encrypt SSL.


Remember: If this article helped you, consider signup using this link to DIgitalOcean to get $10 bonus for your droplet, (that's about 2 month of free hosting).

PS: I spent about 5 days to test this, created script, and added every possible help with all the required resources.


I tested this on devendrameena.com


Important:

Create Droplet Snapshot: Visit your droplet > Snapshot and create a snapshot, will take 5-minutes, in case something goes wrong, you can restore it with one click.

DNS: Visit you DNS management site, and make sure to have


What Do you need.

Putty (To give ssh command)

Droplet's root password. (You can always reset going to DigitalOcean > Droplet > Access > Reset Root Password).

appname (Visit serverpilot and check app name)



--

Open Putty, enter your droplet's IP address.

Type "root" when asked login as. And then your root password (it won't show just type and hit enter).


## Installing Let's Encrypt

### Clone the repo

If git isn't installed on your droplet, install it using this command

<pre>sudo apt-get -y install git</pre>

and then run this command to clone the repository

<pre>sudo git clone https://github.com/quickfever/digitalocean-serverpilot-letsencrypt.git && cd digitalocean-serverpilot-letsencrypt && sudo mv sple.sh /usr/local/bin/qfssl && sudo chmod +x /usr/local/bin/qfssl

</pre>

// The repo will be copied to your system under **/usr/local/bin** and will be made executable. And you don't need to do anything :)


Note: Let's encrypt allow only 5 SSL certificates per domain per week. If you think you already made this mistake, you've to wait for a week before using this method or use a different domain or subdomain of the domain you're adding SSL for.


## Install SSL

Here are the simple steps to install SSL on your apps

For main domains (Don't include www with your domain)

Visit serverpilot > Server > App, write down the app name.

<pre>qfssl install example.com app_name main</pre>


Note: Either if your site is www or naked, use the above command it will issue SSL for example.com and www.example.com

Security Note: If you wonder why it didn't asked for your email and agree to terms as Default let's encrypt installation asks so, I used this command to get past that.

// letsencrypt certonly --register-unsafely-without-email --agree-tos -d $domainName -d www.$domainName // Perhaps, It doesn't matter.

### For sub domains

If you run your website with subdomain like, blog.example.com etc.

<pre>qfssl install blog.example.com app_name sub</pre>




## Uninstall SSL

qfssl uninstall example.com app_name

qfssl uninstall sub.example.com app_name

Any questions? Ask me in the comment section.


Htaccess Changes.


If your site runs at www.

You may want to redirect http, https:// to secure https://www, use the following code and add it to your .htaccess file.



If your site runs at non-www

You might want to redirect http, www, https://www to secure https://, use the following code and add it to your .htaccess file.


RewriteEngine on

RewriteCond %{HTTP_HOST} ^www\.example\.com$

RewriteRule ^(.*)$ "https\:\/\/example\.com\/$1" [R=301,L]

RewriteCond %{ENV:HTTPS} !on

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

RewriteCond %{QUERY_STRING} ^m=1$

RewriteRule ^(.*)$ /$1? [R=301,L]


Further Check



Also this crt.sh site keeps tracks at your issued SSL.


Further Note: I used devendrameena.com as a demo in the process, as it's more of a personal site, I'll move it back to blogger server.

What more: If this article helped you, consider signup using this link to DIgitalOcean to get $10 bonus for your droplet, (that's about 2 month of free hosting).



If you're using Yoast SEO plugin and enabled Sitemap.

Visit the sitemap page in Yoast SEO settings and disable, save it, then enable it again to force sitemap to change http to https.


Report Page