A Step-by-Step Guide to Installing SSL Certificates on Ubuntu with Apache Servers

18 votes, average: 3.44 out of 518 votes, average: 3.44 out of 518 votes, average: 3.44 out of 518 votes, average: 3.44 out of 518 votes, average: 3.44 out of 5 (18 votes, average: 3.44 out of 5, rated)
Loading...

Everything you need to know about installing SSL certificate on Ubuntu with Apache servers

Installing an SSL Certificate on Ubuntu with Apache servers is a fairly straightforward process if you have the right guide—otherwise it can be a massive headache.

You can do it yourself or you could use our handy installation service. For those who aren’t particularly tech savvy – or who don’t feel like messing with this installation – our service is a great value. For just $59.99, a dedicated tech specialist will install the certificate for you and save you the frustration. Of course, if you’re intent on doing it yourself you can always follow this guide…

Save Up to 75% On

Comodo SSL Certificates

Tip: You can typically save a significant amount by buying your SSL certificate direct instead of through your web hosting company. We sell all Comodo SSL certificates at up to 75% off.

Setting up SSL

The first thing you’ll need to make sure of is that you have access to root privileges on the VPS. Assuming you do, you must first install open-SSL using apt-get, the command for this is:

sudo apt-get install apache2

Once this is accomplished, your next step will be to activate the SSL module. This can be done by typing:

sudo a2enmod ssl

You must then restart Apache:

sudo service apache2 restart

Generating an SSL Certificate

Now it’s time to generate a Private Key. To do this, type the command line:

opensslgenrsa-des3-outserver.key2048

After this you will need to generate a Code Signing Request (CSR). The CSR is required to generate your SSL Certificate and specify details about your website (i.e. Domain Name), whether you purchased with us or another provider. If you already have the SSL Certificate from the CA, you can skip this step and proceed with following our installation steps below.

If not, pay attention. Enter command line:

opensslreq-new-keyserver.key-outserver.csr

Make sure to fill in all the fields accurately or your request will be denied.

Installing an SSL Certificate on Ubuntu with Apache

After the CA has vetted you and sent you your SSL certificate, your next step will be to copy your certificate files to the server. Take the files you were sent and copy them to the directory on your server where they will be kept. Make them readable by root only.

Next you will need to find the Apache config file to edit. It’s typically found in: /etc/apache2/sites-enabled/your_site_name. If it’s not, run this command:

sudo a2ensite your_site_name

Open the file in text editor, and look for the <Virtual Host> block. Configure it like this:

<VirtualHost 192.168.0.1:443>DocumentRoot /var/www/SSLEngine onSSLCertificateFile /path/to/your_domain_name.crtSSLCertificateKeyFile /path/to/your_private.keySSLCertificateChainFile /path/to/CABundle.crt</VirtualHost>

Make sure to adjust the file names to match your certificate files.

NOTE: If you need your site to be accessible via both both https and http connections, you’ll need two separate files in/etc/apache2/sites-enabled/. One will be for port 80, the other for port 443.

Next you’ll need to test your Apache config files. To do this, run this command:

apachectlconfigtest

And finally you’ll need to restart Apache in order to finalize this installation.

Congratulations, you’ve now installed an SSL certificate on Ubuntu with Apache.