HTTPS with self-signed certificate

Install apache, mod_ssl and crypto-utils package.
[root@server1 ~]# yum install http* mod_ssl* crypt-utils* -y

Restart the http service and make it available after the reboot.
[root@server1 ~]# service httpd restart
[root@server1 ~]# chkconfig httpd on

Configure the webpage in document root ‘/var/www/html’.
[root@server1 ~]# vim /var/www/html/index.html
                             This is the domain..!!

Set VirtualHost for http on port 80.
[root@server1 ~]# vim /etc/httpd/conf/httpd.conf
DocumentRoot /var/www/html

Restart the http service.
[root@server1 ~]# service httpd restart

Generate CSR
[root@server1 ~]# genkey --days 365

NEXT --> 1024 --> NEXT --> would you like to send a certificate request (CSR) to certificate authority (CA) --> NO --> uncheck the option encrypt the private key --> fulfill the certificate requirements --> NEXT --> now in output find the path of certificate and key files.

We need to update the Apache SSL configuration file.
[root@server1 ~]# vim /etc/httpd/conf.d/ssl.conf
          Change the paths to match where the Key file is stored. If you've used the method above it will be
          SSLCertificateFile /etc/pki/tls/certs/

          Then set the correct path for the Certificate Key File a few lines below. If you've followed the instructions
above it is:
          SSLCertificateKeyFile /etc/pki/tls/private/

Restart the http service.
[root@server1 ~]# service httpd restart

Open Firefox and type this URL in "" URL box --> I understand the risk --> Add Exception --> Location --> Specify the address and path of certificate --> Get certificate --> Confirm Certificate Exception

Now the system should display apache webpage with https.

To know about the courses CLICK HERE..!!

Contact US CLICK HERE..!!

No comments:

Post a Comment