Install SSL to Apache in Cent OS or UBUNTU


We have three files like,yourdomain_com.crt and server.key downloaded from any ssl website


The and yourdomain_com.crt move to /etc/pki/tls/certs location

[dilsebol@li1624–137 ~]$ sudo cp dilsebol_com.crt /etc/pki/tls/certs/
[dilsebol@li1624–137 ~]$ sudo cp etc/pki/tls/certs/


server.key or key file move to /etc/pki/tls/private

[dilsebol@li1624–137 ~]$ sudo cp dilsebol_com.crt /etc/pki/tls/private/


Go to /etc/pki/tls/certs location and change the bundle file name to .crt file

[dilsebol@li1624–137 ~]$ cd /etc/pki/tls/certs/
[dilsebol@li1624–137 ~]$ sudo cp bundle.crt


Go to the /etc/pki/tls/private location and Change the key file name to

[dilsebol@li1624–137 ~]$ cd /etc/pki/tls/private/
[dilsebol@li1624–137 ~]$ sudo cp server.key


Open to the httpd ssl.conf file and change the content of virtualhost tag

[dilsebol@li1624–137 ~]$ sudo vi /etc/httpd/conf.d/ssl.conf

This the edited content of virtualhost tag

ServerName #(ex:
SSLCertificateFile /etc/pki/tls/certs/yourdomain_com.crt
SSLCertificateKeyFile /etc/pki/tls/private/
SSLCACertificateFile /etc/pki/tls/certs/bundle.crt


Open to httpd.conf file and go to last line after IncludeOptional conf.d/*.conf line, change the content below i mentioned

[dilsebol@li1624–137 ~]$ sudo vi /etc/httpd/conf/httpd.conf

<VirtualHost *:80>
 ServerAdmin <
your email id>
 DocumentRoot /var/www/html/Your_project_folder
 RewriteEngine On


Open the hosts file in /etc/hosts location and put your ip and domain name

[dilsebol@li1624–137 ~]$ sudo vi /etc/hosts localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
<your IP>

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.