Categories: SSL

How to install ssl certificate on centos

SSL Certificate

A SSL certificate is a way to encrypt a site’s information and create a more secure connection. In order to install an SSL certificate you have to follow main four steps:
1) Create CSR and Private Key
2) Purchase an SSL certificate from a provider ( you can purchase from here )
3) Submit the CSR to the provider and they will email you the certificate
4) Add the certificate to the server

Step One: Install Mod SSL
Install apache SSL module and restart the apache service
yum install mod_ssl

service httpd restart

If you use any firewall, please make sure the port 443 is opened.

Step Two :  Generate the CSR and Private Key

Let’s create these files on a directory called /etc/httpd/ssl ( you can store this anywhere on the server )

mkdir /etc/httpd/ssl
cd /etc/httpd/ssl
openssl req -newkey rsa:2048 -nodes -keyout example.com.key -out example.com.csr
This will ask you to enter few information and please provide accurate information. If there are any error , you can delete the two files example.com.key and example.com.csr and run the command again.

Step Three:  Purchase an SSL certificate

Purchase an SSL certificate from your desired provider and submit the generated CSR and the provider will email you an SSL certificate and intermediate certificate.

Step Four:  Install the certificate

Let’s keep the certificate and intermediate certificate in /etc/httpd/ssl

I assume that we have following files in /etc/httpd/ssl

example.com.key
example.com.csr
example.com.crt
inter-mediate-certificate.crt ( optional , but browsers may show warning if this is not installed on server )

Now edit  /etc/httpd/conf/ssl.conf and add below lines

SSLEngine on
SSLCertificateFile /etc/httpd/ssl/example.com.crt
SSLCertificateKeyFile /etc/httpd/ssl/example.com.key
SSLCertificateChainFile /etc/httpd/ssl/inter-mediate-certificate.crt

If you use many websites on your server, you can add this inside the virtual host

<VirtualHost *:443>
ServerName example.com
DocumentRoot /home/user/public_html
SSLEngine on
SSLCertificateFile /etc/httpd/ssl/example.com.crt
SSLCertificateKeyFile /etc/httpd/ssl/example.com.key
SSLCertificateChainFile /etc/httpd/ssl/inter-mediate-certificate.crt
</VirtualHost>

Hosting Ahead

Share
Published by
Hosting Ahead

Recent Posts

Find and fix word Press vulnerabilities using WP Toolkit

If you purchased hosting services from us, you can use the WP Toolkit to scan…

2 years ago

Run composer with different PHP version

If multiple PHP versions are installed on your server you need to tell the composer…

3 years ago

How to Install WordPress using WordPress Toolkit in cPanel

Wordpress toolkit allows the installation, configuration, and management of Wordpress. The first step is to…

4 years ago

Configure OpenVPN Client Devices for Andriod

These instructions cover installing and configuring the OpenVPN Connect app  Client-Side Configurations: Android There are…

4 years ago

The certificate chain was issued by an authority that is not trusted | SQL Server

This error may appear when you try to connect to Microsft SQL server or you…

4 years ago

Free website hosting support in this COVID pandemic

Hello everyone, The COVID-19 should have affected almost everyone in a way or another. When…

5 years ago