Search

How to Install SSL Certificate on Ubuntu Server

post-title

SSL certificate is becoming mandatory for web application. All modern web browsers are blocking request and ask user permission to proceed.

In this article, I will share you how you can install SSL certificate using Terminal access.

After you logged in to server, First generate CSR using openssl command.

openssl req -new -newkey rsa:2048 -nodes -keyout yourdomain.key -out yourdomain.csr

This will ask few question through wizard. Answer them and proceed for next step.

Now we need to configure Apache server to use .key and .csr certificate files from home directory. Apache main configuration file located at /etc/apache2/sites-available/000-default.conf file. Open the file using nano editor and change file.

<VirtualHost *:443>
    ServerAdmin admin@yourdomain.com
    DocumentRoot /var/www/html
    ServerName Domain name (Ex - test.com)
    ServerAlias www.yourdomain (www.test.com)
    SSLEngine on
    SSLCertificateFile /etc/apache2/ssl/c09fdeafb99483d9.crt (path from crt file which generate from godaddy (.crt file))
    SSLCertificateKeyFile /etc/apache2/ssl/bsstgulm.key (path from key file when generate the csr for domain)
    SSLCACertificateFile /etc/apache2/ssl/gd_bundle-g2-g1.crt path from crt file which generate from godaddy (.crt file))
    <Directory /var/www/html>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

<VirtualHost *:80>
       ServerName Domain name (Ex - test.com)
    ServerAlias www.yourdomain.com (www.test.com)
    Redirect permanent / https://www.yourdomain.com
</VirtualHost>

In Terminal go to this /etc/apache2/ path and run the below command:

apache2ctl configtest
a2enmod ssl

Lastly you will need to restart Apache server.

sudo service apache2 restart

Now your domain will be ssl certificate installed. I hope this article will help you.