For secured http i use the SSL (secure sockit layer)
Now first thing is that what is SSL ?
                                                              Actually SSL is  a protocol which runs over the TCP/IP and communicate with TCP/IP  on behalf of the higher level protocol  such as the HyperText Transport Protocol (HTTP), Lightweight Directory Access Protocol (LDAP), or Internet Messaging Access Protocol (IMAP).
        It was origginally developed by the netscape and then widely accepted for the secure communication between client and server.
    For more information click here

For this purpose i use two packages OpenSSL and  modSSL  packages.
        The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well as a full-strength general purpose cryptography library .
 
 

    modSSL  module provides strong cryptography for the Apache 1.3 webserver via the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols by the help of the Open Source SSL/TLS toolkit OpenSSL, which is based on
 SSLeay from Eric A. Young and Tim J. Hudson.

For install above two software i separately install the modSSL because i already have the Apache web server.
 Following are some prerequisites to install the mod_ssl

   o  Package:      Apache
      Version:      1.3.x

   o  Package:      mod_ssl
      Version:      2.8.x

   o  Package:      OpenSSL
      Version:      0.9.x

    o  Package:      MM
      Version:      1.1.x  (Optional)

   o  Package:      GZip
      Version:      1.2.4

   o  Package:      Perl
      Version:      5.6.0

    To install the OpenSSL i untar the file by the command
     $ tar -xzvf openssl-0.9.6b.tar.gz
    Then
    $ ./config --prefix=/usr/local --openssldir=/usr/local/openssl
    Then
    $ make
    $ make  test
    $ make install

    Now its time to install the modSSL package.For this i follow as
 

    $ ./configure \
              --with-apache=../apache_1.3.x \
              --with-ssl=../openssl-0.9.x \
                --prefix=/path/to/apache \
   $ cd ..
   $ cd apache_1.3.x
   $ make
   $ make certificate
   $ make install
   $ cd ..

    now the mod ssl is also ready to work .

    To generate the certificate and private key from SSL i follow the following command of  OpenSSL.There are various options available to generate the keys for them click here

    $ openssl req -x509 -newkey rsa:rsap.pem -keyout cacert.pem -out cacert.pem

    So it will create the certificate in the file rsap.pem and our private key into cacert.pem .If you will have some problem you should look at OpenSSL FAQs
 

    This certificate generated by server is dummy certificate and if you will try with your site it will show you that certificate is certified by the snakeoil .To certify you can contact to any certifying authority like i have taken the certificate from Verisign but it's a trial version and only valid for 14 days.
    Now put the certificate in the directory   /path/to/apache/conf/ssl.crt .
    In my machine i have put it in  /usr/src/apache/conf/ssl.crt/ directory in the file server.crt
    And similarly key into /usr/src/apache/conf/ssl.key/server.key .
    Now the machine is ready having a certificate .
    For demo click here