How to Install a SSL Certificate on Apache for Ubuntu 14.04
Creating a self-signed certificate is possible if you are only after secured data transfer. Since self-signed certificates are not honored by browsers, websites and applications that run on self-signed certs will receive a warning sign when being browsed. Nonetheless, some website and application owners choose to create their own certificates to be able to access their sites or transfer data securely without the help of certificate authorities.
However, if you are aiming to use your certificate in accessing your site via HTTPS protocol without warning signs from browsers, you would need to purchase an SSL Certificate from an established certificate authority. Symantec and GoDaddy are some of the most popular certificate authorities that you can get trusted certs from.
But, if you decide to create a self-signed certificate and know how to install a SSL Certificate on Apache for Ubuntu 14.04, read the guidelines below.
Installing an SSL Certificate on Apache for Ubuntu 14.04
Here are the steps on how you can use a self-signed certificate on Apache for Ubuntu 14.04.
- Enable the SSL Module.
When you get Ubuntu 14.04 Apache package, the SSL Module is already included. All you need to do is activate it by running the code below:
sudo a2enmod ssl
After the Module is activated, restart Apache so that the changes will take effect:
sudo service apache2 restart
- Create your self-signed certificate.
Now that the SSL Module has been activated, you can now create your self-signed certificate. But first, you need to create a directory to store the files that you will be creating. To do this, run the following code:
sudo mkdir /etc/apache2/ssl
Now, create the cert key and certificate by running this code:
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt
You will need to fill out the information about your website once you hit ‘Enter’. Provide accurate answers, particularly on the ‘Common Name’, which will be the domain where the certificate will be installed. The code will look like this:
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:Wyoming
Locality Name (eg, city) :Wyoming City
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Your Company
Organizational Unit Name (eg, section) :Department of Puppies
Common Name (e.g. server FQDN or YOUR name) :your_domain.com
Email Address :firstname.lastname@example.org
- Configure Apache to use SSL
To configure Apache to use SSL, access the file with root privileges of SSL, which is the default-ssl.conf file. Make sure that you edit the file and add the details of your self-signed SSL Certificate. Make it a point to check whether port is 443 so ensure that Apache has the right listening sockets for SSL implementation.
- Enable the SSL-enabled virtual host.
Now, after the configuration is done, you need to activate the virtual host to use the SSL. Run the code below to do so:
sudo a2ensite default-ssl.conf
Then, restart Apace for the changes to take place:
sudo service apache2 restart
After doing the steps above, you can test your setup by browsing your website. The browser should access your website through the HTTPS protocol by now.
Using a self-signed certificate will suffice your needs for an encrypted connection. But, if you need to keep warning signs from appearing when your site is browsed, purchase a certificate signed by certificate authorities like GoDaddy and Symantec. This will make things a lot easier for you when it comes to building confidence on your users.