Installing Let’s Encrypt on Custom PHP Sites

by Ahmed Khan  May 18, 2016

In my previous article, I discussed how you could install custom SSL on your PHP sites. Since the introduction of Let’s Encrypt on Cloudways, adding SSL to your site has become a matter of a few clicks. But first, let me introduce you to Let’s Encrypt.

Let's Encrypt on PHP Website

What is Let’s Encrypt

Let’s Encrypt is a free SSL certificate approved by IETF(Internet Engineering Task Force). It is a secured open-certificate authority. The certificate installed through Let’s Encrypt expires after three months, so you need to get it reissued before it expires. Cloudways now warns you 15 days prior to the expiration  of your Let’s Encrypt certificate. If you have selected the auto renew option, it will renew the certificate for your domain automatically. Here is how you could use this free service on your PHP sites.

Installing Let’s Encrypt On Your Sites

Some points to keep in mind before installing Let’s Encrypt:

  • It cannot be installed on the staging URLs that Cloudways provides you when you first launch your application.
  • The domain must be running on the same server where the Let’s Encrypt is being installed.
  • There must be a DNS propagation time for that domain on the same server where you are going to install Let’s Encrypt certificate.
  • You can only install Let’s Encrypt 5 times in a week at a single domain.
  • Certificate will be installed for urls with www and without www.
  • When you clone your server or your app you need to reinstall the certificate.

First login to your Cloudways account and go to the application for which you want to install Let’s Encrypt. Once in your application, click on SSL Certificate from the left side menu.

SSL Certificate

You will see two options: one is for Let’s Encrypt and the other is for installing Paid Certificate as I showed you in my previous article. In the Let’s Encrypt dialog box, enter the email and the domain where you are installing Let’s Encrypt and click on Install Certificate.

Install Certificate

Once you click on Install Certificate, wait for the application to finish installing Let’s Encrypt Certificate for your site.

Installing Let's Encrypt

Once it is installed, you will be asked for permission to auto renew your certificate. If you want to renew it manually select NO, else select YES. Click SAVE CHANGES to save your selections.

SSL Management

Now whenever your certificate is near expiration,  you will get an email from Cloudways that your Let’s Encrypt certificate is expiring and Cloudways will renew the certificate (if you have so opted). In order to verify the certificate, visit your domain using the HTTPS prefix (e.g. https://www.yourdomain.com).

Now that the certificate is installed, you need to force your site to use HTTPS for all visitors. For this, add these lines to your .htaccess file.

The reason for forcing your site to use  HTTPS is that once you have installed SSL on your site, the website is accessible in two versions, one with HTTP and one with HTTPS. Search engines, especially Google, consider the two versions as different sites and this negatively affect your rankings in search engines because of the issue of Duplicate Content.

SSL certificates are now important requirement for all ecommerce websites. Using the Managed PHP Hosting Platform offered by Cloudways and the ease of Let’s Encrypt SSL certificates, managing business websites is now a breeze.

Create PHP websites without the worry of server management.

Deploy your PHP app on optimized PHP hosting servers.

About Ahmed Khan

Ahmed was a PHP community expert at Cloudways - A Managed PHP Hosting Cloud Platform. He is a software engineer with extensive knowledge in PHP and SEO. He loves watching Game of Thrones is his free time. Follow Ahmed on Twitter to stay updated with his works. You can email him at ahmed.khan@cloudways.com

Stay Connected:

You Might Also Like...