How to install SSL Certificate on Website without C-panel on UBUNTU Server Using Command line.



You have your website installed on an Ubuntu server and your website is Hosted on Cloud Platforms like  “Google Cloud” or “Oracle Cloud.”  and you don’t have a cPanel installed on your system and You want to install an SSL certificate on your website and you are seeing “Not Secure” Exclamation while browsing your website, This can be pretty bad for your website visitor, Today we will be talking about how to install an SSL certificate in your browser.




In order to make your website, SSL protected you need to have a few things Handy.

  1. You need to have access to your Ubuntu terminal server so that you can run commands with SUDO.
  2. You need to have a valid SSL certificate on your system Which we will get by downloading the plugin WP FREE SSL – Free SSL Certificate for WordPress and force HTTPS
  3. You need to add an entry in your example.com.conf file which is located mainly in your “/etc/apache2/sites-available/”

Step:- 1

Go ahead and log into your WordPress login page and then click on plugins and try to search for the plugin:-  “WP FREE SSL – Free SSL Certificate for WordPress and force HTTPS

Go ahead and download the plugin and then click on activate to activate the plugin.




Step:- 2

Once you have downloaded and Activated the plugin, You will be able to see the plugin in the Left side menu of your WordPress, Simply click on WP Free SSL.

Now you need to provide your email address and click on next. You can provide any of your personal email addresses.




Once you clicked on “Next” you will get a notification “Your certificate is ready to download” as shown below, Click on OK.




Next, you will get the notification that your certificate is saved.




Now you have your SSL Certificate on your system, and the plug-in will try to install the certificate Automatically for you.




It’s perfect if the certificate is installed automatically and you can try your Web site with HTTPS//,  if it’s not installed then you need to install it manually on your system.

The certificates will be stored on your Ubuntu server now and you need to look for the two files “certificate.crt” & “private.pem” .

By default, these will be stored at the below location

/home4/learnai5/public_html/wp-content/plugins/wp-free-ssl/keys/certificate.crt

/home4/learnai5/public_html/wp-content/plugins/wp-free-ssl/keys/private.pem

or you can search the files using the below “find” command to check the location of files on your server, these commands will help you find the location of certificate files on your server.

“sudo find / -iname certificate.crt*”

“sudo find / -iname private.pem*”

Step :- 3

Now you need to add the below code in your “example.com.conf” file, in my case, my domain name is “example.com” so I will edit the “learnages.com.conf” file.

This file can be found in the following path 

/etc/apache2/sites-available/

or you can search the file with the below command, Please note that you need to put in your domain name in case of the “example.com”, for example, if your domain name is xyz.com you need to search for the file xyz.com.conf.

sudo find / -iname example.com.conf*

use the nano file editor to open the file.

sudo nano /etc/apache2/sites-available/example.com.conf

Add the below code to the file and save and close the file as shown in the screenshot below. and make sure to edit the path for the certificate files if needed.

<VirtualHost *:443> DocumentRoot /var/www/html ServerName www.example.com SSLEngine on SSLCertificateFile /home4/learnai5/public_html/wp-content/plugins/wp-free-ssl/keys/certificate.crt SSLCertificateKeyFile /home4/learnai5/public_html/wp-content/plugins/wp-free-ssl/keys/private.pem </VirtualHost>

The Code highlighted in YELLOW is for “HTTP” and the one highlighted in RED is for HTTPS, once the certificates are downloaded to your system add the code boxed in RED to your  example.com.conf file 



Post a Comment

0 Comments