How to Purchase and Install an SSL Certificate on Ubuntu

Article by: Chris Marks


It is increasingly important to ensure that any data sent to websites is transmitted using encryption to protect visitors to the site. SSL certificates provide a method to encrypt data during transmission to the server. Any ubuntu server is capable of providing secure connections to sites hosted there by a web server such as Apache or Nginx.


Ordering the Certificate

Select the desired product as listed on: https://www.hivelocity.net/enhancements/ssl/


View the different SSL options available at hivelocity.net/enhancements/ssl/


Select the certificate type from the list and look for the option to request this certificate. You will be prompted to log into your account if you are not already logged in.


Selecting A Commodo instant SSL inside my.hivelocity.net

Once you click buy now you will be prompted to answer a series of questions that are required to create the certificate, explained below:


Country Name:

This is the two-letter abbreviation for your country. For example, United States would be US.

State or Province Name:

This is the full name of the state your organization operates from. For example, this might be “Florida” or “Ohio”.


Locality Name:

Name of the city your organization operates from. Examples might include “Lansing” or “Phoenix”. Don’t use abbreviations in this field. For example, “St. Petersburg” should be “Saint Petersburg”


Organization Name:

The name of your organization. If you are a business, you must use your legal name. If you are applying as an individual, you use your full name instead.


Organizational Unit Name:

If applying as a business, you can enter your Business name here. Alternately, you can use a department name here. For example, “IT Department” or “Web Administration”.


Common Name:

The domain name that you are purchasing an SSL certificate for. This must be a fully qualified domain name (FQDN). In this example, this would be: example.com


Once this information is submitted you will need to select an address to receive the authorization email that will confirm your own or control the domain you are requesting a certificate for. Please create one of the address options if they do not already exist. This will also be the email address the SSL certificate is sent to.

Choose and complete the required billing information and check the email address selected for validation. Once this is completed it’s typically just a few minutes before the SSL files are sent to the same inbox.

Uploading certificate files

The SSL files will be delivered in a compressed format many tools are available to decompress the files. If you do not already have one installed consider using 7-Zip http://www.7-zip.org/

You will need to upload both the certificate file ending in .crt as well as any ca bundle files and the private key.

Once you have your decompressed SSL certificate files Use Filezilla for Windows or Cyberduck to place the files on your Ubuntu web server.

For more inforamtion or to download filezilla visit:

https://filezilla-project.org/

Or for Mac users that need an alternative:

https://www.ssh.com/ssh/cyberduck/

Using either tool connect to your Ubuntu server In this example my Ubuntu server is responding at 192.168.100.100 so I use the following when configuring a host or server to connect to;

host: sftp://192.168.100.100

and provide your ssh user and password

You can drag the SSL files to any location displayed on your server to upload them from your local computer. In this example, we will place the SSL in the path /etc/ssl

Configuring the Web Server

There are many popular web servers available that are supported by Ubuntu. The most common are Apache and Nginx.



Nginx example

First, ensure nginx has the following options in the HTTP section of /etc/nginx/nginx.conf

http {
ssl_ciphers EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
}

For Nginx it is required to have all the certificates (one for your domain name and CA ones) combined in a single file. The certificate for your domain should be listed first in the file, followed by the chain of CA certificates.


If you have downloaded a complete CABundle file for your certificate, replace chain files' names with the name of your downloaded file. COMODO_DV_SHA-256_bundle.crt is the example for PositiveSSL certificate. It will look like:

$ cat *example.com*.crt COMODO_DV_SHA-256_bundle.crt >> cert_chain.crt

or

$ cat *example.com*.crt *example.com*.ca-bundle >> cert_chain.crt


We will need to create and edit a new file for our new domain names SSL certificate in /etc/nginx/conf.d/. To open the file for editing run:

nano /etc/nginx/conf.d/example.com.conf

We will add the following information for nginx to use to access the SSL certificate:

server {
listen 443 ssl default_server;
listen [::]:443 ssl default_server ;
server_name example.com www.example.com;
root /var/www/example.com;
ssl_certificate /etc/ssl//example.com.crt;
ssl_certificate_key /etc/ssl//example.com.key;
}


Once you have modified the VirtualHost file, it is required to restart Nginx in order to apply the changes. You can restart Nginx with this command:

nginx -s reload

The above examples are general recommendations. For complete details on SSL options for nginx please visit their site! https://www.nginx.com

Apache2 example

If your site needs to be accessible through both secure (https) and non-secure (http) connections, you need two separate files in /etc/apache2/sites-enabled/. One file is for port 80 and the other file is for port 443.

Create a new file for your domain in /etc/apache2/sites-available using:

nano /etc/apache2/sites-available/ssl-example.com

and include the following information:

<VirtualHost 0.0.0.0:443>
DocumentRoot /var/www/example.com
SSLEngine on
SSLCertificateFile /etc/ssl/example.com.crt
SSLCertificateKeyFile example.com.key
SSLCertificateChainFile /etc/ssl/cert_chain.crt
</VirtualHost>


Enable the new site:

sudo a2ensite example.com


Ensure that the SSL module is loaded:

sudo a2enmod SSL

and check the changes to apache:

Apachectl configtest

then restart apache to apply changes

/etc/init.d/apache2 restart


Full details and configuration options for apache with SSL are available at:
https://httpd.apache.org/docs/2.4/ssl/ssl_howto.html


Should have any questions or problems during your SSL order or installation please don’t hesitate to contact our staff for advice or assistance via phone at (888) 869-4678 or via a new support ticket created in your my.hivelocity.net customer portal.