How to Install Let’s Encrypt Free SSL on NameCheap Shared Hosting

Last year, I heard about Let’s Encrypts free SSL. But I was using WordPress.com to host my website. So I already had SSL on my site. So I did not pay much attention to it.

From 2017, I am quite serious about my site and have a plan to write regularly on my blog. I have a “bad reputation” for coming up with a new idea every morning. So yesterday I installed the free SSL certificate on my shared hosting and saved 10 USD!

So here’s how I did it.

  1. Searched for “Free SSL” on google. (I forgot the name Let’s Encrypt ๐Ÿ˜ ).
  2. Then I found a couple of organizations and the name “Let’s Encrypt” clicked in my head! Because my boss mentioned this name earlier.
  3. Then I searched again “Let’s encrypt on a shared hosting” and opened another tab to check if NameCheap has any built-in support for Let’s Encrypt. So I searched again.
  4. Then I found this article:ย How To Install Free SSL From Let’s Encrypt On Shared Hosting
  5. Opened up the terminal on my MacBook and wrote
    ssh -p 21098 myUserName@sekander.pro
    Here ย -p 20198ย is the port number for shell access. I got the port number from NameCheap’s Support doc.
  6. Then I used my cPanel password as the shell password.

    But the terminal told me that I do not have shell access enabled on my hosting. So I contacted NameCheap support via live chat.

  7. So I logged in again and ran the commands following commands
    git clone https://github.com/kelunik/acme-client
    cd acme-client
    php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"; php composer-setup.php; php -r "unlink('composer-setup.php');"; php composer.phar install --no-dev
    php bin/acme setup --server letsencrypt --email your@email.com
    php bin/acme issue --domains yourdomain.com:www.youdomain.com --path /home/x123011738/public_html:/home/x123011738/public_html --server letsencrypt
    Requesting certificate ...
    Successfully issued certificate.
    See /home/x123011738/acme-client/data/certs/acme-v01.api.letsencrypt.org.directory/yourdomain.com
    cd /home/x123011738/acme-client/data/certs/acme-v01.api.letsencrypt.org.directory/yourdomain.com

    Then I copied the contents ofย the fullchain and key file using the commands below and saved on my desktop with the same name.

    cat fullchain.pem
    cat key.pem
  8. Then, I logged into the cPanel of my site and found the option to manage SSL Certificates. I selected the domain and uploaded the files I have made on my desktop.If your site has static HTML files, then you’re done till here. But mine is a WordPress powered site. So I had to change the URL structure from wp-admin โ†’ Settings โ†’ General. I have changed http://sekander.pro to https://sekander.pro and then saved the settings.
  9. But I was not happy yet. Because I found the SSL certificate on the single posts and pages. But it was not working on the homepage ๐Ÿ˜
  10. So I had to google again “Setup SSL WordPress” and found that I need to paste something in my .htaccess file!
  11. I logged in to the cPanel again and good lord! There’s no .htacess file on the hosting root! How’s this possible! How can a WordPress site run without a .htacess file!
    Then my colleague, who luckily works on the Dokan plugin support team, told me that it could be hidden. So I enabled showing hidden files and voila! The file was there with hefty lines of rewrite rules and allowing file types to uploading.
  12. I pasted the following lines at the very end of the .htacess file
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://www.yoursite.com/$1 [R,L]
    </IfModule>

    This article has more detailed information:ย How to Add SSL and HTTPS in WordPress

    It helped me to redirect the traffic with http to redirect to https. So now I can see the green https on the home page ๐Ÿ˜„

  13. I have setup a cron job to renew the SSL certificate every month.

This is all I have done to activate SSL on this site. If you get confused or need any clarification from me, feel free to comment below ๐Ÿ™‚

Default image
Sekander
Love to scroll social media and watch food vlogs. Trying to get my bachelors degree in business administration and working as a business development consultant for software companies at home and abroad.

6 Comments

  1. when run this [1] command then showing this [2] error

    1. php -r “copy(‘https://getcomposer.org/installer’, ‘composer-setup.php’);”; php composer-setup.php; php -r “unlink(‘composer-setup.php’);”; php composer.phar install –no-dev

    2. Some settings on your machine make Composer unable to work properly.
    Make sure that you fix the issues listed below and run this script again: ‘composer-setup.php’);”; php composer-s
    The suhosin.executor.include.whitelist setting is incorrect.
    Add the following to the end of your `php.ini` or suhosin.ini (Example path [for Debian]: /etc/php5/cli/conf.d/suhosin.ini):
    suhosin.executor.include.whitelist = phar

    The php.ini used by your command-line PHP is: /opt/alt/php56/etc/php.ini
    If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.

    Could not open input file: composer.phar

    • Hello Rubel,

      Sorry to know that you’re having issues installing SSL on your site. I would request you to look at the error message carefully.

      It is telling that a setting in your php.ini file is not correct to run the files with .phar extension. It is also mentioned that which setting needs to be configured.

      If you are unable to do the changes, please contact your hosting provider for assistance.

  2. Could you detail what you did for step 13?

    • Hey Steve,
      I have copy pasted the renew command to the cron option of my cPanel but it does not help. Because each time a new certificate is generated, I need to copy paste the keychain to the SSL section of the cPanel.

      However, the cron job fails everytime!

      I go through the entire process when I need to renew.

  3. When I run this:
    php bin/acme setup –server letsencrypt –email withmyemailhere@email.com
    I get error.

    • Hello Waseem,
      There could be several reasons for the error message. Please double check if you are on the right location and everything is up to date

      I have been following this process for more than a year and I never found such conflict. I removed the error message for security reasons. It was showing your cPanel username!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.