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 server1.example.com domain..!!
                             :wq

Set VirtualHost for http on port 80.
[root@server1 ~]# vim /etc/httpd/conf/httpd.conf
<VirtualHost 172.24.0.254:80>
DocumentRoot /var/www/html
ServerName server1.example.com
</VirtualHost>
                             :wq

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

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

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/server1.example.com.crt

          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/server1.example.com.key

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

Open Firefox and type this URL in "https://server1.example.com" 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