• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to Secure the website Using SSL on CentOS 7.6

  • 00:25 yum install mod_ssl openssl -y
  • 00:45 openssl genrsa -out ca.key 2048
  • 00:57 openssl req -new -key ca.key -out ca.csr
  • 01:28 openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt
  • 01:35 cp ca.crt /etc/pki/tls/certs
  • 01:37 cp ca.key /etc/pki/tls/private/
  • 01:46 cp ca.csr /etc/pki/tls/private
  • 01:54 vim /etc/httpd/conf.d/ssl.conf
  • 02:27 vim /etc/httpd/conf.d/trail.conf
{{postValue.id}}

Secure the Website Using SSL certificate On CentOS 7.6

Procedure :

Install the packages that secire the web site by using the following command.

[root@linuxhelp ~]# yum install mod_ssl openssl -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.dhakacom.com
 * epel: ftp.riken.jp
 * extras: mirror.nbrc.ac.in
 * remi-php72: ftp.riken.jp
 * remi-safe: ftp.riken.jp
 * updates: mirror.nbrc.ac.in
.
.
.
.
.

Installed:
  mod_ssl.x86_64 1:2.4.6-89.el7.centos                                                                                                       

Updated:
  openssl.x86_64 1:1.0.2k-16.el7_6.1                                                                                                         

Dependency Updated:
  httpd.x86_64 0:2.4.6-89.el7.centos         httpd-tools.x86_64 0:2.4.6-89.el7.centos         openssl-libs.x86_64 1:1.0.2k-16.el7_6.1        

Complete!

Generate the private key by using the following command

[root@linuxhelp ~]# openssl genrsa -out ca.key 2048
Generating RSA private key, 2048 bit long modulus
.............................................................+++
.............................................................+++
e is 65537 (0x10001)

Generate the certificate signing request by using the following command

[root@linuxhelp ~]# openssl req -new -key ca.key -out ca.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:IN
State or Province Name (full name) []:TN
Locality Name (eg, city) [Default City]:
Organization Name (eg, company) [Default Company Ltd]:
Organizational Unit Name (eg, section) []:LinuxHelp1
Common Name (eg, your name or your server's hostname) []:192.168.7.229
Email Address []:abc@example.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:Linuxc@25abcd
An optional company name []:Lucky

Generate self signed ssl certificate with 365 active days

[root@linuxhelp ~]# openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt
Signature ok
subject=/C=IN/ST=TN/L=Default City/O=Default Company Ltd/OU=LinuxHelp1/CN=192.168.7.229/emailAddress=abc@example.com
Getting Private key

Copy the generated certificates in their appropriate locations.

[root@linuxhelp ~]# cp ca.crt /etc/pki/tls/certs
[root@linuxhelp ~]# cp ca.key /etc/pki/tls/private/
[root@linuxhelp ~]# cp ca.csr /etc/pki/tls/private

Open a ssl configuration file and modify the following changes.

root@linuxhelp ~]# vim /etc/httpd/conf.d/ssl.conf
SSLCertificateFile /etc/pki/tls/certs/ca.crt
SSLCertificateKeyFile /etc/pki/tls/private/ca.key

Create a virtualhost for secure the website as follows:

[root@linuxhelp ~]# vim /etc/httpd/conf.d/trail.conf
< VirtualHost *:443> 
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/ca.crt
SSLCertificateKeyFile /etc/pki/tls/private/ca.key
servername www.linuxhelp1.com
Documentroot /var/www/html
< /VirtualHost>

Navigate to docuemnt root directory to create a html file

[root@linuxhelp ~]# cd /var/www/html
[root@linuxhelp html]# vim index.html
<h1>
Hello You Awesome People out there.
</h1>

Test the configuration file of Apache

[root@linuxhelp html]# httpd -t
Syntax OK

Restart the service of Apache.

root@linuxhelp html]# systemctl restart httpd

Open the browser and enter the server name as follows: snap1 (1) Click on Advanced and Add exception snap1 (2) snap1 (3) Confirm the security exception and view the content that has saved in the index.html snap1 (4) snap1 (5) With this,Using SSL vertificate secured the website On CentOS 7.6

Tags:
william
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

Do you have any utilities that can help me install a SSL certificate?

A

Yes. If you are using Apache or IIS web servers, we offer a free utility which will help you generate a CSR, submit it to Comodo and then automatically install your SSL certificate.

Q

When trying to go to the site over HTTPS it displays the message 'The page cannot be displayed'?

A

Here usually caused by port 443 not allowed through the firewall or by the SSL Certificate not having a corresponding key file.

Q

Why I have changed my server or moved to a different provider, how do I move the certificate?

A

The easiest way is to create a new CSR on the new machine and have the certificate re-issued.

Q

Why does the website say the SSL certificate is 'Untrusted'?

A

The usual cause of Untrusted SSL Certificate is that the Comodo intermediate certificate has not been loaded.

Q

What is a public/private key pair in SSL?

A

Each SSL Certificate contains a public/private key pair: a private key with the code and a public key used to decode it.

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help keel johnston ?
Unhide the folders on windows Explorer

Give any solutions to unhide folder using command prompt?

forum3

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.