How to set up a SSL Certificate with Apache on Ubuntu 16.04

A SSL certificate is a way to encrypt a site information and secure credit card transactions and keeps data secure between servers. When a SSL certificate is successfully installed, the application HTTP will change to HTTPs, where the ‘S’ stands for ‘secure'.

Step 1. Install mod_ssl
 We first have to be sure that Apache and Mod SSL are installed on our VPS. You can install both with one command:
  yum install mod_ssl 

Step 2.Create a directory to store the server key and certificate
 mkdir /etc/httpd/ssl

 Step 3. Create a Signed Certificate:
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/httpd/ssl/apache.key -out /etc/httpd/ssl/apache.crt

With this command, the certificate will expire after one year and you are about to be asked to enter information that will be incorporated into your certificate request: Country Name, State or Province, Locality Name, Organization Name, Organizational Unit Name, Common Name, Email Address.

 4.The next thing to do is to set up the virtual hosts to display the new certificate. Open up the SSL config file:
vi /etc/httpd/conf.d/ssl.conf

You need to config these places:
ServerAdmin: This is a email address of your webmaster.
ServerName: This is your domain name.
DocumentRoot: This is the directory where you keep your site information.
SSLCertificateFile and SSLCertificateKeyFile: The certificate for each site is stored in the directory /etc/httpd/ssl that we created earlier in the step 2.

 5. Restart Apache
  In order to reload the config you have changed, run command:
  /etc/init.d/httpd restart
If you liked this article

Let's subscribe the updates of Scuti!
Share on Google Plus

About Quang Hoan

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment


Post a Comment