Install SSL Certificate on Ubuntu
Before you start, please make sure you have downloaded your certificate files.
After downloading your certificate, you should have the following certificate files:
- certificate.crt
- cabundle.crt
- privatekey.pem
Step 1: Upload Certificate to Server
First, copy your certificate files to the directory where you keep your certificate and key files. Typically, this directory is /etc/ssl/
for your certificate.crt and cabundle.crt files, and /etc/ssl/private/
for your privatekey.pem file.
Step 2: Adjust Apache.config File
Next, you will need to find the Apache configuration file on your server. Typically, you will find the configuration file in /etc/apache2/sites-enabled/your_site_name
.
In case you cannot find your configuration file, you can run the following command:
sudo a2ensite your_site_name
Once the Apache configuration file is located, you will need to configure the virtual host section of your website. Before you do so, please make sure to create a backup of your current *.conf
file. This way, you will be able to undo any changes in case something goes wrong.
A typical Virtual Host file looks like the file below:
<VirtualHost *:443> DocumentRoot /var/www/site ServerName www.domain.com SSLEngine on SSLCertificateFile /path/to/certificate.crt SSLCertificateKeyFile /path/to/privatekey.pem SSLCertificateChainFile /path/to/cabundle.crt </VirtualHost>
The part above starting with SSLEngine on is the one you will need to add or edit based on the file paths your certificate files are located in. Please make sure the attributes in bold don't have a "#" (comment) prepended; if they do, please remove that symbol to uncomment them.
As mentioned above, you will need to change the file names to match your certificate files and their location on the server:
- SSLCertificateFile: This is your primary SSL certificate file (certificate.crt)
- SSLCertificateChainFile: This is your CA-Bundle file (cabundle.crt)
- SSLCertificateKeyFile: This is your private key file (privatekey.pem)
To verify whether or not your configuration works, you can run the following command:
apachectlConfigtest
Next, save your Apache configuration file and restart your server using one of the commands below:
apachectl stop
apachectl start
apachectl restart
In case something goes wrong along the way, please rest assured that you will be able to revert your Apache configuration file using the backup you have created earlier in the process. This way, you will be able to start over again.
Go to SSL Zen Plugin and click on the Next button on Step 3. Our plugin will automatically detect if you have installed the SSL certificate correctly. If you have, click on the Next button in Step 4 and we will replace your website http url with https.
Congratulations, your site has now been secured using your new SSL certificate!